From 64d17bdf1ae8c9ff22487df2202b4cd46d88b418 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sun, 14 Oct 2012 17:50:53 +0000 Subject: * fixed popup crash * changed client info for MSN to use MirVer * minor cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@1935 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SeenPlugin/res/resource.rc | 2 +- plugins/SeenPlugin/src/file.cpp | 2 +- plugins/SeenPlugin/src/main.cpp | 12 ++++---- plugins/SeenPlugin/src/menu.cpp | 3 +- plugins/SeenPlugin/src/options.cpp | 12 ++++---- plugins/SeenPlugin/src/userinfo.cpp | 3 +- plugins/SeenPlugin/src/utils.cpp | 56 ++++++++++--------------------------- 7 files changed, 33 insertions(+), 57 deletions(-) diff --git a/plugins/SeenPlugin/res/resource.rc b/plugins/SeenPlugin/res/resource.rc index 638d9eff77..e44bb1a046 100644 --- a/plugins/SeenPlugin/res/resource.rc +++ b/plugins/SeenPlugin/res/resource.rc @@ -108,7 +108,7 @@ BEGIN RTEXT "Away",IDC_STATIC,10,63,60,10 CONTROL "",ID_STATUS_AWAY,"ColourPicker",WS_TABSTOP,80,60,20,14 CONTROL "",ID_STATUS_AWAY+20,"ColourPicker",WS_TABSTOP,105,60,20,14 - RTEXT "N/A",IDC_STATIC,10,83,60,10 + RTEXT "NA",IDC_STATIC,10,83,60,10 CONTROL "",ID_STATUS_NA,"ColourPicker",WS_TABSTOP,80,80,20,14 CONTROL "",ID_STATUS_NA+20,"ColourPicker",WS_TABSTOP,105,80,20,14 RTEXT "Occupied",IDC_STATIC,10,103,60,10 diff --git a/plugins/SeenPlugin/src/file.cpp b/plugins/SeenPlugin/src/file.cpp index 77cf31d373..b6e004897c 100644 --- a/plugins/SeenPlugin/src/file.cpp +++ b/plugins/SeenPlugin/src/file.cpp @@ -78,7 +78,7 @@ void FileWrite(HANDLE hcontact) db_free(&dbv); SetFilePointer(fhout,0,0,FILE_END); - if ( !DBGetContactSettingTString(NULL, S_MOD," FileStamp", &dbv)) { + if ( !DBGetContactSettingTString(NULL, S_MOD,"FileStamp", &dbv)) { _tcscpy(szout, ParseString(dbv.ptszVal, hcontact, 1)); db_free(&dbv); } diff --git a/plugins/SeenPlugin/src/main.cpp b/plugins/SeenPlugin/src/main.cpp index 4b92d2a552..9280f550ad 100644 --- a/plugins/SeenPlugin/src/main.cpp +++ b/plugins/SeenPlugin/src/main.cpp @@ -45,8 +45,8 @@ PLUGININFOEX pluginInfo={ #define TRANSNUMBER 2 DBVTranslation idleTr[TRANSNUMBER]={ - {(TranslateFunc*)any_to_IdleNotidleUnknown, _T("Any to Idle/Not Idle/Unknown"),0}, - {(TranslateFunc*)any_to_Idle, _T("Any to /Idle or empty"),0} + {any_to_IdleNotidleUnknown, _T("Any to Idle/Not Idle/Unknown"),0}, + {any_to_Idle, _T("Any to /Idle or empty"),0} }; BOOL includeIdle; @@ -77,10 +77,10 @@ int MainInit(WPARAM wparam,LPARAM lparam) ehdb = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, UpdateValues); ehproto = HookEvent(ME_PROTO_ACK,ModeChange); - SkinAddNewSoundEx("LastSeenTrackedStatusChange", LPGEN("LastSeen"), LPGEN("User status change")); - SkinAddNewSoundEx("LastSeenTrackedStatusOnline", LPGEN("LastSeen"), LPGEN("Changed to Online")); - SkinAddNewSoundEx("LastSeenTrackedStatusOffline", LPGEN("LastSeen"), LPGEN("User Logged Off")); - SkinAddNewSoundEx("LastSeenTrackedStatusFromOffline", LPGEN("LastSeen"), LPGEN("User Logged In")); + SkinAddNewSoundExT("LastSeenTrackedStatusChange", LPGENT("LastSeen"), LPGENT("User status change")); + SkinAddNewSoundExT("LastSeenTrackedStatusOnline", LPGENT("LastSeen"), LPGENT("Changed to Online")); + SkinAddNewSoundExT("LastSeenTrackedStatusOffline", LPGENT("LastSeen"), LPGENT("User Logged Off")); + SkinAddNewSoundExT("LastSeenTrackedStatusFromOffline", LPGENT("LastSeen"), LPGENT("User Logged In")); // known modules list if (ServiceExists("DBEditorpp/RegisterSingleModule")) diff --git a/plugins/SeenPlugin/src/menu.cpp b/plugins/SeenPlugin/src/menu.cpp index 9d7f4c49ef..e0c48146a8 100644 --- a/plugins/SeenPlugin/src/menu.cpp +++ b/plugins/SeenPlugin/src/menu.cpp @@ -80,7 +80,8 @@ void InitMenuitem() CLISTMENUITEM cmi = { sizeof(cmi) }; cmi.position = -0x7FFFFFFF; - cmi.pszName = ""; + cmi.flags = CMIF_TCHAR; + cmi.ptszName = LPGENT(""); cmi.pszService = "LastSeenUserDetails"; hmenuitem = Menu_AddContactMenuItem(&cmi); diff --git a/plugins/SeenPlugin/src/options.cpp b/plugins/SeenPlugin/src/options.cpp index b2d42e98eb..4085de3708 100644 --- a/plugins/SeenPlugin/src/options.cpp +++ b/plugins/SeenPlugin/src/options.cpp @@ -465,17 +465,17 @@ int OptionsInit(WPARAM wparam,LPARAM lparam) OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 100000000; odp.hInstance = hInstance; - odp.flags = ODPF_BOLDGROUPS; + odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR; odp.pszTemplate = MAKEINTRESOURCEA(IDD_SETTINGS); - odp.pszGroup = LPGEN("Services"); - odp.pszTitle = LPGEN("Last seen"); + odp.ptszGroup = LPGENT("Services"); + odp.ptszTitle = LPGENT("Last seen"); odp.pfnDlgProc = OptsSettingsDlgProc; Options_AddPage(wparam,&odp); - if ( ServiceExists(MS_POPUP_ADDPOPUP)) { + if ( ServiceExists(MS_POPUP_ADDPOPUPT)) { odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPS); - odp.pszGroup = LPGEN("PopUps"); - odp.pszTitle = LPGEN("Last seen"); + odp.ptszGroup = LPGENT("PopUps"); + odp.ptszTitle = LPGENT("Last seen"); odp.pfnDlgProc = OptsPopUpsDlgProc; Options_AddPage(wparam,&odp); } diff --git a/plugins/SeenPlugin/src/userinfo.cpp b/plugins/SeenPlugin/src/userinfo.cpp index a40d83f043..ab9ad36840 100644 --- a/plugins/SeenPlugin/src/userinfo.cpp +++ b/plugins/SeenPlugin/src/userinfo.cpp @@ -82,7 +82,8 @@ int UserinfoInit(WPARAM wparam,LPARAM lparam) OPTIONSDIALOGPAGE uip = { sizeof(uip) }; uip.hInstance = hInstance; uip.pszTemplate = MAKEINTRESOURCEA(IDD_USERINFO); - uip.pszTitle = "Last seen"; + uip.flags = ODPF_TCHAR; + uip.ptszTitle = LPGENT("Last seen"); uip.pfnDlgProc = UserinfoDlgProc; UserInfo_AddPage(wparam, &uip); } diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index 5d90145f92..2aa11670d9 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -370,7 +370,7 @@ LBL_charPtr: goto LBL_charPtr; case 'P': - _tcscpy(szdbsetting, _A2T(ci.szProto ? ci.szProto : (wantempty ? "" : "ProtoUnknown"))); + _tcscpy(szdbsetting, ci.szProto ? _A2T(ci.szProto) : (wantempty ? _T("") : _T("ProtoUnknown"))); goto LBL_charPtr; case 'b': @@ -378,33 +378,11 @@ LBL_charPtr: goto LBL_charPtr; case 'C': // Get Client Info - if (isMSN(ci.szProto)) { - if (hcontact) { - dwsetting = (int)db_get_dw(hcontact,ci.szProto,"FlagBits",0); - wsprintf(szdbsetting, _T("MSNC%i"), (dwsetting&0x70000000)>>28); - if (dwsetting & 0x00000001) _tcscat(szdbsetting, _T(" MobD")); //Mobile Device - if (dwsetting & 0x00000004) _tcscat(szdbsetting, _T(" InkG")); //GIF Ink Send/Receive - if (dwsetting & 0x00000008) _tcscat(szdbsetting, _T(" InkI")); //ISF Ink Send/Receive - if (dwsetting & 0x00000010) _tcscat(szdbsetting, _T(" WCam")); //Webcam - if (dwsetting & 0x00000020) _tcscat(szdbsetting, _T(" MPkt")); //Multi packet messages - if (dwsetting & 0x00000040) _tcscat(szdbsetting, _T(" SMSr")); //Paging - if (dwsetting & 0x00000080) _tcscat(szdbsetting, _T(" DSMS")); //Using MSN Direct - if (dwsetting & 0x00000200) _tcscat(szdbsetting, _T(" WebM")); //WebMessenger - if (dwsetting & 0x00001000) _tcscat(szdbsetting, _T(" MS7+")); //Unknown (Msgr 7 always[?] sets it) - if (dwsetting & 0x00004000) _tcscat(szdbsetting, _T(" DirM")); //DirectIM - if (dwsetting & 0x00008000) _tcscat(szdbsetting, _T(" Wink")); //Send/Receive Winks - if (dwsetting & 0x00010000) _tcscat(szdbsetting, _T(" MSrc")); //MSN Search ?? - if (dwsetting & 0x00040000) _tcscat(szdbsetting, _T(" VoiC")); //Voice Clips - } - else _tcscpy(szdbsetting, _T("Miranda")); - } - else { - if ( !DBGetContactSettingTString(hcontact, ci.szProto, "MirVer", &dbv)) { - _tcscpy(szdbsetting, dbv.ptszVal); - db_free(&dbv); - } - else goto LBL_noData; + if ( !DBGetContactSettingTString(hcontact, ci.szProto, "MirVer", &dbv)) { + _tcscpy(szdbsetting, dbv.ptszVal); + db_free(&dbv); } + else goto LBL_noData; charPtr = szdbsetting; goto LBL_charPtr; @@ -534,8 +512,8 @@ void ShowPopup(HANDLE hcontact, const char * lpzProto, int newStatus) db_free(&dbv); } else _tcsncpy(ppd.lptzText, ParseString(DEFAULT_POPUPSTAMPTEXT, hcontact, 0), MAX_SECONDLINE); - ppd.PluginWindowProc = (WNDPROC)PopupDlgProc; - CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)&ppd, 0); + ppd.PluginWindowProc = PopupDlgProc; + PUAddPopUpT(&ppd); } void myPlaySound(HANDLE hcontact, WORD newStatus, WORD oldStatus){ @@ -744,10 +722,7 @@ static DWORD __stdcall cleanThread(logthread_info* infoParam) int ModeChange(WPARAM wparam,LPARAM lparam) { - ACKDATA *ack; - WORD isetting=0; - - ack=(ACKDATA *)lparam; + ACKDATA *ack=(ACKDATA *)lparam; if (ack->type!=ACKTYPE_STATUS || ack->result!=ACKRESULT_SUCCESS || ack->hContact!=NULL) return 0; courProtoName = (char *)ack->szModule; @@ -760,14 +735,13 @@ int ModeChange(WPARAM wparam,LPARAM lparam) DBWriteTimeTS(time(NULL),NULL); // isetting=CallProtoService(ack->szModule,PS_GETSTATUS,0,0); - isetting=(WORD)ack->lParam; + WORD isetting=(WORD)ack->lParam; if (isettingID_STATUS_OFFLINE)&&((WORD)ack->hProcess<=ID_STATUS_OFFLINE)) { //we have just loged-in db_set_dw(NULL, "UserOnline", ack->szModule, GetTickCount()); if (IsWatchedProtocol(ack->szModule)) { - logthread_info *info; - info = (logthread_info *)malloc(sizeof(logthread_info)); + logthread_info *info = (logthread_info *)malloc(sizeof(logthread_info)); strncpy(info->sProtoName,courProtoName,MAXMODULELABELLENGTH); info->hContact = 0; info->courStatus = 0; @@ -818,21 +792,21 @@ short int isDbZero(HANDLE hContact, const char *module_name, const char *setting return -1; } -WCHAR *any_to_IdleNotidleUnknown(HANDLE hContact, const char *module_name, const char *setting_name, WCHAR *buff, int bufflen) { +TCHAR *any_to_IdleNotidleUnknown(HANDLE hContact, const char *module_name, const char *setting_name, TCHAR *buff, int bufflen) { short int r = isDbZero(hContact, module_name, setting_name); if (r==-1){ - wcsncpy(buff, TranslateW(L"Unknown"), bufflen); + _tcsncpy(buff, TranslateT("Unknown"), bufflen); } else { - wcsncpy(buff, TranslateW(r?L"Not Idle":L"Idle"), bufflen); + _tcsncpy(buff, r ? TranslateT("Not Idle") : TranslateT("Idle"), bufflen); }; buff[bufflen - 1] = 0; return buff; } -WCHAR *any_to_Idle(HANDLE hContact, const char *module_name, const char *setting_name, WCHAR *buff, int bufflen) { +TCHAR *any_to_Idle(HANDLE hContact, const char *module_name, const char *setting_name, TCHAR *buff, int bufflen) { if (isDbZero(hContact, module_name, setting_name)==0) { //DB setting is NOT zero and exists buff[0] = L'/'; - wcsncpy((WCHAR *)&buff[1], TranslateW(L"Idle"), bufflen-1); + _tcsncpy(&buff[1], TranslateT("Idle"), bufflen-1); } else buff[0] = 0; buff[bufflen - 1] = 0; return buff; -- cgit v1.2.3