From 1098be40dfeeed78d3fa74b72678d9f3e8978c78 Mon Sep 17 00:00:00 2001 From: eru Date: Tue, 29 Sep 2009 18:25:29 +0000 Subject: [PATCH] =?utf8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3?= =?utf8?q?=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF=E3=81=ABDNS=E6=83=85?= =?utf8?q?=E5=A0=B1=E3=82=92=E4=BD=BF=E3=81=86=E3=82=88=E3=81=86=E3=81=AB?= =?utf8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- PeerCast.root/PeerCast/core/common/pcp.cpp | 12 +++++++++++- PeerCast.root/PeerCast/core/common/servmgr.cpp | 17 +++++++++++++++++ PeerCast.root/PeerCast/core/common/servmgr.h | 2 ++ PeerCast.root/PeerCast/core/common/version2.h | 7 ++++--- PeerCast.root/PeerCast/ui/win32/simple/Simple.rc | 8 ++++---- c:/Git/PeerCast.root/PeerCast/core/common/pcp.cpp | 12 +++++++++++- c:/Git/PeerCast.root/PeerCast/core/common/servmgr.cpp | 17 +++++++++++++++++ c:/Git/PeerCast.root/PeerCast/core/common/servmgr.h | 2 ++ c:/Git/PeerCast.root/PeerCast/core/common/version2.h | 7 ++++--- c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc | 8 ++++---- 10 files changed, 76 insertions(+), 16 deletions(-) diff --git a/PeerCast.root/PeerCast/core/common/pcp.cpp b/PeerCast.root/PeerCast/core/common/pcp.cpp index ff7ded8..6ad4418 100644 --- a/PeerCast.root/PeerCast/core/common/pcp.cpp +++ b/PeerCast.root/PeerCast/core/common/pcp.cpp @@ -736,11 +736,21 @@ int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs) patom.writeBytes(id,ver_ex_prefix,2); }else if (id == PCP_BCST_VERSION_EX_NUMBER) { + // version check (force) + if (servMgr->versionDNS > PCP_CLIENT_VERSION_EX_NUMBER) + { + strcpy(servMgr->downloadURL, PCP_CLIENT_DIST_URL); + peercastApp->notifyMessage(ServMgr::NT_UPGRADE,"V‚µ‚¢ƒo[ƒWƒ‡ƒ“‚ÌPeercast‚ªƒŠƒŠ[ƒX‚³‚ê‚Ü‚µ‚½B"); + + LOG_DEBUG("PCP triggered version check (force): %d / %d", servMgr->versionDNS, PCP_CLIENT_VERSION_EX_NUMBER); + } + ver_ex_number = atom.readShort(); patom.writeShort(id,ver_ex_number); // version check - if (!servMgr->noVersionCheck + if (!servMgr->versionDNS // DNS‚©‚çƒo[ƒWƒ‡ƒ“î•ñ‚ðŽæ“¾‚Å‚«‚È‚©‚Á‚½ + && !servMgr->noVersionCheck && !strncmp(ver_ex_prefix, PCP_CLIENT_VERSION_EX_PREFIX, 2) && ver_ex_number > PCP_CLIENT_VERSION_EX_NUMBER) { diff --git a/PeerCast.root/PeerCast/core/common/servmgr.cpp b/PeerCast.root/PeerCast/core/common/servmgr.cpp index 4391037..5fb1d20 100644 --- a/PeerCast.root/PeerCast/core/common/servmgr.cpp +++ b/PeerCast.root/PeerCast/core/common/servmgr.cpp @@ -143,6 +143,23 @@ ServMgr::ServMgr() preventSS = false; noVersionCheck = false; + // retrieve newest version number from DNS + // for windows ONLY. Linux or other OS is NOT supported. +#ifdef WIN32 + { + struct hostent *he; + + he = gethostbyname(PCP_CLIENT_VERSION_URL); + if (he && he->h_addrtype == AF_INET) + { + versionDNS = ((struct in_addr*)he->h_addr_list[0])->S_un.S_un_b.s_b3; + } else + versionDNS = 0; + } +#else + versionDNS = 0; +#endif + chanLog=""; maxRelaysIndexTxt = 1; // for PCRaw (relay) diff --git a/PeerCast.root/PeerCast/core/common/servmgr.h b/PeerCast.root/PeerCast/core/common/servmgr.h index 87da231..309d98d 100644 --- a/PeerCast.root/PeerCast/core/common/servmgr.h +++ b/PeerCast.root/PeerCast/core/common/servmgr.h @@ -422,6 +422,8 @@ public: bool preventSS; // ƒXƒNƒŠ[ƒ“ƒZ[ƒo[‚ð—}Ž~ bool noVersionCheck; // bcstAtom‚É‚æ‚éƒo[ƒWƒ‡ƒ“ƒ`ƒFƒbƒN‚ðs‚í‚È‚¢ + int versionDNS; // DNS‚©‚çŽæ“¾‚µ‚½ÅVƒo[ƒWƒ‡ƒ“‚̔ԍ† + int maxRelaysIndexTxt; // for PCRaw (relay) #ifdef WIN32 //JP-MOD diff --git a/PeerCast.root/PeerCast/core/common/version2.h b/PeerCast.root/PeerCast/core/common/version2.h index 1497f04..2ae49c9 100644 --- a/PeerCast.root/PeerCast/core/common/version2.h +++ b/PeerCast.root/PeerCast/core/common/version2.h @@ -44,11 +44,12 @@ extern int version_ex; // VERSION_EX #if 1 /* for VP extend version */ //#define VERSION_EX 1 static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only -static const int PCP_CLIENT_VERSION_EX_NUMBER = 39; -static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0039)"; -static const char *PCX_VERSTRING_EX = "v0.1218(IM0039)"; +static const int PCP_CLIENT_VERSION_EX_NUMBER = 40; +static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0040)"; +static const char *PCX_VERSTRING_EX = "v0.1218(IM0040)"; static const char *PCP_CLIENT_DIST_URL = "http://pecaim.net/"; +static const char *PCP_CLIENT_VERSION_URL = "version.pecaim.net"; #endif // ------------------------------------------------ diff --git a/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc b/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc index 90a2888..e8c0f58 100644 --- a/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc +++ b/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc @@ -71,8 +71,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,3,9,0 - PRODUCTVERSION 1,3,9,0 + FILEVERSION 1,4,0,0 + PRODUCTVERSION 1,4,0,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -89,12 +89,12 @@ BEGIN BEGIN VALUE "CompanyName", "PeCa" VALUE "FileDescription", "Peercast IM" - VALUE "FileVersion", "1, 3, 9, 0" + VALUE "FileVersion", "1, 4, 0, 0" VALUE "InternalName", "PeCaIM" VALUE "LegalCopyright", "Copyright (C) 2009" VALUE "OriginalFilename", "PeerCast.exe" VALUE "ProductName", "Peercast IM" - VALUE "ProductVersion", "1, 3, 9, 0" + VALUE "ProductVersion", "1, 4, 0, 0" END END BLOCK "VarFileInfo" diff --git a/c:/Git/PeerCast.root/PeerCast/core/common/pcp.cpp b/c:/Git/PeerCast.root/PeerCast/core/common/pcp.cpp index ff7ded8..6ad4418 100644 --- a/c:/Git/PeerCast.root/PeerCast/core/common/pcp.cpp +++ b/c:/Git/PeerCast.root/PeerCast/core/common/pcp.cpp @@ -736,11 +736,21 @@ int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs) patom.writeBytes(id,ver_ex_prefix,2); }else if (id == PCP_BCST_VERSION_EX_NUMBER) { + // version check (force) + if (servMgr->versionDNS > PCP_CLIENT_VERSION_EX_NUMBER) + { + strcpy(servMgr->downloadURL, PCP_CLIENT_DIST_URL); + peercastApp->notifyMessage(ServMgr::NT_UPGRADE,"V‚µ‚¢ƒo[ƒWƒ‡ƒ“‚ÌPeercast‚ªƒŠƒŠ[ƒX‚³‚ê‚Ü‚µ‚½B"); + + LOG_DEBUG("PCP triggered version check (force): %d / %d", servMgr->versionDNS, PCP_CLIENT_VERSION_EX_NUMBER); + } + ver_ex_number = atom.readShort(); patom.writeShort(id,ver_ex_number); // version check - if (!servMgr->noVersionCheck + if (!servMgr->versionDNS // DNS‚©‚çƒo[ƒWƒ‡ƒ“î•ñ‚ðŽæ“¾‚Å‚«‚È‚©‚Á‚½ + && !servMgr->noVersionCheck && !strncmp(ver_ex_prefix, PCP_CLIENT_VERSION_EX_PREFIX, 2) && ver_ex_number > PCP_CLIENT_VERSION_EX_NUMBER) { diff --git a/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.cpp b/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.cpp index 4391037..5fb1d20 100644 --- a/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.cpp +++ b/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.cpp @@ -143,6 +143,23 @@ ServMgr::ServMgr() preventSS = false; noVersionCheck = false; + // retrieve newest version number from DNS + // for windows ONLY. Linux or other OS is NOT supported. +#ifdef WIN32 + { + struct hostent *he; + + he = gethostbyname(PCP_CLIENT_VERSION_URL); + if (he && he->h_addrtype == AF_INET) + { + versionDNS = ((struct in_addr*)he->h_addr_list[0])->S_un.S_un_b.s_b3; + } else + versionDNS = 0; + } +#else + versionDNS = 0; +#endif + chanLog=""; maxRelaysIndexTxt = 1; // for PCRaw (relay) diff --git a/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.h b/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.h index 87da231..309d98d 100644 --- a/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.h +++ b/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.h @@ -422,6 +422,8 @@ public: bool preventSS; // ƒXƒNƒŠ[ƒ“ƒZ[ƒo[‚ð—}Ž~ bool noVersionCheck; // bcstAtom‚É‚æ‚éƒo[ƒWƒ‡ƒ“ƒ`ƒFƒbƒN‚ðs‚í‚È‚¢ + int versionDNS; // DNS‚©‚çŽæ“¾‚µ‚½ÅVƒo[ƒWƒ‡ƒ“‚̔ԍ† + int maxRelaysIndexTxt; // for PCRaw (relay) #ifdef WIN32 //JP-MOD diff --git a/c:/Git/PeerCast.root/PeerCast/core/common/version2.h b/c:/Git/PeerCast.root/PeerCast/core/common/version2.h index 1497f04..2ae49c9 100644 --- a/c:/Git/PeerCast.root/PeerCast/core/common/version2.h +++ b/c:/Git/PeerCast.root/PeerCast/core/common/version2.h @@ -44,11 +44,12 @@ extern int version_ex; // VERSION_EX #if 1 /* for VP extend version */ //#define VERSION_EX 1 static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only -static const int PCP_CLIENT_VERSION_EX_NUMBER = 39; -static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0039)"; -static const char *PCX_VERSTRING_EX = "v0.1218(IM0039)"; +static const int PCP_CLIENT_VERSION_EX_NUMBER = 40; +static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0040)"; +static const char *PCX_VERSTRING_EX = "v0.1218(IM0040)"; static const char *PCP_CLIENT_DIST_URL = "http://pecaim.net/"; +static const char *PCP_CLIENT_VERSION_URL = "version.pecaim.net"; #endif // ------------------------------------------------ diff --git a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc index 90a2888..e8c0f58 100644 --- a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc +++ b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc @@ -71,8 +71,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,3,9,0 - PRODUCTVERSION 1,3,9,0 + FILEVERSION 1,4,0,0 + PRODUCTVERSION 1,4,0,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -89,12 +89,12 @@ BEGIN BEGIN VALUE "CompanyName", "PeCa" VALUE "FileDescription", "Peercast IM" - VALUE "FileVersion", "1, 3, 9, 0" + VALUE "FileVersion", "1, 4, 0, 0" VALUE "InternalName", "PeCaIM" VALUE "LegalCopyright", "Copyright (C) 2009" VALUE "OriginalFilename", "PeerCast.exe" VALUE "ProductName", "Peercast IM" - VALUE "ProductVersion", "1, 3, 9, 0" + VALUE "ProductVersion", "1, 4, 0, 0" END END BLOCK "VarFileInfo" -- 2.11.0