リビジョン | 1098be40dfeeed78d3fa74b72678d9f3e8978c78 (tree) |
---|---|
日時 | 2009-09-30 03:25:29 |
作者 | eru <eru01@user...> |
コミッター | eru |
バージョンチェックにDNS情報を使うようにした
@@ -736,11 +736,21 @@ int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs) | ||
736 | 736 | patom.writeBytes(id,ver_ex_prefix,2); |
737 | 737 | }else if (id == PCP_BCST_VERSION_EX_NUMBER) |
738 | 738 | { |
739 | + // version check (force) | |
740 | + if (servMgr->versionDNS > PCP_CLIENT_VERSION_EX_NUMBER) | |
741 | + { | |
742 | + strcpy(servMgr->downloadURL, PCP_CLIENT_DIST_URL); | |
743 | + peercastApp->notifyMessage(ServMgr::NT_UPGRADE,"新しいバージョンのPeercastがリリースされました。"); | |
744 | + | |
745 | + LOG_DEBUG("PCP triggered version check (force): %d / %d", servMgr->versionDNS, PCP_CLIENT_VERSION_EX_NUMBER); | |
746 | + } | |
747 | + | |
739 | 748 | ver_ex_number = atom.readShort(); |
740 | 749 | patom.writeShort(id,ver_ex_number); |
741 | 750 | |
742 | 751 | // version check |
743 | - if (!servMgr->noVersionCheck | |
752 | + if (!servMgr->versionDNS // DNSからバージョン情報を取得できなかった | |
753 | + && !servMgr->noVersionCheck | |
744 | 754 | && !strncmp(ver_ex_prefix, PCP_CLIENT_VERSION_EX_PREFIX, 2) |
745 | 755 | && ver_ex_number > PCP_CLIENT_VERSION_EX_NUMBER) |
746 | 756 | { |
@@ -143,6 +143,23 @@ ServMgr::ServMgr() | ||
143 | 143 | preventSS = false; |
144 | 144 | noVersionCheck = false; |
145 | 145 | |
146 | + // retrieve newest version number from DNS | |
147 | + // for windows ONLY. Linux or other OS is NOT supported. | |
148 | +#ifdef WIN32 | |
149 | + { | |
150 | + struct hostent *he; | |
151 | + | |
152 | + he = gethostbyname(PCP_CLIENT_VERSION_URL); | |
153 | + if (he && he->h_addrtype == AF_INET) | |
154 | + { | |
155 | + versionDNS = ((struct in_addr*)he->h_addr_list[0])->S_un.S_un_b.s_b3; | |
156 | + } else | |
157 | + versionDNS = 0; | |
158 | + } | |
159 | +#else | |
160 | + versionDNS = 0; | |
161 | +#endif | |
162 | + | |
146 | 163 | chanLog=""; |
147 | 164 | |
148 | 165 | maxRelaysIndexTxt = 1; // for PCRaw (relay) |
@@ -422,6 +422,8 @@ public: | ||
422 | 422 | bool preventSS; // スクリーンセーバーを抑止 |
423 | 423 | bool noVersionCheck; // bcstAtomによるバージョンチェックを行わない |
424 | 424 | |
425 | + int versionDNS; // DNSから取得した最新バージョンの番号 | |
426 | + | |
425 | 427 | int maxRelaysIndexTxt; // for PCRaw (relay) |
426 | 428 | |
427 | 429 | #ifdef WIN32 //JP-MOD |
@@ -44,11 +44,12 @@ extern int version_ex; // VERSION_EX | ||
44 | 44 | #if 1 /* for VP extend version */ |
45 | 45 | //#define VERSION_EX 1 |
46 | 46 | static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only |
47 | -static const int PCP_CLIENT_VERSION_EX_NUMBER = 39; | |
48 | -static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0039)"; | |
49 | -static const char *PCX_VERSTRING_EX = "v0.1218(IM0039)"; | |
47 | +static const int PCP_CLIENT_VERSION_EX_NUMBER = 40; | |
48 | +static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0040)"; | |
49 | +static const char *PCX_VERSTRING_EX = "v0.1218(IM0040)"; | |
50 | 50 | |
51 | 51 | static const char *PCP_CLIENT_DIST_URL = "http://pecaim.net/"; |
52 | +static const char *PCP_CLIENT_VERSION_URL = "version.pecaim.net"; | |
52 | 53 | #endif |
53 | 54 | |
54 | 55 | // ------------------------------------------------ |
@@ -71,8 +71,8 @@ END | ||
71 | 71 | // |
72 | 72 | |
73 | 73 | VS_VERSION_INFO VERSIONINFO |
74 | - FILEVERSION 1,3,9,0 | |
75 | - PRODUCTVERSION 1,3,9,0 | |
74 | + FILEVERSION 1,4,0,0 | |
75 | + PRODUCTVERSION 1,4,0,0 | |
76 | 76 | FILEFLAGSMASK 0x17L |
77 | 77 | #ifdef _DEBUG |
78 | 78 | FILEFLAGS 0x1L |
@@ -89,12 +89,12 @@ BEGIN | ||
89 | 89 | BEGIN |
90 | 90 | VALUE "CompanyName", "PeCa" |
91 | 91 | VALUE "FileDescription", "Peercast IM" |
92 | - VALUE "FileVersion", "1, 3, 9, 0" | |
92 | + VALUE "FileVersion", "1, 4, 0, 0" | |
93 | 93 | VALUE "InternalName", "PeCaIM" |
94 | 94 | VALUE "LegalCopyright", "Copyright (C) 2009" |
95 | 95 | VALUE "OriginalFilename", "PeerCast.exe" |
96 | 96 | VALUE "ProductName", "Peercast IM" |
97 | - VALUE "ProductVersion", "1, 3, 9, 0" | |
97 | + VALUE "ProductVersion", "1, 4, 0, 0" | |
98 | 98 | END |
99 | 99 | END |
100 | 100 | BLOCK "VarFileInfo" |
@@ -736,11 +736,21 @@ int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs) | ||
736 | 736 | patom.writeBytes(id,ver_ex_prefix,2); |
737 | 737 | }else if (id == PCP_BCST_VERSION_EX_NUMBER) |
738 | 738 | { |
739 | + // version check (force) | |
740 | + if (servMgr->versionDNS > PCP_CLIENT_VERSION_EX_NUMBER) | |
741 | + { | |
742 | + strcpy(servMgr->downloadURL, PCP_CLIENT_DIST_URL); | |
743 | + peercastApp->notifyMessage(ServMgr::NT_UPGRADE,"新しいバージョンのPeercastがリリースされました。"); | |
744 | + | |
745 | + LOG_DEBUG("PCP triggered version check (force): %d / %d", servMgr->versionDNS, PCP_CLIENT_VERSION_EX_NUMBER); | |
746 | + } | |
747 | + | |
739 | 748 | ver_ex_number = atom.readShort(); |
740 | 749 | patom.writeShort(id,ver_ex_number); |
741 | 750 | |
742 | 751 | // version check |
743 | - if (!servMgr->noVersionCheck | |
752 | + if (!servMgr->versionDNS // DNSからバージョン情報を取得できなかった | |
753 | + && !servMgr->noVersionCheck | |
744 | 754 | && !strncmp(ver_ex_prefix, PCP_CLIENT_VERSION_EX_PREFIX, 2) |
745 | 755 | && ver_ex_number > PCP_CLIENT_VERSION_EX_NUMBER) |
746 | 756 | { |
@@ -143,6 +143,23 @@ ServMgr::ServMgr() | ||
143 | 143 | preventSS = false; |
144 | 144 | noVersionCheck = false; |
145 | 145 | |
146 | + // retrieve newest version number from DNS | |
147 | + // for windows ONLY. Linux or other OS is NOT supported. | |
148 | +#ifdef WIN32 | |
149 | + { | |
150 | + struct hostent *he; | |
151 | + | |
152 | + he = gethostbyname(PCP_CLIENT_VERSION_URL); | |
153 | + if (he && he->h_addrtype == AF_INET) | |
154 | + { | |
155 | + versionDNS = ((struct in_addr*)he->h_addr_list[0])->S_un.S_un_b.s_b3; | |
156 | + } else | |
157 | + versionDNS = 0; | |
158 | + } | |
159 | +#else | |
160 | + versionDNS = 0; | |
161 | +#endif | |
162 | + | |
146 | 163 | chanLog=""; |
147 | 164 | |
148 | 165 | maxRelaysIndexTxt = 1; // for PCRaw (relay) |
@@ -422,6 +422,8 @@ public: | ||
422 | 422 | bool preventSS; // スクリーンセーバーを抑止 |
423 | 423 | bool noVersionCheck; // bcstAtomによるバージョンチェックを行わない |
424 | 424 | |
425 | + int versionDNS; // DNSから取得した最新バージョンの番号 | |
426 | + | |
425 | 427 | int maxRelaysIndexTxt; // for PCRaw (relay) |
426 | 428 | |
427 | 429 | #ifdef WIN32 //JP-MOD |
@@ -44,11 +44,12 @@ extern int version_ex; // VERSION_EX | ||
44 | 44 | #if 1 /* for VP extend version */ |
45 | 45 | //#define VERSION_EX 1 |
46 | 46 | static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only |
47 | -static const int PCP_CLIENT_VERSION_EX_NUMBER = 39; | |
48 | -static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0039)"; | |
49 | -static const char *PCX_VERSTRING_EX = "v0.1218(IM0039)"; | |
47 | +static const int PCP_CLIENT_VERSION_EX_NUMBER = 40; | |
48 | +static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0040)"; | |
49 | +static const char *PCX_VERSTRING_EX = "v0.1218(IM0040)"; | |
50 | 50 | |
51 | 51 | static const char *PCP_CLIENT_DIST_URL = "http://pecaim.net/"; |
52 | +static const char *PCP_CLIENT_VERSION_URL = "version.pecaim.net"; | |
52 | 53 | #endif |
53 | 54 | |
54 | 55 | // ------------------------------------------------ |
@@ -71,8 +71,8 @@ END | ||
71 | 71 | // |
72 | 72 | |
73 | 73 | VS_VERSION_INFO VERSIONINFO |
74 | - FILEVERSION 1,3,9,0 | |
75 | - PRODUCTVERSION 1,3,9,0 | |
74 | + FILEVERSION 1,4,0,0 | |
75 | + PRODUCTVERSION 1,4,0,0 | |
76 | 76 | FILEFLAGSMASK 0x17L |
77 | 77 | #ifdef _DEBUG |
78 | 78 | FILEFLAGS 0x1L |
@@ -89,12 +89,12 @@ BEGIN | ||
89 | 89 | BEGIN |
90 | 90 | VALUE "CompanyName", "PeCa" |
91 | 91 | VALUE "FileDescription", "Peercast IM" |
92 | - VALUE "FileVersion", "1, 3, 9, 0" | |
92 | + VALUE "FileVersion", "1, 4, 0, 0" | |
93 | 93 | VALUE "InternalName", "PeCaIM" |
94 | 94 | VALUE "LegalCopyright", "Copyright (C) 2009" |
95 | 95 | VALUE "OriginalFilename", "PeerCast.exe" |
96 | 96 | VALUE "ProductName", "Peercast IM" |
97 | - VALUE "ProductVersion", "1, 3, 9, 0" | |
97 | + VALUE "ProductVersion", "1, 4, 0, 0" | |
98 | 98 | END |
99 | 99 | END |
100 | 100 | BLOCK "VarFileInfo" |