From e7739499f306a05068bb36f67284234137a379af Mon Sep 17 00:00:00 2001 From: eru Date: Thu, 28 May 2009 14:28:01 +0000 Subject: [PATCH] =?utf8?q?IM0036=20=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7?= =?utf8?q?=E3=83=B3=E3=82=A2=E3=83=83=E3=83=97=E9=80=9A=E7=9F=A5=E3=82=92?= =?utf8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- PeerCast.root/PeerCast/core/common/pcp.cpp | 11 +++++++++ PeerCast.root/PeerCast/core/common/peercast.cpp | 2 +- PeerCast.root/PeerCast/core/common/servmgr.cpp | 4 ++++ PeerCast.root/PeerCast/core/common/servmgr.h | 1 + PeerCast.root/PeerCast/core/common/version2.h | 6 +++-- PeerCast.root/PeerCast/ui/win32/simple/Simple.cpp | 27 ++++++++++++++++++---- PeerCast.root/PeerCast/ui/win32/simple/Simple.rc | 1 + PeerCast.root/PeerCast/ui/win32/simple/resource.h | 4 +++- c:/Git/PeerCast.root/PeerCast/core/common/pcp.cpp | 11 +++++++++ .../PeerCast/core/common/peercast.cpp | 2 +- .../PeerCast.root/PeerCast/core/common/servmgr.cpp | 4 ++++ .../PeerCast.root/PeerCast/core/common/servmgr.h | 1 + .../PeerCast.root/PeerCast/core/common/version2.h | 6 +++-- .../PeerCast/ui/win32/simple/Simple.cpp | 27 ++++++++++++++++++---- .../PeerCast/ui/win32/simple/Simple.rc | 1 + .../PeerCast/ui/win32/simple/resource.h | 4 +++- 16 files changed, 96 insertions(+), 16 deletions(-) diff --git a/PeerCast.root/PeerCast/core/common/pcp.cpp b/PeerCast.root/PeerCast/core/common/pcp.cpp index d141df6..ff7ded8 100644 --- a/PeerCast.root/PeerCast/core/common/pcp.cpp +++ b/PeerCast.root/PeerCast/core/common/pcp.cpp @@ -738,6 +738,17 @@ int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs) { ver_ex_number = atom.readShort(); patom.writeShort(id,ver_ex_number); + + // version check + if (!servMgr->noVersionCheck + && !strncmp(ver_ex_prefix, PCP_CLIENT_VERSION_EX_PREFIX, 2) + && ver_ex_number > PCP_CLIENT_VERSION_EX_NUMBER) + { + strcpy(servMgr->downloadURL, PCP_CLIENT_DIST_URL); + peercastApp->notifyMessage(ServMgr::NT_UPGRADE,"V‚µ‚¢ƒo[ƒWƒ‡ƒ“‚ÌPeercast‚ªŒŸo‚³‚ê‚Ü‚µ‚½BXV‚ðŠm”F‚µ‚Ä‚­‚¾‚³‚¢B"); + + LOG_DEBUG("PCP got version check: %d / %d", ver_ex_number, PCP_CLIENT_VERSION_EX_NUMBER); + } }else if (id == PCP_HOST) { ChanHit hit; diff --git a/PeerCast.root/PeerCast/core/common/peercast.cpp b/PeerCast.root/PeerCast/core/common/peercast.cpp index 320dd90..8df871a 100644 --- a/PeerCast.root/PeerCast/core/common/peercast.cpp +++ b/PeerCast.root/PeerCast/core/common/peercast.cpp @@ -20,7 +20,7 @@ ServMgr *servMgr; PeercastInstance *peercastInst=NULL; PeercastApplication *peercastApp=NULL; -int version_ex = 0; +int version_ex = 1; // VERSION_EX—LŒø‰» // --------------------------------- void APICALL PeercastInstance::init() diff --git a/PeerCast.root/PeerCast/core/common/servmgr.cpp b/PeerCast.root/PeerCast/core/common/servmgr.cpp index 4d166cb..4391037 100644 --- a/PeerCast.root/PeerCast/core/common/servmgr.cpp +++ b/PeerCast.root/PeerCast/core/common/servmgr.cpp @@ -141,6 +141,7 @@ ServMgr::ServMgr() topmostGui = false; startWithGui = false; preventSS = false; + noVersionCheck = false; chanLog=""; @@ -1108,6 +1109,7 @@ void ServMgr::saveSettings(const char *fn) iniFile.writeBoolValue("topmostGui", servMgr->topmostGui); iniFile.writeBoolValue("startWithGui", servMgr->startWithGui); iniFile.writeBoolValue("preventSS", servMgr->preventSS); + iniFile.writeBoolValue("noVersionCheck", servMgr->noVersionCheck); #endif int i; @@ -1524,6 +1526,8 @@ void ServMgr::loadSettings(const char *fn) servMgr->startWithGui = iniFile.getBoolValue(); else if (iniFile.isName("preventSS")) servMgr->preventSS = iniFile.getBoolValue(); + else if (iniFile.isName("noVersionCheck")) + servMgr->noVersionCheck = iniFile.getBoolValue(); #endif // debug diff --git a/PeerCast.root/PeerCast/core/common/servmgr.h b/PeerCast.root/PeerCast/core/common/servmgr.h index 8a9310d..87da231 100644 --- a/PeerCast.root/PeerCast/core/common/servmgr.h +++ b/PeerCast.root/PeerCast/core/common/servmgr.h @@ -420,6 +420,7 @@ public: bool topmostGui; // Å‘O–Ê bool startWithGui; // ‹N“®Žž‚ÉGUI bool preventSS; // ƒXƒNƒŠ[ƒ“ƒZ[ƒo[‚ð—}Ž~ + bool noVersionCheck; // bcstAtom‚É‚æ‚éƒo[ƒWƒ‡ƒ“ƒ`ƒFƒbƒN‚ðs‚í‚È‚¢ int maxRelaysIndexTxt; // for PCRaw (relay) diff --git a/PeerCast.root/PeerCast/core/common/version2.h b/PeerCast.root/PeerCast/core/common/version2.h index cd763d5..0364f8b 100644 --- a/PeerCast.root/PeerCast/core/common/version2.h +++ b/PeerCast.root/PeerCast/core/common/version2.h @@ -39,14 +39,16 @@ static const char *PCX_AGENTJP = "PeerCast/0.1218-J"; static const char *PCX_AGENTVP = "PeerCast/0.1218(VP0027)"; static const char *PCX_VERSTRING = "v0.1218(VP0027)"; -extern int version_ex; // PP”ÅŠg’£‹@”\—LŒø‰»ƒtƒ‰ƒO(‚½‚Ô‚ñ)©‘å‰R[VERSION_EX—LŒø‰»ƒtƒ‰ƒO] +extern int version_ex; // VERSION_EX—LŒø‰»ƒtƒ‰ƒO #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 = 35; +static const int PCP_CLIENT_VERSION_EX_NUMBER = 36; static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0035)"; static const char *PCX_VERSTRING_EX = "v0.1218(IM0035)"; + +static const char *PCP_CLIENT_DIST_URL = "http://peercastim.s353.xrea.com/"; #endif // ------------------------------------------------ diff --git a/PeerCast.root/PeerCast/ui/win32/simple/Simple.cpp b/PeerCast.root/PeerCast/ui/win32/simple/Simple.cpp index 35d5c79..81c7324 100644 --- a/PeerCast.root/PeerCast/ui/win32/simple/Simple.cpp +++ b/PeerCast.root/PeerCast/ui/win32/simple/Simple.cpp @@ -191,8 +191,6 @@ void WINAPI ServiceMain(DWORD argc, LPSTR *argv) { //hInst = hInstance; - version_ex = 1; // PP”ÅŠg’£‹@”\‚𖳌ø‚Ɂ©‘å‰RBƒo[ƒWƒ‡ƒ“•\‹L‚ðEX‚É - //iniFileName.set(".\\peercast.ini"); WIN32_FIND_DATA fd; //JP-EX @@ -280,8 +278,6 @@ int WinMainDummy(HINSTANCE hInstance, hInst = hInstance; - version_ex = 1; // PP”ÅŠg’£‹@”\‚𖳌ø‚Ɂ©‘å‰RBƒo[ƒWƒ‡ƒ“•\‹L‚ðEX‚É - iniFileName.set(".\\peercast.ini"); WIN32_FIND_DATA fd; //JP-EX @@ -1202,6 +1198,15 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) CheckMenuItem(trayMenu, ID_POPUP_PREVENT_SS, MF_UNCHECKED|MF_BYCOMMAND); } + // ƒo[ƒWƒ‡ƒ“ƒ`ƒFƒbƒN‚Ì—L–³ + if (servMgr->noVersionCheck) + { + CheckMenuItem(trayMenu, ID_POPUP_NO_VER_CHECK, MF_CHECKED|MF_BYCOMMAND); + } else + { + CheckMenuItem(trayMenu, ID_POPUP_NO_VER_CHECK, MF_UNCHECKED|MF_BYCOMMAND); + } + SetForegroundWindow(hWnd); bool skipMenu=false; @@ -1466,6 +1471,20 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) peercastInst->saveSettings(); break; + case ID_POPUP_NO_VER_CHECK: + // ƒo[ƒWƒ‡ƒ“ƒ`ƒFƒbƒN‚Ì—L–³ + if (servMgr->noVersionCheck) + { + servMgr->noVersionCheck = false; + CheckMenuItem(trayMenu, ID_POPUP_NO_VER_CHECK, MF_UNCHECKED|MF_BYCOMMAND); + } else + { + servMgr->noVersionCheck = true; + CheckMenuItem(trayMenu, ID_POPUP_NO_VER_CHECK, MF_CHECKED|MF_BYCOMMAND); + } + peercastInst->saveSettings(); + break; + case ID_POPUP_EXIT_CONFIRM: case IDM_EXIT: DestroyWindow(hWnd); diff --git a/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc b/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc index a4f2c67..8e3bea2 100644 --- a/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc +++ b/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc @@ -114,6 +114,7 @@ BEGIN MENUITEM "í‚ÉŽè‘O‚É•\Ž¦", ID_POPUP_TOPMOST MENUITEM "‹N“®ŽžAGUI‚ð•\Ž¦", ID_POPUP_START_WITH_GUI MENUITEM "”zMŽžAScreenSaver‚ð—}Ž~", ID_POPUP_PREVENT_SS, GRAYED + MENUITEM "ƒo[ƒWƒ‡ƒ“ƒ`ƒFƒbƒN‚ðs‚í‚È‚¢", ID_POPUP_NO_VER_CHECK END MENUITEM SEPARATOR POPUP "I—¹" diff --git a/PeerCast.root/PeerCast/ui/win32/simple/resource.h b/PeerCast.root/PeerCast/ui/win32/simple/resource.h index d6266ab..cb15c30 100644 --- a/PeerCast.root/PeerCast/ui/win32/simple/resource.h +++ b/PeerCast.root/PeerCast/ui/win32/simple/resource.h @@ -110,6 +110,8 @@ #define ID_POPUP_TRAFFIC 32832 #define ID_32833 32833 #define ID_POPUP_PREVENT_SS 32834 +#define ID_32835 32835 +#define ID_POPUP_NO_VER_CHECK 32836 #define IDC_STATIC -1 // Next default values for new objects @@ -117,7 +119,7 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 144 -#define _APS_NEXT_COMMAND_VALUE 32835 +#define _APS_NEXT_COMMAND_VALUE 32837 #define _APS_NEXT_CONTROL_VALUE 1025 #define _APS_NEXT_SYMED_VALUE 110 #endif diff --git a/c:/Git/PeerCast.root/PeerCast/core/common/pcp.cpp b/c:/Git/PeerCast.root/PeerCast/core/common/pcp.cpp index d141df6..ff7ded8 100644 --- a/c:/Git/PeerCast.root/PeerCast/core/common/pcp.cpp +++ b/c:/Git/PeerCast.root/PeerCast/core/common/pcp.cpp @@ -738,6 +738,17 @@ int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs) { ver_ex_number = atom.readShort(); patom.writeShort(id,ver_ex_number); + + // version check + if (!servMgr->noVersionCheck + && !strncmp(ver_ex_prefix, PCP_CLIENT_VERSION_EX_PREFIX, 2) + && ver_ex_number > PCP_CLIENT_VERSION_EX_NUMBER) + { + strcpy(servMgr->downloadURL, PCP_CLIENT_DIST_URL); + peercastApp->notifyMessage(ServMgr::NT_UPGRADE,"V‚µ‚¢ƒo[ƒWƒ‡ƒ“‚ÌPeercast‚ªŒŸo‚³‚ê‚Ü‚µ‚½BXV‚ðŠm”F‚µ‚Ä‚­‚¾‚³‚¢B"); + + LOG_DEBUG("PCP got version check: %d / %d", ver_ex_number, PCP_CLIENT_VERSION_EX_NUMBER); + } }else if (id == PCP_HOST) { ChanHit hit; diff --git a/c:/Git/PeerCast.root/PeerCast/core/common/peercast.cpp b/c:/Git/PeerCast.root/PeerCast/core/common/peercast.cpp index 320dd90..8df871a 100644 --- a/c:/Git/PeerCast.root/PeerCast/core/common/peercast.cpp +++ b/c:/Git/PeerCast.root/PeerCast/core/common/peercast.cpp @@ -20,7 +20,7 @@ ServMgr *servMgr; PeercastInstance *peercastInst=NULL; PeercastApplication *peercastApp=NULL; -int version_ex = 0; +int version_ex = 1; // VERSION_EX—LŒø‰» // --------------------------------- void APICALL PeercastInstance::init() diff --git a/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.cpp b/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.cpp index 4d166cb..4391037 100644 --- a/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.cpp +++ b/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.cpp @@ -141,6 +141,7 @@ ServMgr::ServMgr() topmostGui = false; startWithGui = false; preventSS = false; + noVersionCheck = false; chanLog=""; @@ -1108,6 +1109,7 @@ void ServMgr::saveSettings(const char *fn) iniFile.writeBoolValue("topmostGui", servMgr->topmostGui); iniFile.writeBoolValue("startWithGui", servMgr->startWithGui); iniFile.writeBoolValue("preventSS", servMgr->preventSS); + iniFile.writeBoolValue("noVersionCheck", servMgr->noVersionCheck); #endif int i; @@ -1524,6 +1526,8 @@ void ServMgr::loadSettings(const char *fn) servMgr->startWithGui = iniFile.getBoolValue(); else if (iniFile.isName("preventSS")) servMgr->preventSS = iniFile.getBoolValue(); + else if (iniFile.isName("noVersionCheck")) + servMgr->noVersionCheck = iniFile.getBoolValue(); #endif // debug diff --git a/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.h b/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.h index 8a9310d..87da231 100644 --- a/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.h +++ b/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.h @@ -420,6 +420,7 @@ public: bool topmostGui; // Å‘O–Ê bool startWithGui; // ‹N“®Žž‚ÉGUI bool preventSS; // ƒXƒNƒŠ[ƒ“ƒZ[ƒo[‚ð—}Ž~ + bool noVersionCheck; // bcstAtom‚É‚æ‚éƒo[ƒWƒ‡ƒ“ƒ`ƒFƒbƒN‚ðs‚í‚È‚¢ int maxRelaysIndexTxt; // for PCRaw (relay) diff --git a/c:/Git/PeerCast.root/PeerCast/core/common/version2.h b/c:/Git/PeerCast.root/PeerCast/core/common/version2.h index cd763d5..0364f8b 100644 --- a/c:/Git/PeerCast.root/PeerCast/core/common/version2.h +++ b/c:/Git/PeerCast.root/PeerCast/core/common/version2.h @@ -39,14 +39,16 @@ static const char *PCX_AGENTJP = "PeerCast/0.1218-J"; static const char *PCX_AGENTVP = "PeerCast/0.1218(VP0027)"; static const char *PCX_VERSTRING = "v0.1218(VP0027)"; -extern int version_ex; // PP”ÅŠg’£‹@”\—LŒø‰»ƒtƒ‰ƒO(‚½‚Ô‚ñ)©‘å‰R[VERSION_EX—LŒø‰»ƒtƒ‰ƒO] +extern int version_ex; // VERSION_EX—LŒø‰»ƒtƒ‰ƒO #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 = 35; +static const int PCP_CLIENT_VERSION_EX_NUMBER = 36; static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0035)"; static const char *PCX_VERSTRING_EX = "v0.1218(IM0035)"; + +static const char *PCP_CLIENT_DIST_URL = "http://peercastim.s353.xrea.com/"; #endif // ------------------------------------------------ diff --git a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.cpp b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.cpp index 35d5c79..81c7324 100644 --- a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.cpp +++ b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.cpp @@ -191,8 +191,6 @@ void WINAPI ServiceMain(DWORD argc, LPSTR *argv) { //hInst = hInstance; - version_ex = 1; // PP”ÅŠg’£‹@”\‚𖳌ø‚Ɂ©‘å‰RBƒo[ƒWƒ‡ƒ“•\‹L‚ðEX‚É - //iniFileName.set(".\\peercast.ini"); WIN32_FIND_DATA fd; //JP-EX @@ -280,8 +278,6 @@ int WinMainDummy(HINSTANCE hInstance, hInst = hInstance; - version_ex = 1; // PP”ÅŠg’£‹@”\‚𖳌ø‚Ɂ©‘å‰RBƒo[ƒWƒ‡ƒ“•\‹L‚ðEX‚É - iniFileName.set(".\\peercast.ini"); WIN32_FIND_DATA fd; //JP-EX @@ -1202,6 +1198,15 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) CheckMenuItem(trayMenu, ID_POPUP_PREVENT_SS, MF_UNCHECKED|MF_BYCOMMAND); } + // ƒo[ƒWƒ‡ƒ“ƒ`ƒFƒbƒN‚Ì—L–³ + if (servMgr->noVersionCheck) + { + CheckMenuItem(trayMenu, ID_POPUP_NO_VER_CHECK, MF_CHECKED|MF_BYCOMMAND); + } else + { + CheckMenuItem(trayMenu, ID_POPUP_NO_VER_CHECK, MF_UNCHECKED|MF_BYCOMMAND); + } + SetForegroundWindow(hWnd); bool skipMenu=false; @@ -1466,6 +1471,20 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) peercastInst->saveSettings(); break; + case ID_POPUP_NO_VER_CHECK: + // ƒo[ƒWƒ‡ƒ“ƒ`ƒFƒbƒN‚Ì—L–³ + if (servMgr->noVersionCheck) + { + servMgr->noVersionCheck = false; + CheckMenuItem(trayMenu, ID_POPUP_NO_VER_CHECK, MF_UNCHECKED|MF_BYCOMMAND); + } else + { + servMgr->noVersionCheck = true; + CheckMenuItem(trayMenu, ID_POPUP_NO_VER_CHECK, MF_CHECKED|MF_BYCOMMAND); + } + peercastInst->saveSettings(); + break; + case ID_POPUP_EXIT_CONFIRM: case IDM_EXIT: DestroyWindow(hWnd); 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 a4f2c67..8e3bea2 100644 --- a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc +++ b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc @@ -114,6 +114,7 @@ BEGIN MENUITEM "í‚ÉŽè‘O‚É•\Ž¦", ID_POPUP_TOPMOST MENUITEM "‹N“®ŽžAGUI‚ð•\Ž¦", ID_POPUP_START_WITH_GUI MENUITEM "”zMŽžAScreenSaver‚ð—}Ž~", ID_POPUP_PREVENT_SS, GRAYED + MENUITEM "ƒo[ƒWƒ‡ƒ“ƒ`ƒFƒbƒN‚ðs‚í‚È‚¢", ID_POPUP_NO_VER_CHECK END MENUITEM SEPARATOR POPUP "I—¹" diff --git a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/resource.h b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/resource.h index d6266ab..cb15c30 100644 --- a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/resource.h +++ b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/resource.h @@ -110,6 +110,8 @@ #define ID_POPUP_TRAFFIC 32832 #define ID_32833 32833 #define ID_POPUP_PREVENT_SS 32834 +#define ID_32835 32835 +#define ID_POPUP_NO_VER_CHECK 32836 #define IDC_STATIC -1 // Next default values for new objects @@ -117,7 +119,7 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 144 -#define _APS_NEXT_COMMAND_VALUE 32835 +#define _APS_NEXT_COMMAND_VALUE 32837 #define _APS_NEXT_CONTROL_VALUE 1025 #define _APS_NEXT_SYMED_VALUE 110 #endif -- 2.11.0