From b665a90f50f09435aef5bc3b5b9da710e4558690 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 5 Apr 2013 16:54:27 +0000 Subject: various menu items quirks, simplifications & optimization git-svn-id: http://svn.miranda-ng.org/main/trunk@4319 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AVS/src/main.cpp | 16 +- plugins/AuthState/src/main.cpp | 47 +-- plugins/BuddyExpectator/src/BuddyExpectator.cpp | 11 +- plugins/FloatingContacts/src/main.cpp | 4 +- plugins/MirOTR/MirOTR/src/dllmain.cpp | 2 +- plugins/MirOTR/MirOTR/src/mirotrmenu.cpp | 4 +- plugins/MirOTR/MirOTR/src/utils.cpp | 4 +- plugins/Scriver/src/chat/clist.cpp | 221 ++++++----- plugins/Scriver/src/chat/log.cpp | 16 +- plugins/Scriver/src/chat/main.cpp | 2 +- plugins/Scriver/src/chat/manager.cpp | 6 +- plugins/Scriver/src/chat/options.cpp | 34 +- plugins/Scriver/src/chat/services.cpp | 16 +- plugins/Scriver/src/chat/tools.cpp | 4 +- plugins/Scriver/src/chat/window.cpp | 62 ++-- plugins/Scriver/src/globals.cpp | 2 +- plugins/Scriver/src/infobar.cpp | 4 +- plugins/Scriver/src/input.cpp | 6 +- plugins/Scriver/src/msgdialog.cpp | 82 ++-- plugins/Scriver/src/msglog.cpp | 24 +- plugins/Scriver/src/msgoptions.cpp | 20 +- plugins/Scriver/src/msgs.cpp | 474 +++++++++++------------- plugins/Scriver/src/msgtimedout.cpp | 4 +- plugins/Scriver/src/msgwindow.cpp | 36 +- plugins/Scriver/src/sendqueue.cpp | 2 +- plugins/Scriver/src/utils.cpp | 14 +- plugins/StatusPlugins/commonstatus.cpp | 2 +- plugins/TabSRMM/src/chat/clist.cpp | 46 ++- plugins/TabSRMM/src/chat/services.cpp | 7 +- plugins/TabSRMM/src/chat/window.cpp | 2 +- plugins/TabSRMM/src/commonheaders.h | 2 +- plugins/TabSRMM/src/contactcache.cpp | 14 +- plugins/TabSRMM/src/container.cpp | 2 +- plugins/TabSRMM/src/eventpopups.cpp | 2 +- plugins/TabSRMM/src/generic_msghandlers.cpp | 6 +- plugins/TabSRMM/src/globals.cpp | 2 +- plugins/TabSRMM/src/globals.h | 2 +- plugins/TabSRMM/src/mim.cpp | 25 +- plugins/TabSRMM/src/msgdialog.cpp | 4 +- plugins/TabSRMM/src/msgdlgutils.cpp | 8 +- plugins/TabSRMM/src/msglog.cpp | 2 +- plugins/TabSRMM/src/msgoptions.cpp | 12 +- plugins/TabSRMM/src/trayicon.cpp | 2 +- plugins/TopToolBar/src/toolbar.cpp | 4 +- plugins/XSoundNotify/src/Common.h | 10 +- 45 files changed, 602 insertions(+), 669 deletions(-) (limited to 'plugins') diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index 53447baaf3..beff99167f 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -1886,13 +1886,13 @@ static void LoadDefaultInfo() { protoPicCacheEntry* pce = new protoPicCacheEntry; if (CreateAvatarInCache(0, pce, AVS_DEFAULT) != 1) - db_unset(0, PPICT_MODULE, AVS_DEFAULT); - - pce->szProtoname = mir_strdup(AVS_DEFAULT); - pce->tszAccName = mir_tstrdup(TranslateT("Global avatar")); - g_ProtoPictures.insert(pce); -} - + db_unset(0, PPICT_MODULE, AVS_DEFAULT); + + pce->szProtoname = mir_strdup(AVS_DEFAULT); + pce->tszAccName = mir_tstrdup(TranslateT("Global avatar")); + g_ProtoPictures.insert(pce); +} + static void LoadProtoInfo(PROTOCOLDESCRIPTOR* proto) { if ( proto->type == PROTOTYPE_PROTOCOL && proto->cbSize == sizeof( *proto )) @@ -1987,7 +1987,7 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) LoadDefaultInfo(); PROTOCOLDESCRIPTOR** proto; int protoCount; - CallService(MS_PROTO_ENUMPROTOS, ( WPARAM )&protoCount, ( LPARAM )&proto); + CallService(MS_PROTO_ENUMPROTOS, (WPARAM)&protoCount, (LPARAM)&proto); for (i=0; i < protoCount; i++ ) LoadProtoInfo( proto[i] ); for (i=0; i < accCount; i++) diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp index dc7c23cadd..6627dd9219 100644 --- a/plugins/AuthState/src/main.cpp +++ b/plugins/AuthState/src/main.cpp @@ -22,7 +22,8 @@ HINSTANCE g_hInst; static HANDLE hOptInitialise; static HANDLE hHookExtraIconsRebuild, hHookExtraIconsApply; -static HANDLE hAuthMenuSelected, hUserMenu; +static HANDLE hAuthMenuSelected; +static HGENMENU hUserMenu; HANDLE hExtraIcon; int hLangpack; @@ -64,22 +65,22 @@ INT_PTR getIconToUse(HANDLE hContact, LPARAM lParam) { char *proto = GetContactProto(hContact); // if (lParam == 1) return icon_none; - if (!DBGetContactSettingByte(hContact,"AuthState","ShowIcons",!bIconsForRecentContacts)) return icon_none; + if (!db_get_b(hContact,"AuthState","ShowIcons",!bIconsForRecentContacts)) return icon_none; - if (DBGetContactSettingByte(0,"ICQ","UseServerCList",0)) - if (DBGetContactSettingWord(hContact,proto,"ServerId",1) == 0) + if (db_get_b(0,"ICQ","UseServerCList",0)) + if (db_get_dw(hContact,proto,"ServerId",1) == 0) return icon_both; if (bUseAuthIcon & bUseGrantIcon) - if (DBGetContactSettingByte(hContact,proto,"Auth",0) && DBGetContactSettingByte(hContact,proto,"Grant",0)) + if (db_get_b(hContact,proto,"Auth",0) && db_get_b(hContact,proto,"Grant",0)) return icon_both; if (bUseAuthIcon) - if (DBGetContactSettingByte(hContact,proto,"Auth",0)) + if (db_get_b(hContact,proto,"Auth",0)) return icon_auth; if (bUseGrantIcon) - if (DBGetContactSettingByte(hContact,proto,"Grant",0)) + if (db_get_b(hContact,proto,"Grant",0)) return icon_grant; return icon_none; } @@ -126,7 +127,7 @@ int onDBContactAdded(WPARAM wParam, LPARAM lParam) INT_PTR onAuthMenuSelected(WPARAM wParam, LPARAM lParam) { - byte enabled = DBGetContactSettingByte((HANDLE)wParam,"AuthState","ShowIcons",1); + byte enabled = db_get_b((HANDLE)wParam,"AuthState","ShowIcons",1); DBWriteContactSettingByte((HANDLE)wParam, MODULENAME, "ShowIcons", !enabled); onExtraImageApplying(wParam, 0); @@ -135,30 +136,20 @@ INT_PTR onAuthMenuSelected(WPARAM wParam, LPARAM lParam) int onPrebuildContactMenu(WPARAM wParam, LPARAM lParam) { - char *proto = GetContactProto((HANDLE)wParam); + HANDLE hContact = (HANDLE)wParam; + char *proto = GetContactProto(hContact); if (!proto) return 0; CLISTMENUITEM mi = { sizeof(mi) }; - - if (!DBGetContactSettingByte((HANDLE)wParam,proto,"Auth",0) && !DBGetContactSettingByte((HANDLE)wParam,proto,"Grant",0) && DBGetContactSettingWord((HANDLE)wParam,proto,"ServerId",0)) - mi.flags = CMIF_TCHAR | CMIM_FLAGS | CMIF_HIDDEN; - else - mi.flags = CMIF_TCHAR | CMIM_FLAGS; - - if (DBGetContactSettingByte((HANDLE)wParam,"AuthState","ShowIcons",1)) - { - mi.flags |= CMIF_TCHAR | CMIM_NAME; + mi.flags = CMIF_TCHAR | CMIM_NAME; + if (db_get_b(hContact,"AuthState","ShowIcons",1)) mi.ptszName = LPGENT("Disable AuthState icons"); - } else - { - mi.flags |= CMIF_TCHAR | CMIM_NAME; mi.ptszName = LPGENT("Enable AuthState icons"); - } - - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hUserMenu, (LPARAM)&mi); + Menu_ModifyItem(hUserMenu, &mi); + Menu_ShowItem(hUserMenu, db_get_b(hContact,proto,"Auth",0) || db_get_b(hContact,proto,"Grant",0) || !db_get_dw(hContact,proto,"ServerId",0)); return 0; } @@ -205,10 +196,10 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_SYSTEM_OKTOEXIT,onSystemOKToExit); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged); - bUseAuthIcon = DBGetContactSettingByte(NULL, MODULENAME, "EnableAuthIcon", 1); - bUseGrantIcon = DBGetContactSettingByte(NULL, MODULENAME, "EnableGrantIcon", 1); - bContactMenuItem = DBGetContactSettingByte(NULL, MODULENAME, "MenuItem", 0); - bIconsForRecentContacts = DBGetContactSettingByte(NULL, MODULENAME, "EnableOnlyForRecent", 0); + bUseAuthIcon = db_get_b(NULL, MODULENAME, "EnableAuthIcon", 1); + bUseGrantIcon = db_get_b(NULL, MODULENAME, "EnableGrantIcon", 1); + bContactMenuItem = db_get_b(NULL, MODULENAME, "MenuItem", 0); + bIconsForRecentContacts = db_get_b(NULL, MODULENAME, "EnableOnlyForRecent", 0); HookEvent(ME_DB_CONTACT_ADDED, onDBContactAdded); diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index bdaff06159..d3a55b4afa 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -27,7 +27,7 @@ int hLangpack; DWORD timer_id = 0; HANDLE hContactReturnedAction, hContactStillAbsentAction, hMissYouAction, hMenuMissYouClick; -HANDLE hContactMenu; +HGENMENU hContactMenu; HICON hIcon; HANDLE hExtraIcon; @@ -453,20 +453,17 @@ int onPrebuildContactMenu(WPARAM wParam, LPARAM lParam) else mi.flags = CMIM_FLAGS; - if (db_get_b((HANDLE)wParam, MODULE_NAME, "MissYou", 0)) - { + if (db_get_b((HANDLE)wParam, MODULE_NAME, "MissYou", 0)) { mi.flags |= CMIM_ICON | CMIM_NAME | CMIF_ICONFROMICOLIB | CMIF_TCHAR; mi.ptszName = LPGENT("Disable Miss You"); mi.icolibItem = iconList[1].hIcolib; } - else - { + else { mi.flags |= CMIM_ICON | CMIM_NAME | CMIF_ICONFROMICOLIB | CMIF_TCHAR; mi.ptszName = LPGENT("Enable Miss You"); mi.icolibItem = iconList[2].hIcolib; } - - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenu, (LPARAM)&mi); + Menu_ModifyItem(hContactMenu, &mi); return 0; } diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 72435a07ef..ba94e8fd69 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -806,7 +806,7 @@ static INT_PTR OnMainMenu_HideAll( WPARAM wParam, LPARAM lParam ) clmi.flags = CMIM_NAME | CMIM_ICON|CMIF_TCHAR; clmi.hIcon = LoadIcon( hInst, MAKEINTRESOURCE( fcOpt.bHideAll ? IDI_SHOW : IDI_HIDE )); clmi.ptszName = fcOpt.bHideAll ? LPGENT("Show all thumbs") : LPGENT("Hide all thumbs"); - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMainMenuItemHideAll, ( LPARAM )&clmi ); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMainMenuItemHideAll, (LPARAM)&clmi); return 0; } @@ -879,7 +879,7 @@ static void LoadContact( HANDLE hContact ) DWORD dwPos = db_get_dw( hContact, MODULE, "ThumbsPos", (DWORD)-1 ); if ( dwPos != -1 ) { - TCHAR *ptName = (TCHAR*)CallService( MS_CLIST_GETCONTACTDISPLAYNAME, ( WPARAM )hContact, (LPARAM)GCDNF_TCHAR ); + TCHAR *ptName = (TCHAR*)CallService( MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, (LPARAM)GCDNF_TCHAR ); if ( ptName != NULL ) { int nX = DB_POS_GETX( dwPos ); int nY = DB_POS_GETY( dwPos ); diff --git a/plugins/MirOTR/MirOTR/src/dllmain.cpp b/plugins/MirOTR/MirOTR/src/dllmain.cpp index aae5c5649c..ee1198e2bf 100644 --- a/plugins/MirOTR/MirOTR/src/dllmain.cpp +++ b/plugins/MirOTR/MirOTR/src/dllmain.cpp @@ -104,7 +104,7 @@ extern "C" __declspec(dllexport) int Load(void) if(DBGetContactSettingByte(0, MODULENAME, "FilterOrderFix", 0) != 2) { HANDLE hContact = db_find_first(); while ( hContact != NULL ) { - CallService( MS_PROTO_REMOVEFROMCONTACT, ( WPARAM )hContact, ( LPARAM )MODULENAME ); + CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)hContact, (LPARAM)MODULENAME); hContact = db_find_next(hContact); } DBWriteContactSettingByte(0, MODULENAME, "FilterOrderFix", 2); diff --git a/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp index de6b27dc30..03d5f70a39 100644 --- a/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp +++ b/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp @@ -97,7 +97,7 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam,LPARAM) TrustLevel level = ( TrustLevel )otr_context_get_trust(otrl_context_find_miranda(otr_user_state, hContact)); mi.cbSize = sizeof(mi); - if ( CallService(MO_GETMENUITEM, ( WPARAM )pcpp->MenuItemHandle, ( LPARAM )&mi ) == 0 ) { + if ( CallService(MO_GETMENUITEM, (WPARAM)pcpp->MenuItemHandle, (LPARAM)&mi) == 0) { if ( mi.flags & CMIF_HIDDEN ) return FALSE; if ( mi.flags & CMIF_NOTPRIVATE && level==TRUST_PRIVATE ) return FALSE; @@ -154,7 +154,7 @@ INT_PTR OnAddMenuItemMirOTRMenu (WPARAM wParam, LPARAM lParam) TMO_MenuItem mi; mi.cbSize = sizeof(mi); - if ( CallService(MO_GETMENUITEM, ( WPARAM )lParam, ( LPARAM )&mi ) == 0 ) { + if ( CallService(MO_GETMENUITEM, (WPARAM)lParam, (LPARAM)&mi) == 0) { if (mi.flags & CMIF_DISABLED) { mii->fMask |= MIIM_STATE; mii->fState |= MF_DISABLED; diff --git a/plugins/MirOTR/MirOTR/src/utils.cpp b/plugins/MirOTR/MirOTR/src/utils.cpp index fcd18ba98e..7877065ccc 100644 --- a/plugins/MirOTR/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/MirOTR/src/utils.cpp @@ -132,14 +132,14 @@ char* contact_get_id(HANDLE hContact, bool bNameOnError) { } } if (!pszUniqueID && bNameOnError) { - char *name = (char *)CallService( MS_CLIST_GETCONTACTDISPLAYNAME, ( WPARAM )hContact, 0 ); + char *name = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0); if (name) pszUniqueID = mir_strdup(name); } return pszUniqueID; } __inline const TCHAR* contact_get_nameT(HANDLE hContact) { - return (TCHAR*)CallService( MS_CLIST_GETCONTACTDISPLAYNAME, ( WPARAM )hContact, GCDNF_TCHAR ); + return (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR); } __inline const char* contact_get_proto(HANDLE hContact) { diff --git a/plugins/Scriver/src/chat/clist.cpp b/plugins/Scriver/src/chat/clist.cpp index 9ce653839e..697d46c94d 100644 --- a/plugins/Scriver/src/chat/clist.cpp +++ b/plugins/Scriver/src/chat/clist.cpp @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../commonheaders.h" -extern HANDLE hJoinMenuItem, hLeaveMenuItem; +extern HGENMENU hJoinMenuItem, hLeaveMenuItem; HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* pszDisplayName, int iType) { @@ -30,58 +30,57 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p TCHAR pszGroup[50]; *pszGroup = '\0'; - if ( !DBGetContactSettingTString( NULL, "Chat", "AddToGroup", &dbv )) { - if ( lstrlen( dbv.ptszVal ) > 0 ) + if ( !DBGetContactSettingTString(NULL, "Chat", "AddToGroup", &dbv)) { + if ( lstrlen(dbv.ptszVal) > 0 ) lstrcpyn( pszGroup, dbv.ptszVal, 50); - DBFreeVariant(&dbv); + db_free(&dbv); } else lstrcpyn( pszGroup, _T("Chat rooms"), 50); - if ( pszGroup[0] ) + if (pszGroup[0]) CList_CreateGroup(pszGroup); - if ( hContact ) { //contact exist, make sure it is in the right group - DBVARIANT dbv; - DBVARIANT dbv2; - char str[50]; - int i; - - if ( pszGroup[0] ) { - for (i = 0;; i++) { + if (hContact) { //contact exist, make sure it is in the right group + if (pszGroup[0]) { + for (int i = 0;; i++) { + char str[50]; _itoa(i, str, 10); - if ( DBGetContactSettingTString( NULL, "CListGroups", str, &dbv )) { - DBWriteContactSettingTString(hContact, "CList", "Group", pszGroup); + + DBVARIANT dbv, dbv2; + if (DBGetContactSettingTString( NULL, "CListGroups", str, &dbv)) { + db_set_ts(hContact, "CList", "Group", pszGroup); goto END_GROUPLOOP; } if ( !DBGetContactSettingTString( hContact, "CList", "Group", &dbv2 )) { if ( dbv.ptszVal[0] != '\0' && dbv2.ptszVal[0] != '\0' && !lstrcmpi( dbv.ptszVal + 1, dbv2.ptszVal )) { - DBFreeVariant(&dbv); - DBFreeVariant(&dbv2); - goto END_GROUPLOOP; - } - DBFreeVariant(&dbv2); + db_free(&dbv); + db_free(&dbv2); + goto END_GROUPLOOP; } - DBFreeVariant(&dbv); - } } + db_free(&dbv2); + } + db_free(&dbv); + } + } END_GROUPLOOP: db_set_w(hContact, pszModule, "Status", ID_STATUS_OFFLINE); - DBWriteContactSettingTString(hContact, pszModule, "Nick", pszDisplayName ); + db_set_ts(hContact, pszModule, "Nick", pszDisplayName ); return hContact; } // here we create a new one since no one is to be found - if (( hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0)) == NULL ) + if ((hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0)) == NULL) return NULL; - CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) pszModule); + CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM)pszModule); if ( lstrlen( pszGroup ) > 0 ) - DBWriteContactSettingTString(hContact, "CList", "Group", pszGroup ); + db_set_ts(hContact, "CList", "Group", pszGroup); else - DBDeleteContactSetting(hContact, "CList", "Group"); - DBWriteContactSettingTString( hContact, pszModule, "Nick", pszDisplayName ); - DBWriteContactSettingTString( hContact, pszModule, "ChatRoomID", pszRoom ); + db_unset(hContact, "CList", "Group"); + db_set_ts( hContact, pszModule, "Nick", pszDisplayName); + db_set_ts( hContact, pszModule, "ChatRoomID", pszRoom); db_set_b(hContact, pszModule, "ChatRoom", (BYTE)iType); db_set_w(hContact, pszModule, "Status", ID_STATUS_OFFLINE); return hContact; @@ -89,9 +88,9 @@ END_GROUPLOOP: BOOL CList_SetOffline(HANDLE hContact, BOOL bHide) { - if ( hContact ) { - char * szProto = GetContactProto(hContact); - db_set_w(hContact, szProto,"ApparentMode",(LPARAM) 0); + if (hContact) { + char *szProto = GetContactProto(hContact); + db_set_w(hContact, szProto,"ApparentMode",(LPARAM)0); db_set_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); return TRUE; } @@ -101,27 +100,25 @@ BOOL CList_SetOffline(HANDLE hContact, BOOL bHide) BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule) { - HANDLE hContact = db_find_first(); - while ( hContact ) { + for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *szProto = GetContactProto(hContact); - if ( MM_FindModule( szProto )) { + if ( MM_FindModule(szProto)) { if (!pszModule || (pszModule && !strcmp(pszModule, szProto))) { int i = db_get_b(hContact, szProto, "ChatRoom", 0); - if ( i != 0 ) { - db_set_w(hContact, szProto,"ApparentMode",(LPARAM)(WORD) 0); + if (i != 0) { + db_set_w(hContact, szProto, "ApparentMode", 0); db_set_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); } } } - hContact = db_find_next(hContact); } return TRUE; } -int CList_RoomDoubleclicked(WPARAM wParam,LPARAM lParam) +int CList_RoomDoubleclicked(WPARAM wParam,LPARAM lParam) { - DBVARIANT dbv; - char *szProto; + DBVARIANT dbv; + char *szProto; HANDLE hContact = (HANDLE)wParam; if (!hContact) @@ -136,19 +133,18 @@ int CList_RoomDoubleclicked(WPARAM wParam,LPARAM lParam) SESSION_INFO* si = SM_FindSession( dbv.ptszVal, szProto ); if ( si ) { // is the "toggle visibility option set, so we need to close the window? - if (si->hWnd != NULL - && db_get_b(NULL, "Chat", "ToggleVisibility", 0)==1 - && !CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0) - && IsWindowVisible(si->hWnd) - && !IsIconic(si->hWnd)) - { + if (si->hWnd != NULL && + db_get_b(NULL, "Chat", "ToggleVisibility", 0) == 1 && + !CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0) && + IsWindowVisible(si->hWnd) && !IsIconic(si->hWnd)) + { PostMessage(si->hWnd, GC_CLOSEWINDOW, 0, 0); - DBFreeVariant(&dbv); + db_free(&dbv); return 1; } ShowRoom(si, WINDOW_VISIBLE, TRUE); } - DBFreeVariant(&dbv); + db_free(&dbv); return 1; } } @@ -157,7 +153,7 @@ int CList_RoomDoubleclicked(WPARAM wParam,LPARAM lParam) int CList_EventDoubleclicked(WPARAM wParam,LPARAM lParam) { - return CList_RoomDoubleclicked((WPARAM) ((CLISTEVENT*)lParam)->hContact,(LPARAM) 0); + return CList_RoomDoubleclicked((WPARAM) ((CLISTEVENT*)lParam)->hContact,(LPARAM)0); } INT_PTR CList_EventDoubleclickedSvc(WPARAM wParam,LPARAM lParam) @@ -168,15 +164,16 @@ INT_PTR CList_EventDoubleclickedSvc(WPARAM wParam,LPARAM lParam) INT_PTR CList_JoinChat(WPARAM wParam, LPARAM lParam) { HANDLE hContact = (HANDLE)wParam; - if ( hContact ) { - char* szProto = GetContactProto(hContact); - if ( szProto ) { - if ( DBGetContactSettingWord( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE ) - CallProtoService( szProto, PS_JOINCHAT, wParam, lParam ); - else - CList_RoomDoubleclicked( wParam, 0 ); - } } + if (hContact == NULL) + return 0; + char* szProto = GetContactProto(hContact); + if ( szProto ) { + if ( db_get_w( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE ) + CallProtoService( szProto, PS_JOINCHAT, wParam, lParam ); + else + CList_RoomDoubleclicked( wParam, 0 ); + } return 0; } @@ -194,31 +191,28 @@ INT_PTR CList_LeaveChat(WPARAM wParam, LPARAM lParam) int CList_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { HANDLE hContact = (HANDLE)wParam; - if ( hContact ) { - char* szProto = GetContactProto(hContact); - - CLISTMENUITEM clmi = { sizeof(clmi) }; - clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN; - - if ( szProto ) { - // display this menu item only for chats - if ( db_get_b( hContact, szProto, "ChatRoom", 0 )) { - // still hide it for offline protos - if ( CallProtoService( szProto, PS_GETSTATUS, 0, 0 ) != ID_STATUS_OFFLINE ) { - clmi.flags &= ~CMIF_HIDDEN; - clmi.flags |= CMIM_NAME; - - if ( DBGetContactSettingWord( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE ) - clmi.pszName = ( char* )LPGEN("Join chat"); - else - clmi.pszName = ( char* )LPGEN("Open chat window"); - } } } - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hJoinMenuItem, ( LPARAM )&clmi ); + if (hContact == NULL) + return 0; - clmi.flags &= ~(CMIM_NAME | CMIF_DEFAULT); - clmi.flags |= CMIF_NOTOFFLINE; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hLeaveMenuItem, ( LPARAM )&clmi ); - } + bool bEnabled = false; + char *szProto = GetContactProto(hContact); + if (szProto) { + // display this menu item only for chats + if (db_get_b(hContact, szProto, "ChatRoom", 0)) { + // still hide it for offline protos + if (CallProtoService(szProto, PS_GETSTATUS, 0, 0) != ID_STATUS_OFFLINE) { + CLISTMENUITEM clmi = { sizeof(clmi) }; + clmi.flags = CMIM_NAME; + if (db_get_w(hContact, szProto, "Status", 0) == ID_STATUS_OFFLINE) + clmi.pszName = (char*)LPGEN("Join chat"); + else + clmi.pszName = (char*)LPGEN("Open chat window"); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hJoinMenuItem, (LPARAM)&clmi); + bEnabled = true; + } } } + + Menu_ShowItem(hJoinMenuItem, bEnabled); + Menu_ShowItem(hLeaveMenuItem, bEnabled); return 0; } @@ -230,83 +224,78 @@ INT_PTR CList_PrebuildContactMenuSvc(WPARAM wParam, LPARAM lParam) void CList_CreateGroup(TCHAR* group) { int i; - char str[50]; + char str[50]; TCHAR name[256]; - DBVARIANT dbv; + DBVARIANT dbv; if (!group) return; - for (i = 0;; i++) - { - _itoa(i, str, 10); + for (i = 0;; i++) { + _itoa(i, str, 10); if ( DBGetContactSettingTString( NULL, "CListGroups", str, &dbv )) - break; + break; if ( dbv.pszVal[0] != '\0' && !lstrcmpi(dbv.ptszVal + 1, group)) { - DBFreeVariant(&dbv); - return; - } + db_free(&dbv); + return; + } - DBFreeVariant(&dbv); - } + db_free(&dbv); + } - // CallService(MS_CLIST_GROUPCREATE, (WPARAM)group, 0); + // CallService(MS_CLIST_GROUPCREATE, (WPARAM)group, 0); name[0] = 1 | GROUPF_EXPANDED; _tcsncpy(name + 1, group, SIZEOF(name) - 1); name[ lstrlen(group) + 1] = '\0'; - DBWriteContactSettingTString(NULL, "CListGroups", str, name); - CallService(MS_CLUI_GROUPADDED, i + 1, 0); + db_set_ts(NULL, "CListGroups", str, name); + CallService(MS_CLUI_GROUPADDED, i + 1, 0); } BOOL CList_AddEvent(HANDLE hContact, HICON Icon, HANDLE event, int type, TCHAR* fmt, ... ) { - CLISTEVENT cle; - va_list marker; - TCHAR* szBuf = (TCHAR*)alloca(4096 * sizeof(TCHAR)); - if (!fmt || lstrlen(fmt) < 1 || lstrlen(fmt) > 2000) return FALSE; + TCHAR* szBuf = (TCHAR*)alloca(4096 * sizeof(TCHAR)); + va_list marker; va_start(marker, fmt); _vsntprintf(szBuf, 4096, fmt, marker); va_end(marker); - cle.cbSize=sizeof(cle); - cle.hContact=(HANDLE)hContact; - cle.hDbEvent=(HANDLE)event; + CLISTEVENT cle = { sizeof(cle) }; + cle.hContact = (HANDLE)hContact; + cle.hDbEvent = (HANDLE)event; cle.flags = type | CLEF_TCHAR; - cle.hIcon=Icon; - cle.pszService= "GChat/DblClickEvent" ; + cle.hIcon = Icon; + cle.pszService = "GChat/DblClickEvent" ; cle.ptszTooltip = TranslateTS(szBuf); if ( type ) { if (!CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0)) - CallService(MS_CLIST_ADDEVENT,(WPARAM) hContact,(LPARAM) &cle); - } else { + CallService(MS_CLIST_ADDEVENT,(WPARAM) hContact,(LPARAM)&cle); + } + else { if (CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0)) CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM)event); - CallService(MS_CLIST_ADDEVENT,(WPARAM) hContact,(LPARAM) &cle); + CallService(MS_CLIST_ADDEVENT,(WPARAM) hContact,(LPARAM)&cle); } return TRUE; } HANDLE CList_FindRoom ( const char* pszModule, const TCHAR* pszRoom) { - HANDLE hContact = db_find_first(); - while (hContact) { + for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *szProto = GetContactProto(hContact); if (szProto && !lstrcmpiA(szProto, pszModule)) { - if ( db_get_b( hContact, szProto, "ChatRoom", 0) != 0 ) { + if ( db_get_b( hContact, szProto, "ChatRoom", 0) != 0) { DBVARIANT dbv; - if ( !DBGetContactSettingTString( hContact, szProto, "ChatRoomID", &dbv )) { + if ( !DBGetContactSettingTString( hContact, szProto, "ChatRoomID", &dbv)) { if ( !lstrcmpi(dbv.ptszVal, pszRoom)) { - DBFreeVariant(&dbv); + db_free(&dbv); return hContact; } - DBFreeVariant(&dbv); + db_free(&dbv); } } } - - hContact = db_find_next(hContact); } return 0; } diff --git a/plugins/Scriver/src/chat/log.cpp b/plugins/Scriver/src/chat/log.cpp index ad3b3092e6..ac05d01576 100644 --- a/plugins/Scriver/src/chat/log.cpp +++ b/plugins/Scriver/src/chat/log.cpp @@ -780,17 +780,17 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, BOOL bRedr scroll.cbSize= sizeof(SCROLLINFO); scroll.fMask= SIF_RANGE | SIF_POS|SIF_PAGE; GetScrollInfo(hwndRich, SB_VERT, &scroll); - SendMessage(hwndRich, EM_GETSCROLLPOS, 0, (LPARAM) &point); + SendMessage(hwndRich, EM_GETSCROLLPOS, 0, (LPARAM)&point); // do not scroll to bottom if there is a selection - SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM) &oldsel); + SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM)&oldsel); if (oldsel.cpMax != oldsel.cpMin) SendMessage(hwndRich, WM_SETREDRAW, FALSE, 0); //set the insertion point at the bottom sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich, CP_ACP, FALSE); - SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM) & sel); - SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM) & sel); + SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)& sel); + SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM)& sel); // fix for the indent... must be a M$ bug if (sel.cpMax == 0) @@ -810,7 +810,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, BOOL bRedr // stream in the event(s) streamData.lin = lin; streamData.bRedraw = bRedraw; - SendMessage(hwndRich, EM_STREAMIN, wp, (LPARAM) & stream); + SendMessage(hwndRich, EM_STREAMIN, wp, (LPARAM)& stream); // do smileys if (g_dat.smileyAddInstalled && (bRedraw @@ -843,12 +843,12 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, BOOL bRedr SendMessage(GetParent(hwndRich), GC_SCROLLTOBOTTOM, 0, 0); } else - SendMessage(hwndRich, EM_SETSCROLLPOS, 0, (LPARAM) &point); + SendMessage(hwndRich, EM_SETSCROLLPOS, 0, (LPARAM)&point); // do we need to restore the selection if (oldsel.cpMax != oldsel.cpMin) { - SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM) & oldsel); + SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)& oldsel); SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0); InvalidateRect(hwndRich, NULL, TRUE); } @@ -857,7 +857,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, BOOL bRedr if (bFlag) { sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich, CP_ACP, FALSE); - SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM) & sel); + SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)& sel); SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0); InvalidateRect(hwndRich, NULL, TRUE); } } } diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index 5009e3bdbc..56ca3965ef 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -25,7 +25,7 @@ void RegisterChatFonts( void ); //globals HMENU g_hMenu = NULL; -HANDLE hJoinMenuItem, hLeaveMenuItem; +HGENMENU hJoinMenuItem, hLeaveMenuItem; FONTINFO aFonts[OPTIONS_FONTCOUNT]; HBRUSH hListBkgBrush = NULL; diff --git a/plugins/Scriver/src/chat/manager.cpp b/plugins/Scriver/src/chat/manager.cpp index 28eb7e91ff..5d1ef90de1 100644 --- a/plugins/Scriver/src/chat/manager.cpp +++ b/plugins/Scriver/src/chat/manager.cpp @@ -121,7 +121,7 @@ int SM_RemoveSession(const TCHAR* pszID, const char* pszModule, BOOL removeConta } DBWriteContactSettingString(pTemp->windowData.hContact, pTemp->pszModule , "Topic", ""); DBWriteContactSettingString(pTemp->windowData.hContact, pTemp->pszModule, "StatusBar", ""); - DBDeleteContactSetting(pTemp->windowData.hContact, "CList", "StatusMsg"); + db_unset(pTemp->windowData.hContact, "CList", "StatusMsg"); if (removeContact) CallService(MS_DB_CONTACT_DELETE, (WPARAM)pTemp->windowData.hContact, 0); @@ -585,7 +585,7 @@ BOOL SM_SetStatus(const TCHAR* pszID, const char* pszModule, int wStatus) if ( pTemp->windowData.hContact ) { if ( pTemp->iType != GCW_SERVER && wStatus != ID_STATUS_OFFLINE ) - DBDeleteContactSetting(pTemp->windowData.hContact, "CList", "Hidden"); + db_unset(pTemp->windowData.hContact, "CList", "Hidden"); db_set_w(pTemp->windowData.hContact, pTemp->pszModule, "Status", (WORD)wStatus); } @@ -682,7 +682,7 @@ BOOL SM_RemoveAll (void) if (m_WndList->windowData.hContact) CList_SetOffline(m_WndList->windowData.hContact, m_WndList->iType == GCW_CHATROOM?TRUE:FALSE); DBWriteContactSettingString(m_WndList->windowData.hContact, m_WndList->pszModule , "Topic", ""); - DBDeleteContactSetting(m_WndList->windowData.hContact, "CList", "StatusMsg"); + db_unset(m_WndList->windowData.hContact, "CList", "StatusMsg"); DBWriteContactSettingString(m_WndList->windowData.hContact, m_WndList->pszModule, "StatusBar", ""); UM_RemoveAll(&m_WndList->pUsers); diff --git a/plugins/Scriver/src/chat/options.cpp b/plugins/Scriver/src/chat/options.cpp index 4a82d7da0d..e2826f56f1 100644 --- a/plugins/Scriver/src/chat/options.cpp +++ b/plugins/Scriver/src/chat/options.cpp @@ -236,7 +236,7 @@ static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault) DBVARIANT dbv; if ( !DBGetContactSettingTString(NULL, "Chat", pszSetting, &dbv )) { replaceStr( ppPointer, dbv.ptszVal ); - DBFreeVariant(&dbv); + db_free(&dbv); } else replaceStr( ppPointer, pszDefault ); } @@ -338,7 +338,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa if (iLen > 0) db_set_b(NULL, "Chat", "NicklistRowDist", (BYTE)iLen); else - DBDeleteContactSetting(NULL, "Chat", "NicklistRowDist"); + db_unset(NULL, "Chat", "NicklistRowDist"); SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch1, SIZEOF(branch1)); SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch4, SIZEOF(branch4)); @@ -371,9 +371,9 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa TranslateDialogDefault(hwndDlg); SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_CHECKBOXES),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_CHECKBOXES),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES); SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_SETRANGE,0,MAKELONG(5000,0)); - SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"Chat","LogLimit",100),0)); + SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"Chat","LogLimit",100),0)); SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN3,UDM_SETRANGE,0,MAKELONG(10000,0)); - SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN3,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"Chat","LoggingLimit",100),0)); + SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN3,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"Chat","LoggingLimit",100),0)); { TCHAR tszTemp[MAX_PATH]; PathToRelativeT(g_Settings.pszLogDir, tszTemp); @@ -546,23 +546,23 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa *p2 = ' '; p2 = _tcschr(ptszText, (TCHAR)','); } - DBWriteContactSettingTString(NULL, "Chat", "HighlightWords", ptszText); + db_set_ts(NULL, "Chat", "HighlightWords", ptszText); mir_free(ptszText); } } - else DBDeleteContactSetting(NULL, "Chat", "HighlightWords"); + else db_unset(NULL, "Chat", "HighlightWords"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOGDIRECTORY)); if ( iLen > 0 ) { TCHAR *pszText1 = (TCHAR *)malloc(iLen*sizeof(TCHAR) + 2); GetDlgItemText(hwndDlg, IDC_CHAT_LOGDIRECTORY, pszText1, iLen + 1); - DBWriteContactSettingTString(NULL, "Chat", "LogDirectory", pszText1); + db_set_ts(NULL, "Chat", "LogDirectory", pszText1); PathToAbsoluteT(pszText1, g_Settings.pszLogDir); free(pszText1); } else { lstrcpyn(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH); - DBDeleteContactSetting(NULL, "Chat", "LogDirectory"); + db_unset(NULL, "Chat", "LogDirectory"); } iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOGTIMESTAMP)); @@ -571,7 +571,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa GetDlgItemTextA(hwndDlg, IDC_CHAT_LOGTIMESTAMP, pszText,iLen+1); DBWriteContactSettingString(NULL, "Chat", "LogTimestamp", pszText); } - else DBDeleteContactSetting(NULL, "Chat", "LogTimestamp"); + else db_unset(NULL, "Chat", "LogTimestamp"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_TIMESTAMP)); if ( iLen > 0 ) { @@ -579,7 +579,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa GetDlgItemTextA(hwndDlg, IDC_CHAT_TIMESTAMP, pszText,iLen+1); DBWriteContactSettingString(NULL, "Chat", "HeaderTime", pszText); } - else DBDeleteContactSetting(NULL, "Chat", "HeaderTime"); + else db_unset(NULL, "Chat", "HeaderTime"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_INSTAMP)); if ( iLen > 0 ) { @@ -587,7 +587,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa GetDlgItemTextA(hwndDlg, IDC_CHAT_INSTAMP, pszText,iLen+1); DBWriteContactSettingString(NULL, "Chat", "HeaderIncoming", pszText); } - else DBDeleteContactSetting(NULL, "Chat", "HeaderIncoming"); + else db_unset(NULL, "Chat", "HeaderIncoming"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_OUTSTAMP)); if ( iLen > 0 ) { @@ -595,7 +595,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa GetDlgItemTextA(hwndDlg, IDC_CHAT_OUTSTAMP, pszText,iLen+1); DBWriteContactSettingString(NULL, "Chat", "HeaderOutgoing", pszText); } - else DBDeleteContactSetting(NULL, "Chat", "HeaderOutgoing"); + else db_unset(NULL, "Chat", "HeaderOutgoing"); g_Settings.HighlightEnabled = IsDlgButtonChecked(hwndDlg, IDC_CHAT_HIGHLIGHT) == BST_CHECKED?TRUE:FALSE; db_set_b(NULL, "Chat", "HighlightEnabled", (BYTE)g_Settings.HighlightEnabled); @@ -778,11 +778,11 @@ void LoadGlobalSettings(void) g_Settings.SoundsFocus = db_get_b(NULL, "Chat", "SoundsFocus", 0); g_Settings.ShowTimeIfChanged = (BOOL)db_get_b(NULL, "Chat", "ShowTimeStampIfChanged", 0); g_Settings.TimeStampEventColour = (BOOL)db_get_b(NULL, "Chat", "TimeStampEventColour", 0); - g_Settings.iEventLimit = DBGetContactSettingWord(NULL, "Chat", "LogLimit", 100); + g_Settings.iEventLimit = db_get_w(NULL, "Chat", "LogLimit", 100); g_Settings.dwIconFlags = DBGetContactSettingDword(NULL, "Chat", "IconFlags", 0x0000); g_Settings.dwTrayIconFlags = DBGetContactSettingDword(NULL, "Chat", "TrayIconFlags", 0x1000); g_Settings.dwPopupFlags = DBGetContactSettingDword(NULL, "Chat", "PopupFlags", 0x0000); - g_Settings.LoggingLimit = DBGetContactSettingWord(NULL, "Chat", "LoggingLimit", 100); + g_Settings.LoggingLimit = db_get_w(NULL, "Chat", "LoggingLimit", 100); g_Settings.LoggingEnabled = (BOOL)db_get_b(NULL, "Chat", "LoggingEnabled", 0); g_Settings.FlashWindow = (BOOL)db_get_b(NULL, "Chat", "FlashWindow", 0); g_Settings.HighlightEnabled = (BOOL)db_get_b(NULL, "Chat", "HighlightEnabled", 1); @@ -796,7 +796,7 @@ void LoadGlobalSettings(void) g_Settings.PopUpInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "PopUpInactiveOnly", 1); g_Settings.AddColonToAutoComplete = (BOOL)db_get_b(NULL, "Chat", "AddColonToAutoComplete", 1); g_Settings.iPopupStyle = db_get_b(NULL, "Chat", "PopupStyle", 1); - g_Settings.iPopupTimeout = DBGetContactSettingWord(NULL, "Chat", "PopupTimeout", 3); + g_Settings.iPopupTimeout = db_get_w(NULL, "Chat", "PopupTimeout", 3); g_Settings.crPUBkgColour = DBGetContactSettingDword(NULL, "Chat", "PopupColorBG", GetSysColor(COLOR_WINDOW)); g_Settings.crPUTextColour = DBGetContactSettingDword(NULL, "Chat", "PopupColorText", 0); g_Settings.ShowContactStatus = db_get_b(NULL, "Chat", "ShowContactStatus", 0); @@ -812,7 +812,7 @@ void LoadGlobalSettings(void) g_Settings.pszLogDir = (TCHAR *)mir_realloc(g_Settings.pszLogDir, MAX_PATH*sizeof(TCHAR)); if ( !DBGetContactSettingTString(NULL, "Chat", "LogDirectory", &dbv)) { lstrcpyn(g_Settings.pszLogDir, dbv.ptszVal, MAX_PATH); - DBFreeVariant(&dbv); + db_free(&dbv); } else lstrcpyn(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH); @@ -890,7 +890,7 @@ int OptionsInit(void) g_Settings.UserListFont = NULL; g_Settings.UserListHeadingsFont = NULL; g_Settings.MessageBoxFont = NULL; - g_Settings.iSplitterX = DBGetContactSettingWord(NULL, "Chat", "SplitterX", 105); + g_Settings.iSplitterX = db_get_w(NULL, "Chat", "SplitterX", 105); LoadGlobalSettings(); SkinAddNewSoundEx("ChatMessage", LPGEN("Group chats"), LPGEN("Incoming message")); diff --git a/plugins/Scriver/src/chat/services.cpp b/plugins/Scriver/src/chat/services.cpp index 6e798f364e..c9a578e76d 100644 --- a/plugins/Scriver/src/chat/services.cpp +++ b/plugins/Scriver/src/chat/services.cpp @@ -244,12 +244,12 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) else mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s"), si->ptszName); si->windowData.hContact = CList_AddRoom( gcw->pszModule, ptszID, szTemp, si->iType); - si->windowData.codePage = DBGetContactSettingWord(si->windowData.hContact, si->pszModule, "CodePage", (WORD) CP_ACP); + si->windowData.codePage = db_get_w(si->windowData.hContact, si->pszModule, "CodePage", (WORD) CP_ACP); si->pszHeader = Log_CreateRtfHeader(mi, si); DBWriteContactSettingString(si->windowData.hContact, si->pszModule , "Topic", ""); - DBDeleteContactSetting(si->windowData.hContact, "CList", "StatusMsg"); + db_unset(si->windowData.hContact, "CList", "StatusMsg"); if (si->ptszStatusbarText) - DBWriteContactSettingTString(si->windowData.hContact, si->pszModule, "StatusBar", si->ptszStatusbarText); + db_set_ts(si->windowData.hContact, si->pszModule, "StatusBar", si->ptszStatusbarText); else DBWriteContactSettingString(si->windowData.hContact, si->pszModule, "StatusBar", ""); } @@ -368,7 +368,7 @@ static INT_PTR DoControl(GCEVENT * gce, WPARAM wp) if (si) { replaceStr( &si->ptszStatusbarText, gce->ptszText ); if ( si->ptszStatusbarText ) - DBWriteContactSettingTString(si->windowData.hContact, si->pszModule, "StatusBar", si->ptszStatusbarText); + db_set_ts(si->windowData.hContact, si->pszModule, "StatusBar", si->ptszStatusbarText); else DBWriteContactSettingString(si->windowData.hContact, si->pszModule, "StatusBar", ""); if (si->hWnd) @@ -430,8 +430,8 @@ void ShowRoom(SESSION_INFO * si, WPARAM wp, BOOL bSetForeground) si->hWnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHANNEL), hParent, RoomWndProc, (LPARAM)si); } SendMessage(si->hWnd, DM_UPDATETABCONTROL, -1, (LPARAM)si); - SendMessage(GetParent(si->hWnd), CM_ACTIVATECHILD, 0, (LPARAM) si->hWnd); - SendMessage(GetParent(si->hWnd), CM_POPUPWINDOW, 0, (LPARAM) si->hWnd); + SendMessage(GetParent(si->hWnd), CM_ACTIVATECHILD, 0, (LPARAM)si->hWnd); + SendMessage(GetParent(si->hWnd), CM_POPUPWINDOW, 0, (LPARAM)si->hWnd); SendMessage(si->hWnd, WM_MOUSEACTIVATE, 0, 0); SetFocus(GetDlgItem(si->hWnd, IDC_CHAT_MESSAGE)); } @@ -505,9 +505,9 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) if ( si ) { if ( gce->pszText ) { replaceStr( &si->ptszTopic, gce->ptszText); - DBWriteContactSettingTString( si->windowData.hContact, si->pszModule , "Topic", RemoveFormatting( si->ptszTopic )); + db_set_ts( si->windowData.hContact, si->pszModule , "Topic", RemoveFormatting( si->ptszTopic )); if ( db_get_b( NULL, "Chat", "TopicOnClist", 0 )) - DBWriteContactSettingTString( si->windowData.hContact, "CList" , "StatusMsg", RemoveFormatting( si->ptszTopic )); + db_set_ts( si->windowData.hContact, "CList" , "StatusMsg", RemoveFormatting( si->ptszTopic )); } } break; } diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp index 5d528f75dc..f30fefb135 100644 --- a/plugins/Scriver/src/chat/tools.cpp +++ b/plugins/Scriver/src/chat/tools.cpp @@ -283,7 +283,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighligh if (bInactive && si->hWnd && db_get_b(NULL, "Chat", "FlashWindowHighlight", 0) != 0) SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0); if (db_get_b(si->windowData.hContact, "CList", "Hidden", 0) != 0) - DBDeleteContactSetting(si->windowData.hContact, "CList", "Hidden"); + db_unset(si->windowData.hContact, "CList", "Hidden"); if (bInactive) DoTrayIcon(si, gce); if (bInactive || !g_Settings.PopUpInactiveOnly) @@ -779,7 +779,7 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int gcd->iType = iType; gch->dwData = dwItem; gch->pDest = gcd; - PostMessage(hwnd, GC_FIREHOOK, 0, (LPARAM) gch); + PostMessage(hwnd, GC_FIREHOOK, 0, (LPARAM)gch); return TRUE; } diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index 406207adbb..fa803330ce 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -97,7 +97,7 @@ static void InitButtons(HWND hwndDlg, SESSION_INFO* si) SendDlgItemMessage(hwndDlg,IDC_CHAT_CHANMGR,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon("chat_settings")); SendDlgItemMessage(hwndDlg,IDC_CHAT_SHOWNICKLIST,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon(si->bNicklistEnabled?"chat_nicklist":"chat_nicklist2")); SendDlgItemMessage(hwndDlg,IDC_CHAT_FILTER,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon(si->bFilterEnabled?"chat_filter":"chat_filter2")); - SendDlgItemMessage(hwndDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM) GetCachedIcon("scriver_SEND")); + SendDlgItemMessage(hwndDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_SEND")); SendDlgItemMessage(hwndDlg,IDC_CHAT_SMILEY, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwndDlg,IDC_CHAT_BOLD, BUTTONSETASFLATBTN, TRUE, 0); @@ -349,7 +349,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (pszName == NULL) { if (end !=start) { SendMessage(hwnd, EM_SETSEL, start, end); - SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM) dat->szSearchQuery); + SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM)dat->szSearchQuery); } mir_free(dat->szSearchQuery); dat->szSearchQuery = NULL; @@ -363,7 +363,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, pszName = pszText; } SendMessage(hwnd, EM_SETSEL, start, end); - SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM) pszName); + SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM)pszName); } mir_free(pszText); } @@ -665,12 +665,12 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR { CHARRANGE sel; - SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) &sel); + SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel); if (sel.cpMin != sel.cpMax) { SendMessage(hwnd, WM_COPY, 0, 0); sel.cpMin = sel.cpMax ; - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & sel); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel); } SetFocus(GetDlgItem(GetParent(hwnd), IDC_CHAT_MESSAGE)); break; @@ -679,10 +679,10 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case WM_ACTIVATE: if (LOWORD(wParam) == WA_INACTIVE) { CHARRANGE sel; - SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) &sel); + SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel); if (sel.cpMin != sel.cpMax) { sel.cpMin = sel.cpMax ; - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & sel); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel); } } break; @@ -695,9 +695,9 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR TCHAR *pszWord = NULL; POINTL ptl; - SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) & sel); + SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)& sel); if (lParam == 0xFFFFFFFF) { - SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM) & pt, (LPARAM) sel.cpMax); + SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM) & pt, (LPARAM)sel.cpMax); ClientToScreen(hwnd, &pt); } else { pt.x = (short) LOWORD(lParam); @@ -716,10 +716,10 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break; case ID_COPYALL: - SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) & sel); - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & all); + SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)& sel); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& all); SendMessage(hwnd, WM_COPY, 0, 0); - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & sel); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel); PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0 ); break; @@ -825,7 +825,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESS } } - SendMessage( hwndToolTip, bNewTip ? TTM_ADDTOOL : TTM_UPDATETIPTEXT, 0, (LPARAM) &ti); + SendMessage( hwndToolTip, bNewTip ? TTM_ADDTOOL : TTM_UPDATETIPTEXT, 0, (LPARAM)&ti); SendMessage( hwndToolTip, TTM_ACTIVATE, (ti.lpszText!=NULL) , 0 ); SendMessage( hwndToolTip, TTM_SETMAXTIPWIDTH, 0 , 400 ); if (ti.lpszText) @@ -1116,7 +1116,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS); SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE | ENM_REQUESTRESIZE); SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_LIMITTEXT, (WPARAM)sizeof(TCHAR)*0x7FFFFFFF, 0); - SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETOLECALLBACK, 0, (LPARAM) & reOleCallback); + SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETOLECALLBACK, 0, (LPARAM)& reOleCallback); if (db_get_b(NULL, "Chat", "UseIEView", 0)) { IEVIEWWINDOW ieWindow; @@ -1152,7 +1152,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0); SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0); - SendMessage(GetParent(hwndDlg), CM_ADDCHILD, (WPARAM) hwndDlg, (LPARAM) psi->windowData.hContact); + SendMessage(GetParent(hwndDlg), CM_ADDCHILD, (WPARAM) hwndDlg, (LPARAM)psi->windowData.hContact); PostMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0); NotifyLocalWinEvent(psi->windowData.hContact, hwndDlg, MSG_WINDOW_EVT_OPEN); } @@ -1238,7 +1238,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) } tbd.iFlags = TBDF_TEXT | TBDF_ICON; tbd.pszText = szTemp; - SendMessage(GetParent(hwndDlg), CM_UPDATETITLEBAR, (WPARAM) &tbd, (LPARAM) hwndDlg); + SendMessage(GetParent(hwndDlg), CM_UPDATETITLEBAR, (WPARAM) &tbd, (LPARAM)hwndDlg); SendMessage(hwndDlg, DM_UPDATETABCONTROL, 0, 0); } break; @@ -1256,17 +1256,17 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) sbd.iFlags = SBDF_TEXT | SBDF_ICON; sbd.hIcon = hIcon; sbd.pszText = szTemp; - SendMessage(GetParent(hwndDlg), CM_UPDATESTATUSBAR, (WPARAM) &sbd, (LPARAM) hwndDlg); + SendMessage(GetParent(hwndDlg), CM_UPDATESTATUSBAR, (WPARAM) &sbd, (LPARAM)hwndDlg); sbd.iItem = 1; sbd.hIcon = NULL; sbd.pszText = _T(""); - SendMessage(GetParent(hwndDlg), CM_UPDATESTATUSBAR, (WPARAM) &sbd, (LPARAM) hwndDlg); + SendMessage(GetParent(hwndDlg), CM_UPDATESTATUSBAR, (WPARAM) &sbd, (LPARAM)hwndDlg); sid.cbSize = sizeof(sid); sid.szModule = SRMMMOD; sid.dwId = 0; sid.flags = 0; - ModifyStatusIcon((WPARAM)si->windowData.hContact, (LPARAM) &sid); + ModifyStatusIcon((WPARAM)si->windowData.hContact, (LPARAM)&sid); } break; @@ -1357,7 +1357,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) TabControlData tcd; tcd.iFlags = TCDF_TEXT; tcd.pszText = si->ptszName; - SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM) hwndDlg); + SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM)hwndDlg); } case GC_FIXTABICONS: @@ -1375,7 +1375,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) } tcd.iFlags = TCDF_ICON; tcd.hIcon = hIcon; - SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM) hwndDlg); + SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM)hwndDlg); } break; @@ -1403,7 +1403,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) if (si->wState & STATE_TALK) { si->wState &= ~STATE_TALK; - db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0); + db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM)0); } if (si->wState & GC_EVENT_HIGHLIGHT) { @@ -1553,7 +1553,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0)) CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon"); si->wState &= ~STATE_TALK; - db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0); + db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM)0); SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0); return TRUE; @@ -1659,7 +1659,7 @@ LABEL_SHOWWINDOW: pCC->bForeground = bFG; pCC->si = si; - ColorWindow= CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_COLORCHOOSER), hwndDlg, DlgProcColorToolWindow, (LPARAM) pCC); + ColorWindow= CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_COLORCHOOSER), hwndDlg, DlgProcColorToolWindow, (LPARAM)pCC); } break; @@ -1675,7 +1675,7 @@ LABEL_SHOWWINDOW: si.nPos = si.nMax - si.nPage + 1; SetScrollInfo(GetDlgItem(hwndDlg, IDC_CHAT_LOG), SB_VERT, &si, TRUE); sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOG), CP_ACP, FALSE); - SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_EXSETSEL, 0, (LPARAM) & sel); + SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_EXSETSEL, 0, (LPARAM)& sel); PostMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0); } } break; @@ -1692,8 +1692,8 @@ LABEL_SHOWWINDOW: SetActiveSession(si->ptszID, si->pszModule); - if (DBGetContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode", 0) != 0) - db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0); + if (db_get_w(si->windowData.hContact, si->pszModule ,"ApparentMode", 0) != 0) + db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM)0); if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0)) CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon"); } @@ -1762,7 +1762,7 @@ LABEL_SHOWWINDOW: break; case WM_COMMAND: - if (!lParam && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM) si->windowData.hContact)) + if (!lParam && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)si->windowData.hContact)) break; switch (LOWORD(wParam)) { case IDC_CHAT_LIST: @@ -1787,7 +1787,7 @@ LABEL_SHOWWINDOW: else mir_sntprintf(pszName, lstrlen(ui->pszUID)+2, _T("%s "), ui->pszUID); - SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_REPLACESEL, FALSE, (LPARAM) pszName); + SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_REPLACESEL, FALSE, (LPARAM)pszName); PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0); } else DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0); @@ -1873,7 +1873,7 @@ LABEL_SHOWWINDOW: smaddInfo.xPosition = rc.left; smaddInfo.yPosition = rc.bottom; smaddInfo.hContact = si->windowData.hContact; - CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM) &smaddInfo); + CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM)&smaddInfo); } break; @@ -2105,7 +2105,7 @@ LABEL_SHOWWINDOW: SetWindowLongPtr(hwndDlg,GWLP_USERDATA,0); SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_UNSUBCLASSED, 0, 0); - SendMessage(GetParent(hwndDlg), CM_REMOVECHILD, 0, (LPARAM) hwndDlg); + SendMessage(GetParent(hwndDlg), CM_REMOVECHILD, 0, (LPARAM)hwndDlg); if (si->windowData.hwndLog != NULL) { IEVIEWWINDOW ieWindow; ieWindow.cbSize = sizeof(IEVIEWWINDOW); diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index e5dbf2a84e..e01fb19a9e 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -344,7 +344,7 @@ void ReloadGlobals() g_dat.flags |= SMF_INDENTTEXT; g_dat.openFlags = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS); - g_dat.indentSize = DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_INDENTSIZE, SRMSGDEFSET_INDENTSIZE); + g_dat.indentSize = db_get_w(NULL, SRMMMOD, SRMSGSET_INDENTSIZE, SRMSGDEFSET_INDENTSIZE); g_dat.logLineColour = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SRMSGDEFSET_LINECOLOUR); if (db_get_b(NULL, SRMMMOD, SRMSGSET_USETABS, SRMSGDEFSET_USETABS)) diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp index c6efc0d6a9..0c59d7fc0f 100644 --- a/plugins/Scriver/src/infobar.cpp +++ b/plugins/Scriver/src/infobar.cpp @@ -182,12 +182,12 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA case WM_LBUTTONUP: { CHARRANGE sel; - SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXGETSEL, 0, (LPARAM) &sel); + SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXGETSEL, 0, (LPARAM)&sel); bWasCopy = FALSE; if (sel.cpMin != sel.cpMax) { SendDlgItemMessage(hwnd, pNmhdr->idFrom, WM_COPY, 0, 0); sel.cpMin = sel.cpMax ; - SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXSETSEL, 0, (LPARAM) & sel); + SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXSETSEL, 0, (LPARAM)& sel); bWasCopy = TRUE; } SetFocus(GetParent(hwnd)); diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp index 1a6f18c15a..a0c2f58178 100644 --- a/plugins/Scriver/src/input.cpp +++ b/plugins/Scriver/src/input.cpp @@ -40,7 +40,7 @@ void InputAreaContextMenu(HWND hwnd, WPARAM wParam, LPARAM lParam, HANDLE hConta hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT)); hSubMenu = GetSubMenu(hMenu, 2); TranslateMenu(hSubMenu); - SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) & sel); + SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)& sel); if (sel.cpMin == sel.cpMax) { EnableMenuItem(hSubMenu, IDM_CUT, MF_BYCOMMAND | MF_GRAYED); EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED); @@ -58,7 +58,7 @@ void InputAreaContextMenu(HWND hwnd, WPARAM wParam, LPARAM lParam, HANDLE hConta EnableMenuItem(hSubMenu, IDM_PASTE, MF_BYCOMMAND | MF_GRAYED); } if (lParam == 0xFFFFFFFF) { - SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM) & pt, (LPARAM) sel.cpMax); + SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM) & pt, (LPARAM)sel.cpMax); ClientToScreen(hwnd, &pt); } else { @@ -108,7 +108,7 @@ void InputAreaContextMenu(HWND hwnd, WPARAM wParam, LPARAM lParam, HANDLE hConta SendMessage(hwnd, EM_REPLACESEL, TRUE, 0); break; case IDM_SELECTALL: - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & all); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& all); break; case IDM_CLEAR: SetWindowText(hwnd, _T( "" )); diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 5fb5dc0620..b1419dff25 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -372,12 +372,12 @@ static LRESULT CALLBACK LogEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, SendMessage(hwnd, WM_COPY, 0, 0); break; case IDM_COPYALL: - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & all); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& all); SendMessage(hwnd, WM_COPY, 0, 0); - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & sel); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel); break; case IDM_SELECTALL: - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & all); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& all); break; case IDM_CLEAR: SendMessage(GetParent(hwnd), DM_CLEARLOG, 0, 0); @@ -655,10 +655,10 @@ static BOOL IsTypingNotificationEnabled(SrmmWindowData *dat) return FALSE; DWORD protoCaps = CallProtoService(dat->szProto, PS_GETCAPS, PFLAGNUM_1, 0); - if (protoCaps & PF1_VISLIST && DBGetContactSettingWord(dat->windowData.hContact, dat->szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE) + if (protoCaps & PF1_VISLIST && db_get_w(dat->windowData.hContact, dat->szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE) return FALSE; - if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && DBGetContactSettingWord(dat->windowData.hContact, dat->szProto, "ApparentMode", 0) != ID_STATUS_ONLINE) + if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(dat->windowData.hContact, dat->szProto, "ApparentMode", 0) != ID_STATUS_ONLINE) return FALSE; if (db_get_b(dat->windowData.hContact, "CList", "NotOnList", 0) @@ -748,7 +748,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat->szProto = GetContactProto(dat->windowData.hContact); dat->avatarPic = 0; if (dat->windowData.hContact && dat->szProto != NULL) - dat->wStatus = DBGetContactSettingWord(dat->windowData.hContact, dat->szProto, "Status", ID_STATUS_OFFLINE); + dat->wStatus = db_get_w(dat->windowData.hContact, dat->szProto, "Status", ID_STATUS_OFFLINE); else dat->wStatus = ID_STATUS_OFFLINE; dat->hDbEventFirst = NULL; @@ -801,7 +801,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP else SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG),GWL_EXSTYLE,GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG),GWL_EXSTYLE) & ~WS_EX_LEFTSCROLLBAR); } - dat->windowData.codePage = DBGetContactSettingWord(dat->windowData.hContact, SRMMMOD, "CodePage", (WORD) CP_ACP); + dat->windowData.codePage = db_get_w(dat->windowData.hContact, SRMMMOD, "CodePage", (WORD) CP_ACP); dat->ace = NULL; GetWindowRect(GetDlgItem(hwndDlg, IDC_MESSAGE), &minEditInit); dat->windowData.minEditBoxHeight = minEditInit.bottom - minEditInit.top; @@ -840,20 +840,20 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendMessage(GetDlgItem(hwndDlg, IDC_SMILEYS), BUTTONADDTOOLTIP, (WPARAM) Translate("Insert Emoticon"), 0); SendMessage(GetDlgItem(hwndDlg, IDOK), BUTTONADDTOOLTIP, (WPARAM) Translate("Send Message"), 0); - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM) & reOleCallback); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)& reOleCallback); SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_LINK | ENM_KEYEVENTS); SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR); - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETLANGOPTIONS, 0, (LPARAM) SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETLANGOPTIONS, 0, 0) & ~(IMF_AUTOKEYBOARD | IMF_AUTOFONTSIZEADJUST)); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETLANGOPTIONS, 0, (LPARAM)SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETLANGOPTIONS, 0, 0) & ~(IMF_AUTOKEYBOARD | IMF_AUTOFONTSIZEADJUST)); SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0,0)); /* duh, how come we didnt use this from the start? */ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_AUTOURLDETECT, (WPARAM) TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETLANGOPTIONS, 0, (LPARAM) SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD); - SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETOLECALLBACK, 0, (LPARAM) & reOleCallback2); + SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETLANGOPTIONS, 0, (LPARAM)SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD); + SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETOLECALLBACK, 0, (LPARAM)& reOleCallback2); SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE | ENM_REQUESTRESIZE); if (dat->windowData.hContact) { if (dat->szProto) { - int nMax = CallProtoService(dat->szProto, PS_GETCAPS, PFLAG_MAXLENOFMESSAGE, (LPARAM) dat->windowData.hContact); + int nMax = CallProtoService(dat->szProto, PS_GETCAPS, PFLAG_MAXLENOFMESSAGE, (LPARAM)dat->windowData.hContact); if (nMax) SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_LIMITTEXT, (WPARAM) nMax, 0); } @@ -892,7 +892,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP { DBEVENTINFO dbei = { sizeof(dbei) }; HANDLE hPrevEvent; - for (int i = DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT); i > 0; i--) { + for (int i = db_get_w(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT); i > 0; i--) { if (dat->hDbEventFirst == NULL) hPrevEvent = db_event_last(dat->windowData.hContact); else @@ -921,7 +921,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP db_event_get(dat->hDbEventFirst, &dbei); hPrevEvent = db_event_prev(dat->hDbEventFirst); } - DWORD firstTime = dbei.timestamp - 60 * DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME); + DWORD firstTime = dbei.timestamp - 60 * db_get_w(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME); for (;;) { if (hPrevEvent == NULL) break; @@ -937,7 +937,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP } } } - SendMessage(dat->hwndParent, CM_ADDCHILD, (WPARAM) hwndDlg, (LPARAM) dat->windowData.hContact); + SendMessage(dat->hwndParent, CM_ADDCHILD, (WPARAM) hwndDlg, (LPARAM)dat->windowData.hContact); { HANDLE hdbEvent = db_event_last(dat->windowData.hContact); if (hdbEvent) { @@ -953,7 +953,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP } } SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0); - SendMessage(GetParent(hwndDlg), CM_POPUPWINDOW, (WPARAM) (newData->flags & NMWLP_INCOMING), (LPARAM) hwndDlg); + SendMessage(GetParent(hwndDlg), CM_POPUPWINDOW, (WPARAM) (newData->flags & NMWLP_INCOMING), (LPARAM)hwndDlg); if (notifyUnread) { if (GetForegroundWindow() != dat->hwndParent || dat->parent->hwndActive != hwndDlg) { dat->showUnread = 1; @@ -1057,12 +1057,12 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break; case DM_CHANGEICONS: - SendDlgItemMessage(hwndDlg, IDC_ADD, BM_SETIMAGE, IMAGE_ICON, (LPARAM) GetCachedIcon("scriver_ADD")); - SendDlgItemMessage(hwndDlg, IDC_DETAILS, BM_SETIMAGE, IMAGE_ICON, (LPARAM) GetCachedIcon("scriver_USERDETAILS")); - SendDlgItemMessage(hwndDlg, IDC_HISTORY, BM_SETIMAGE, IMAGE_ICON, (LPARAM) GetCachedIcon("scriver_HISTORY")); - SendDlgItemMessage(hwndDlg, IDC_QUOTE, BM_SETIMAGE, IMAGE_ICON, (LPARAM) GetCachedIcon("scriver_QUOTE")); - SendDlgItemMessage(hwndDlg, IDC_SMILEYS, BM_SETIMAGE, IMAGE_ICON, (LPARAM) GetCachedIcon("scriver_SMILEY")); - SendDlgItemMessage(hwndDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM) GetCachedIcon("scriver_SEND")); + SendDlgItemMessage(hwndDlg, IDC_ADD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_ADD")); + SendDlgItemMessage(hwndDlg, IDC_DETAILS, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_USERDETAILS")); + SendDlgItemMessage(hwndDlg, IDC_HISTORY, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_HISTORY")); + SendDlgItemMessage(hwndDlg, IDC_QUOTE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_QUOTE")); + SendDlgItemMessage(hwndDlg, IDC_SMILEYS, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_SMILEY")); + SendDlgItemMessage(hwndDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_SEND")); SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0); SetStatusIcon(dat); @@ -1112,7 +1112,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (!cws || (!strcmp(cws->szModule, dat->szProto) && !strcmp(cws->szSetting, "Status"))) { DWORD wStatus; - wStatus = DBGetContactSettingWord( dat->windowData.hContact, dat->szProto, "Status", ID_STATUS_OFFLINE); + wStatus = db_get_w( dat->windowData.hContact, dat->szProto, "Status", ID_STATUS_OFFLINE); // log status change - should be moved to a separate place if (dat->wStatus != wStatus && db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, SRMSGDEFSET_SHOWSTATUSCH)) { mir_ptr szOldStatus( mir_tstrdup((TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM) dat->wStatus, GSMDF_TCHAR))); @@ -1207,14 +1207,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP cf2.bPitchAndFamily = lf.lfPitchAndFamily; cf2.yHeight = abs(lf.lfHeight) * 1440 / g_dat.logPixelSY; SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, (WPARAM)SCF_ALL, (LPARAM)&cf2); - SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETLANGOPTIONS, 0, (LPARAM) SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD); + SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETLANGOPTIONS, 0, (LPARAM)SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD); pf2.cbSize = sizeof(pf2); pf2.dwMask = PFM_OFFSET; pf2.dxOffset = (g_dat.flags & SMF_INDENTTEXT) ? g_dat.indentSize * 1440 / g_dat.logPixelSX : 0; SetDlgItemText(hwndDlg, IDC_LOG, _T("")); SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETPARAFORMAT, 0, (LPARAM)&pf2); - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETLANGOPTIONS, 0, (LPARAM) SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETLANGOPTIONS, 0, 0) & ~(IMF_AUTOKEYBOARD | IMF_AUTOFONTSIZEADJUST)); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETLANGOPTIONS, 0, (LPARAM)SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETLANGOPTIONS, 0, 0) & ~(IMF_AUTOKEYBOARD | IMF_AUTOFONTSIZEADJUST)); SendMessage(hwndDlg, DM_REMAKELOG, 0, 0); SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0); @@ -1266,7 +1266,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW))); db_set_b(dat->windowData.hContact, SRMMMOD, SRMSGSET_TYPING, (BYTE)!typingNotify); sid.flags = typingNotify ? MBF_DISABLED : 0; - ModifyStatusIcon((WPARAM)dat->windowData.hContact, (LPARAM) &sid); + ModifyStatusIcon((WPARAM)dat->windowData.hContact, (LPARAM)&sid); } break; @@ -1319,7 +1319,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get(hDbEvent, &dbei); if (!(dbei.flags & DBEF_SENT) && (DbEventIsMessageOrCustom(&dbei) || dbei.eventType == EVENTTYPE_URL)) - CallService(MS_CLIST_REMOVEEVENT, (WPARAM) dat->windowData.hContact, (LPARAM) hDbEvent); + CallService(MS_CLIST_REMOVEEVENT, (WPARAM) dat->windowData.hContact, (LPARAM)hDbEvent); hDbEvent = db_event_next(hDbEvent); } } @@ -1396,14 +1396,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case DM_REMAKELOG: dat->lastEventType = -1; - if (wParam == 0 || (HANDLE) wParam == dat->windowData.hContact) + if (wParam == 0 || (HANDLE)wParam == dat->windowData.hContact) StreamInEvents(hwndDlg, dat->hDbEventFirst, -1, 0); InvalidateRect(GetDlgItem(hwndDlg, IDC_LOG), NULL, FALSE); break; case DM_APPENDTOLOG: //takes wParam=hDbEvent - StreamInEvents(hwndDlg, (HANDLE) wParam, 1, 1); + StreamInEvents(hwndDlg, (HANDLE)wParam, 1, 1); break; case DM_SCROLLLOGTOBOTTOM: @@ -1503,7 +1503,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP sid.cbSize = sizeof(sid); sid.szModule = SRMMMOD; sid.flags = MBF_DISABLED; - ModifyStatusIcon((WPARAM)dat->windowData.hContact, (LPARAM) &sid); + ModifyStatusIcon((WPARAM)dat->windowData.hContact, (LPARAM)&sid); sid.dwId = 1; if (IsTypingNotificationSupported(dat) && g_dat.flags2 & SMF2_SHOWTYPINGSWITCH) sid.flags = (db_get_b(dat->windowData.hContact, SRMMMOD, SRMSGSET_TYPING, @@ -1511,7 +1511,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP else sid.flags = MBF_HIDDEN; - ModifyStatusIcon((WPARAM)dat->windowData.hContact, (LPARAM) &sid); + ModifyStatusIcon((WPARAM)dat->windowData.hContact, (LPARAM)&sid); } break; @@ -1624,7 +1624,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (lParam) { ErrorWindowData *ewd = (ErrorWindowData *) lParam; SendMessage(hwndDlg, DM_STOPMESSAGESENDING, 0, 0); - ewd->queueItem->hwndErrorDlg = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGSENDERROR), hwndDlg, ErrorDlgProc, (LPARAM) ewd);//hwndDlg + ewd->queueItem->hwndErrorDlg = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGSENDERROR), hwndDlg, ErrorDlgProc, (LPARAM)ewd);//hwndDlg } break; @@ -1702,7 +1702,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam); case WM_COMMAND: - if (!lParam && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM) dat->windowData.hContact)) + if (!lParam && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->windowData.hContact)) break; switch (LOWORD(wParam)) { @@ -1747,10 +1747,10 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP gt.flags = GT_USECRLF; gt.cb = ansiBufSize; gt.codepage = dat->windowData.codePage; - SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETTEXTEX, (WPARAM) >, (LPARAM) msi.sendBuffer); + SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETTEXTEX, (WPARAM) >, (LPARAM)msi.sendBuffer); gt.cb = bufSize - ansiBufSize; gt.codepage = 1200; - SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETTEXTEX, (WPARAM) >, (LPARAM) &msi.sendBuffer[ansiBufSize]); + SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETTEXTEX, (WPARAM) >, (LPARAM)&msi.sendBuffer[ansiBufSize]); if ( RTL_Detect((wchar_t *)&msi.sendBuffer[ansiBufSize] )) msi.flags |= PREF_RTL; @@ -1780,9 +1780,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN)) ShowWindow(dat->hwndParent, SW_MINIMIZE); if (LOWORD(wParam) == IDC_SENDALL) - SendMessage(dat->hwndParent, DM_SENDMESSAGE, 0, (LPARAM) &msi); + SendMessage(dat->hwndParent, DM_SENDMESSAGE, 0, (LPARAM)&msi); else - SendMessage(hwndDlg, DM_SENDMESSAGE, 0, (LPARAM) &msi); + SendMessage(hwndDlg, DM_SENDMESSAGE, 0, (LPARAM)&msi); mir_free (msi.sendBuffer); } return TRUE; @@ -1822,7 +1822,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP smaddInfo.targetWParam = TRUE; smaddInfo.Protocolname = dat->szProto; if (dat->szProto!=NULL && strcmp(dat->szProto,"MetaContacts")==0) { - HANDLE hContact = (HANDLE) CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) dat->windowData.hContact, 0); + HANDLE hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) dat->windowData.hContact, 0); if (hContact!=NULL) { smaddInfo.Protocolname = GetContactProto(hContact); } @@ -1832,7 +1832,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP smaddInfo.xPosition = rc.left; smaddInfo.yPosition = rc.bottom; smaddInfo.hContact = dat->windowData.hContact; - CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM) &smaddInfo); + CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM)&smaddInfo); } break; @@ -1882,7 +1882,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP acs.handle = dat->windowData.hContact; acs.handleType = HANDLE_CONTACT; acs.szProto = 0; - CallService(MS_ADDCONTACT_SHOW, (WPARAM) hwndDlg, (LPARAM) & acs); + CallService(MS_ADDCONTACT_SHOW, (WPARAM) hwndDlg, (LPARAM)& acs); } if (!db_get_b(dat->windowData.hContact, "CList", "NotOnList", 0)) ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE); @@ -2036,7 +2036,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP CallService(MS_DB_CONTACT_DELETE, (WPARAM)dat->windowData.hContact, 0); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); - SendMessage(dat->hwndParent, CM_REMOVECHILD, 0, (LPARAM) hwndDlg); + SendMessage(dat->hwndParent, CM_REMOVECHILD, 0, (LPARAM)hwndDlg); if (dat->windowData.hwndLog != NULL) { IEVIEWWINDOW ieWindow = { sizeof(ieWindow) }; ieWindow.iType = IEW_DESTROY; diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 8eac446e9a..83f142d87b 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -96,13 +96,13 @@ TCHAR *GetNickname(HANDLE hContact, const char* szProto) { ci.dwFlag |= CNF_UNICODE; } - if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) { + if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)& ci)) { if (ci.type == CNFT_ASCIIZ) { if (ci.pszVal) { if (IsUnicodeMIM()) { if (!_tcscmp((TCHAR *)ci.pszVal, TranslateW(_T("'(Unknown Contact)'")))) { ci.dwFlag &= ~CNF_UNICODE; - if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) { + if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)& ci)) { szName = a2t((char *)ci.pszVal); } } else { @@ -133,7 +133,7 @@ TCHAR *GetNickname(HANDLE hContact, const char* szProto) { int DbEventIsCustomForMsgWindow(DBEVENTINFO *dbei) { - DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )CallService( MS_DB_EVENT_GETTYPE, ( WPARAM )dbei->szModule, ( LPARAM )dbei->eventType ); + DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType); return et && ( et->flags & DETF_MSGWINDOW ); } @@ -180,7 +180,7 @@ EventData *getEventFromDB(struct SrmmWindowData *dat, HANDLE hContact, HANDLE hD event->custom = DbEventIsCustomForMsgWindow(&dbei); if (!(dbei.flags & DBEF_SENT) && (dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_URL || event->custom)) { db_event_markRead(hContact, hDbEvent); - CallService(MS_CLIST_REMOVEEVENT, (WPARAM) hContact, (LPARAM) hDbEvent); + CallService(MS_CLIST_REMOVEEVENT, (WPARAM) hContact, (LPARAM)hDbEvent); } else if (dbei.eventType == EVENTTYPE_STATUSCHANGE || dbei.eventType == EVENTTYPE_JABBER_CHATSTATES || dbei.eventType == EVENTTYPE_JABBER_PRESENCE) { db_event_markRead(hContact, hDbEvent); @@ -866,7 +866,7 @@ void StreamInTestEvents(HWND hEditWnd, struct GlobalMessageData *gdat) streamData.gdat = gdat; stream.pfnCallback = LogStreamInEvents; stream.dwCookie = (DWORD_PTR) & streamData; - SendMessage(hEditWnd, EM_STREAMIN, SF_RTF, (LPARAM) & stream); + SendMessage(hEditWnd, EM_STREAMIN, SF_RTF, (LPARAM)& stream); SendMessage(hEditWnd, EM_HIDESELECTION, FALSE, 0); } void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) @@ -908,7 +908,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) // IEVIew MOD End SendDlgItemMessage(hwndDlg, IDC_LOG, EM_HIDESELECTION, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM) & oldSel); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM)& oldSel); streamData.hContact = dat->windowData.hContact; streamData.hDbEvent = hDbEventFirst; streamData.hDbEventLast = dat->hDbEventLast; @@ -926,19 +926,19 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) gtxl.codepage = 1200; fi.chrg.cpMin = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0); sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->windowData.codePage, FALSE); - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM) & sel); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)& sel); } else { SendDlgItemMessage(hwndDlg, IDC_LOG, WM_SETREDRAW, FALSE, 0); SetDlgItemText(hwndDlg, IDC_LOG, _T("")); sel.cpMin = 0; sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->windowData.codePage, FALSE); - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM) & sel); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)& sel); fi.chrg.cpMin = 0; dat->isMixed = 0; } - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_STREAMIN, fAppend ? SFF_SELECTION | SF_RTF : SFF_SELECTION | SF_RTF, (LPARAM) & stream); - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM) & oldSel); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_STREAMIN, fAppend ? SFF_SELECTION | SF_RTF : SFF_SELECTION | SF_RTF, (LPARAM)& stream); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)& oldSel); SendDlgItemMessage(hwndDlg, IDC_LOG, EM_HIDESELECTION, FALSE, 0); if (g_dat.smileyAddInstalled) { SMADD_RICHEDIT3 smre; @@ -946,7 +946,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) smre.hwndRichEditControl = GetDlgItem(hwndDlg, IDC_LOG); smre.Protocolname = dat->szProto; if (dat->szProto!=NULL && strcmp(dat->szProto,"MetaContacts")==0) { - HANDLE hContact = (HANDLE) CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) dat->windowData.hContact, 0); + HANDLE hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) dat->windowData.hContact, 0); if (hContact!=NULL) { smre.Protocolname = GetContactProto(hContact); } @@ -962,7 +962,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) smre.disableRedraw = TRUE; smre.hContact = dat->windowData.hContact; smre.flags = 0; - CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM) &smre); + CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&smre); } int len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->windowData.codePage, FALSE); diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index ca9fce9268..da590c3acf 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -281,7 +281,7 @@ void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour, BOOL chatMode) lstrcpy(lf->lfFaceName, fontList[i].szDefFace); else { _tcsncpy(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName)); - DBFreeVariant(&dbv); + db_free(&dbv); } wsprintfA(str, "%s%dSet", prefix, i); lf->lfCharSet = db_get_b(NULL, module, str, MsgDlgGetFontDefaultCharset(lf->lfFaceName)); @@ -771,9 +771,9 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, break; } SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); - SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT)); + SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, db_get_w(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT)); SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETRANGE, 0, MAKELONG(12 * 60, 0)); - SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME)); + SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, db_get_w(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME)); CheckDlgButton(hwndDlg, IDC_SHOWLOGICONS, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS)); CheckDlgButton(hwndDlg, IDC_SHOWNAMES, !db_get_b(NULL, SRMMMOD, SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES)); @@ -803,7 +803,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, EnableWindow(GetDlgItem(hwndDlg, IDC_INDENTSIZE), IsDlgButtonChecked(hwndDlg, IDC_INDENTTEXT)); EnableWindow(GetDlgItem(hwndDlg, IDC_INDENTSPIN), IsDlgButtonChecked(hwndDlg, IDC_INDENTTEXT)); SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_SETRANGE, 0, MAKELONG(999, 0)); - SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_INDENTSIZE, SRMSGDEFSET_INDENTSIZE)); + SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_SETPOS, 0, db_get_w(NULL, SRMMMOD, SRMSGSET_INDENTSIZE, SRMSGDEFSET_INDENTSIZE)); CheckDlgButton(hwndDlg, IDC_SHOWSTATUSCHANGES, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, SRMSGDEFSET_SHOWSTATUSCH)); @@ -819,7 +819,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR); SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0,0)); SendDlgItemMessage(hwndDlg, IDC_LOG, EM_AUTOURLDETECT, (WPARAM) TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM) & reOleCallback); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)& reOleCallback); } ShowPreview(hwndDlg); return TRUE; @@ -940,7 +940,7 @@ static void ResetCList(HWND hwndDlg) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETHIDEEMPTYGROUPS, 1, 0); SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETGREYOUTFLAGS, 0, 0); SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETLEFTMARGIN, 2, 0); - SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETBKBITMAP, 0, (LPARAM) (HBITMAP) NULL); + SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETBKBITMAP, 0, (LPARAM)(HBITMAP) NULL); SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETBKCOLOR, GetSysColor(COLOR_WINDOW), 0); SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETINDENT, 10, 0); for (i = 0; i <= FONTID_MAX; i++) @@ -960,7 +960,7 @@ static void RebuildList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) } hContact = db_find_first(); do { - hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0); + hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0); if (hItem && db_get_b(hContact, SRMMMOD, SRMSGSET_TYPING, defType)) { SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItem, 1); } @@ -979,7 +979,7 @@ static void SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) } hContact = db_find_first(); do { - hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0); + hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0); if (hItem) { db_set_b(hContact, SRMMMOD, SRMSGSET_TYPING, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItem, 0) ? 1 : 0)); } @@ -998,9 +998,9 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam cii.cbSize = sizeof(cii); cii.flags = CLCIIF_GROUPFONT | CLCIIF_CHECKBOX; cii.pszText = (TCHAR *)TranslateT("** New contacts **"); - hItemNew = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM) & cii); + hItemNew = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM)& cii); cii.pszText = (TCHAR *)TranslateT("** Unknown contacts **"); - hItemUnknown = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM) & cii); + hItemUnknown = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM)& cii); } SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE) | (CLS_SHOWHIDDEN) | (CLS_NOHIDEOFFLINE)); ResetCList(hwndDlg); diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index fe1a050430..0f3eb1f6f2 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -23,9 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h" -HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand, hDragCursor; - -HANDLE hMsgMenuItem, hHookWinEvt=NULL, hHookWinPopup=NULL;; +HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand, hDragCursor; +HANDLE hHookWinEvt=NULL, hHookWinPopup=NULL; +HGENMENU hMsgMenuItem; extern HWND GetParentWindow(HANDLE hContact, BOOL bChat); @@ -36,29 +36,29 @@ PSLWA pSetLayeredWindowAttributes; static int SRMMStatusToPf2(int status) { - switch (status) { - case ID_STATUS_ONLINE: - return PF2_ONLINE; - case ID_STATUS_AWAY: - return PF2_SHORTAWAY; - case ID_STATUS_DND: - return PF2_HEAVYDND; - case ID_STATUS_NA: - return PF2_LONGAWAY; - case ID_STATUS_OCCUPIED: - return PF2_LIGHTDND; - case ID_STATUS_FREECHAT: - return PF2_FREECHAT; - case ID_STATUS_INVISIBLE: - return PF2_INVISIBLE; - case ID_STATUS_ONTHEPHONE: - return PF2_ONTHEPHONE; - case ID_STATUS_OUTTOLUNCH: - return PF2_OUTTOLUNCH; - case ID_STATUS_OFFLINE: - return MODEF_OFFLINE; - } - return 0; + switch (status) { + case ID_STATUS_ONLINE: + return PF2_ONLINE; + case ID_STATUS_AWAY: + return PF2_SHORTAWAY; + case ID_STATUS_DND: + return PF2_HEAVYDND; + case ID_STATUS_NA: + return PF2_LONGAWAY; + case ID_STATUS_OCCUPIED: + return PF2_LIGHTDND; + case ID_STATUS_FREECHAT: + return PF2_FREECHAT; + case ID_STATUS_INVISIBLE: + return PF2_INVISIBLE; + case ID_STATUS_ONTHEPHONE: + return PF2_ONTHEPHONE; + case ID_STATUS_OUTTOLUNCH: + return PF2_OUTTOLUNCH; + case ID_STATUS_OFFLINE: + return MODEF_OFFLINE; + } + return 0; } int IsAutoPopup(HANDLE hContact) { @@ -69,9 +69,8 @@ int IsAutoPopup(HANDLE hContact) { if (hContact != NULL) szProto = GetContactProto(hContact); } - if (szProto && (g_dat.openFlags & SRMMStatusToPf2(CallProtoService(szProto, PS_GETSTATUS, 0, 0)))) { + if (szProto && (g_dat.openFlags & SRMMStatusToPf2(CallProtoService(szProto, PS_GETSTATUS, 0, 0)))) return 1; - } } return 0; } @@ -86,10 +85,9 @@ static INT_PTR ReadMessageCommand(WPARAM wParam, LPARAM lParam) if (hwndExisting == NULL) { newData.hContact = ((CLISTEVENT *) lParam)->hContact; hParent = GetParentWindow(newData.hContact, FALSE); - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), hParent, DlgProcMessage, (LPARAM) & newData); - } else { - SendMessage(GetParent(hwndExisting), CM_POPUPWINDOW, 0, (LPARAM) hwndExisting); + CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), hParent, DlgProcMessage, (LPARAM)& newData); } + else SendMessage(GetParent(hwndExisting), CM_POPUPWINDOW, 0, (LPARAM)hwndExisting); return 0; } @@ -100,53 +98,46 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) if (dbei.eventType == EVENTTYPE_MESSAGE && (dbei.flags & DBEF_READ)) return 0; - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE) wParam); + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam); if (hwnd) SendMessage(hwnd, HM_DBEVENTADDED, wParam, lParam); if (dbei.flags & DBEF_SENT || !DbEventIsMessageOrCustom(&dbei)) return 0; - CallServiceSync(MS_CLIST_REMOVEEVENT, wParam, (LPARAM) 1); + CallServiceSync(MS_CLIST_REMOVEEVENT, wParam, (LPARAM)1); /* does a window for the contact exist? */ if (hwnd == NULL) { /* new message */ SkinPlaySound("AlertMsg"); - if (IsAutoPopup((HANDLE) wParam)) { - HWND hParent; + if (IsAutoPopup((HANDLE)wParam)) { NewMessageWindowLParam newData = { 0 }; - newData.hContact = (HANDLE) wParam; - hParent = GetParentWindow(newData.hContact, FALSE); + newData.hContact = (HANDLE)wParam; + HWND hParent = GetParentWindow(newData.hContact, FALSE); newData.flags = NMWLP_INCOMING; - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), hParent, DlgProcMessage, (LPARAM) & newData); + CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), hParent, DlgProcMessage, (LPARAM)&newData); return 0; } } - if (hwnd == NULL || !IsWindowVisible(GetParent(hwnd))) - { - CLISTEVENT cle = {0}; - TCHAR *contactName; + if (hwnd == NULL || !IsWindowVisible(GetParent(hwnd))) { + TCHAR *contactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR); TCHAR toolTip[256]; - cle.cbSize = sizeof(cle); + CLISTEVENT cle = { sizeof(cle) }; cle.flags = CLEF_TCHAR; - cle.hContact = (HANDLE) wParam; - cle.hDbEvent = (HANDLE) lParam; + cle.hContact = (HANDLE)wParam; + cle.hDbEvent = (HANDLE)lParam; cle.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); cle.pszService = "SRMsg/ReadMessage"; - contactName = (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR); mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), contactName); cle.ptszTooltip = toolTip; - CallService(MS_CLIST_ADDEVENT, 0, (LPARAM) & cle); + CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)& cle); } return 0; } static INT_PTR SendMessageCommandW(WPARAM wParam, LPARAM lParam) { - HWND hwnd; - NewMessageWindowLParam newData = { 0 }; - /* does the HCONTACT's protocol support IM messages? */ char *szProto = GetContactProto((HANDLE)wParam); if (szProto == NULL) @@ -155,205 +146,185 @@ static INT_PTR SendMessageCommandW(WPARAM wParam, LPARAM lParam) if (!CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) return 1; - if ((hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE) wParam))) { - if (lParam) { - HWND hEdit; - hEdit = GetDlgItem(hwnd, IDC_MESSAGE); - SendMessage(hEdit, EM_SETSEL, -1, SendMessage(hEdit, WM_GETTEXTLENGTH, 0, 0)); -/* - SETTEXTEX st; - st.flags = ST_SELECTION; - st.codepage = 1200; - SendMessage(hEdit, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)lParam); -*/ - SendMessage(hEdit, EM_REPLACESEL, FALSE, (LPARAM) (TCHAR *) lParam); - } - SendMessage(GetParent(hwnd), CM_POPUPWINDOW, 0, (LPARAM) hwnd); - } else { - HWND hParent; - newData.hContact = (HANDLE) wParam; - newData.szInitialText = (const char *) lParam; - newData.isWchar = 1; - hParent = GetParentWindow(newData.hContact, FALSE); - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), hParent, DlgProcMessage, (LPARAM) & newData); - } - return 0; + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam); + if (hwnd != NULL) { + if (lParam) { + HWND hEdit = GetDlgItem(hwnd, IDC_MESSAGE); + SendMessage(hEdit, EM_SETSEL, -1, SendMessage(hEdit, WM_GETTEXTLENGTH, 0, 0)); + SendMessage(hEdit, EM_REPLACESEL, FALSE, (LPARAM)(TCHAR *) lParam); + } + SendMessage(GetParent(hwnd), CM_POPUPWINDOW, 0, (LPARAM)hwnd); + } + else { + NewMessageWindowLParam newData = { 0 }; + newData.hContact = (HANDLE)wParam; + newData.szInitialText = (const char *) lParam; + newData.isWchar = 1; + HWND hParent = GetParentWindow(newData.hContact, FALSE); + CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), hParent, DlgProcMessage, (LPARAM)& newData); + } + return 0; } static INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam) { - HWND hwnd; - NewMessageWindowLParam newData = { 0 }; - - { - char *szProto = GetContactProto((HANDLE)wParam); - //logInfo("Show message window for: %s (%s)", CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, 0), szProto); - if (szProto) { - /* does the HCONTACT's protocol support IM messages? */ - if (!CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) - return 1; - } - else { - /* unknown contact */ - return 1; - } //if - } - - if ((hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE) wParam))) { - if (lParam) { - HWND hEdit; - hEdit = GetDlgItem(hwnd, IDC_MESSAGE); - SendMessage(hEdit, EM_SETSEL, -1, SendMessage(hEdit, WM_GETTEXTLENGTH, 0, 0)); -/* - SETTEXTEX st; - st.flags = ST_SELECTION; - st.codepage = CP_ACP; - SendMessage(hEdit, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)lParam); -*/ - SendMessageA(hEdit, EM_REPLACESEL, FALSE, (LPARAM) (char *) lParam); - } - SendMessage(GetParent(hwnd), CM_POPUPWINDOW, 0, (LPARAM) hwnd); - } else { - HWND hParent; - newData.hContact = (HANDLE) wParam; - newData.szInitialText = (const char *) lParam; - newData.isWchar = 0; - hParent = GetParentWindow(newData.hContact, FALSE); - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), hParent, DlgProcMessage, (LPARAM) & newData); - } - return 0; + char *szProto = GetContactProto((HANDLE)wParam); + //logInfo("Show message window for: %s (%s)", CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, 0), szProto); + if (szProto) { + /* does the HCONTACT's protocol support IM messages? */ + if (!CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) + return 1; + } + else /* unknown contact */ + return 1; + + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam); + if (hwnd != NULL) { + if (lParam) { + HWND hEdit = GetDlgItem(hwnd, IDC_MESSAGE); + SendMessage(hEdit, EM_SETSEL, -1, SendMessage(hEdit, WM_GETTEXTLENGTH, 0, 0)); + SendMessageA(hEdit, EM_REPLACESEL, FALSE, (LPARAM)(char *) lParam); + } + SendMessage(GetParent(hwnd), CM_POPUPWINDOW, 0, (LPARAM)hwnd); + } + else { + NewMessageWindowLParam newData = { 0 }; + newData.hContact = (HANDLE)wParam; + newData.szInitialText = (const char *)lParam; + HWND hParent = GetParentWindow(newData.hContact, FALSE); + CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), hParent, DlgProcMessage, (LPARAM)& newData); + } + return 0; } static INT_PTR TypingMessageCommand(WPARAM wParam, LPARAM lParam) { - CLISTEVENT *cle = (CLISTEVENT *) lParam; - - if (!cle) - return 0; - SendMessageCommand((WPARAM) cle->hContact, 0); - return 0; + CLISTEVENT *cle = (CLISTEVENT*)lParam; + if (cle) + SendMessageCommand((WPARAM)cle->hContact, 0); + return 0; } static int TypingMessage(WPARAM wParam, LPARAM lParam) { - HWND hwnd; - - if (!(g_dat.flags2&SMF2_SHOWTYPING)) - return 0; - if ((hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE) wParam))) { - SendMessage(hwnd, DM_TYPING, 0, lParam); - } else if ((int) lParam && (g_dat.flags2&SMF2_SHOWTYPINGTRAY)) { - TCHAR szTip[256]; - - mir_sntprintf(szTip, SIZEOF(szTip), TranslateT("%s is typing a message"), (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR)); - if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags2&SMF2_SHOWTYPINGCLIST)) { - MIRANDASYSTRAYNOTIFY tn; - tn.szProto = NULL; - tn.cbSize = sizeof(tn); - tn.tszInfoTitle = TranslateT("Typing Notification"); - tn.tszInfo = szTip; - tn.dwInfoFlags = NIIF_INFO | NIIF_INTERN_UNICODE; - tn.uTimeout = 1000 * 4; - CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM) & tn); - } - else { - CLISTEVENT cle = {0}; - - cle.cbSize = sizeof(cle); - cle.hContact = (HANDLE) wParam; - cle.hDbEvent = (HANDLE) 1; - cle.flags = CLEF_ONLYAFEW | CLEF_TCHAR; - cle.hIcon = GetCachedIcon("scriver_TYPING"); - cle.pszService = "SRMsg/TypingMessage"; - cle.ptszTooltip = szTip; - CallServiceSync(MS_CLIST_REMOVEEVENT, wParam, (LPARAM) 1); - CallServiceSync(MS_CLIST_ADDEVENT, wParam, (LPARAM) & cle); - } - } - return 0; + HWND hwnd; + + if (!(g_dat.flags2&SMF2_SHOWTYPING)) + return 0; + if ((hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam))) { + SendMessage(hwnd, DM_TYPING, 0, lParam); + } else if ((int) lParam && (g_dat.flags2&SMF2_SHOWTYPINGTRAY)) { + TCHAR szTip[256]; + + mir_sntprintf(szTip, SIZEOF(szTip), TranslateT("%s is typing a message"), (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR)); + if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags2&SMF2_SHOWTYPINGCLIST)) { + MIRANDASYSTRAYNOTIFY tn; + tn.szProto = NULL; + tn.cbSize = sizeof(tn); + tn.tszInfoTitle = TranslateT("Typing Notification"); + tn.tszInfo = szTip; + tn.dwInfoFlags = NIIF_INFO | NIIF_INTERN_UNICODE; + tn.uTimeout = 1000 * 4; + CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)& tn); + } + else { + CLISTEVENT cle = {0}; + + cle.cbSize = sizeof(cle); + cle.hContact = (HANDLE)wParam; + cle.hDbEvent = (HANDLE)1; + cle.flags = CLEF_ONLYAFEW | CLEF_TCHAR; + cle.hIcon = GetCachedIcon("scriver_TYPING"); + cle.pszService = "SRMsg/TypingMessage"; + cle.ptszTooltip = szTip; + CallServiceSync(MS_CLIST_REMOVEEVENT, wParam, (LPARAM)1); + CallServiceSync(MS_CLIST_ADDEVENT, wParam, (LPARAM)& cle); + } + } + return 0; } static int MessageSettingChanged(WPARAM wParam, LPARAM lParam) { - DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; - char *szProto = GetContactProto((HANDLE)wParam); - if (lstrcmpA(cws->szModule, "CList") && (szProto == NULL || lstrcmpA(cws->szModule, szProto))) - return 0; - WindowList_Broadcast(g_dat.hMessageWindowList, DM_CLISTSETTINGSCHANGED, wParam, lParam); - return 0; + DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; + char *szProto = GetContactProto((HANDLE)wParam); + if (lstrcmpA(cws->szModule, "CList") && (szProto == NULL || lstrcmpA(cws->szModule, szProto))) + return 0; + WindowList_Broadcast(g_dat.hMessageWindowList, DM_CLISTSETTINGSCHANGED, wParam, lParam); + return 0; } static int ContactDeleted(WPARAM wParam, LPARAM lParam) { - HWND hwnd; + HWND hwnd; - if ((hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE) wParam))) { - SendMessage(hwnd, WM_CLOSE, 0, 0); - } - return 0; + if ((hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam))) { + SendMessage(hwnd, WM_CLOSE, 0, 0); + } + return 0; } static void RestoreUnreadMessageAlerts(void) { - TCHAR toolTip[256]; + TCHAR toolTip[256]; DBEVENTINFO dbei = { sizeof(dbei) }; CLISTEVENT cle = { sizeof(cle) }; - cle.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); - cle.pszService = "SRMsg/ReadMessage"; - cle.flags = CLEF_TCHAR; - cle.ptszTooltip = toolTip; - - HANDLE hContact = db_find_first(); - while (hContact) { - HANDLE hDbEvent = db_event_firstUnread(hContact); - while (hDbEvent) { - dbei.cbBlob = 0; - db_event_get(hDbEvent, &dbei); - if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && DbEventIsMessageOrCustom(&dbei)) { - int windowAlreadyExists = WindowList_Find(g_dat.hMessageWindowList, hContact) != NULL; - if (windowAlreadyExists) - continue; + cle.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); + cle.pszService = "SRMsg/ReadMessage"; + cle.flags = CLEF_TCHAR; + cle.ptszTooltip = toolTip; + + HANDLE hContact = db_find_first(); + while (hContact) { + HANDLE hDbEvent = db_event_firstUnread(hContact); + while (hDbEvent) { + dbei.cbBlob = 0; + db_event_get(hDbEvent, &dbei); + if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && DbEventIsMessageOrCustom(&dbei)) { + int windowAlreadyExists = WindowList_Find(g_dat.hMessageWindowList, hContact) != NULL; + if (windowAlreadyExists) + continue; if (IsAutoPopup(hContact) && !windowAlreadyExists) { NewMessageWindowLParam newData = { 0 }; newData.hContact = hContact; newData.flags = NMWLP_INCOMING; HWND hParent = GetParentWindow(newData.hContact, FALSE); - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), hParent, DlgProcMessage, (LPARAM) & newData); + CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), hParent, DlgProcMessage, (LPARAM)& newData); } else { cle.hContact = hContact; cle.hDbEvent = hDbEvent; mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR)); - CallService(MS_CLIST_ADDEVENT, 0, (LPARAM) & cle); + CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)& cle); } } hDbEvent = db_event_next(hDbEvent); - } - hContact = db_find_next(hContact); - } + } + hContact = db_find_next(hContact); + } } static INT_PTR GetWindowAPI(WPARAM wParam, LPARAM lParam) { - return PLUGIN_MAKE_VERSION(0,0,0,3); + return PLUGIN_MAKE_VERSION(0,0,0,3); } static INT_PTR GetWindowClass(WPARAM wParam, LPARAM lParam) { - char *szBuf = (char*)wParam; - int size = (int)lParam; - mir_snprintf(szBuf, size, "Scriver"); - return 0; + char *szBuf = (char*)wParam; + int size = (int)lParam; + mir_snprintf(szBuf, size, "Scriver"); + return 0; } static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) { - MessageWindowInputData *mwid = (MessageWindowInputData*)wParam; - MessageWindowData *mwd = (MessageWindowData*)lParam; - HWND hwnd; + MessageWindowInputData *mwid = (MessageWindowInputData*)wParam; + MessageWindowData *mwd = (MessageWindowData*)lParam; + HWND hwnd; if (mwid == NULL || mwd == NULL) return 1; if (mwid->cbSize != sizeof(MessageWindowInputData) || mwd->cbSize != sizeof(SrmmWindowData)) return 1; @@ -369,101 +340,93 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) return 0; } -static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { +static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) +{ HANDLE hContact = (HANDLE)wParam; - if ( hContact ) { - char* szProto = GetContactProto(hContact); - - CLISTMENUITEM clmi = { sizeof(clmi) }; - clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN; - - if ( szProto ) { - // leave this menu item hidden for chats - if ( !db_get_b( hContact, szProto, "ChatRoom", 0 )) - if ( CallProtoService( szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND ) - clmi.flags &= ~CMIF_HIDDEN; - } + if (hContact == 0) + return 0; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMsgMenuItem, ( LPARAM )&clmi ); + bool bEnabled = false; + char *szProto = GetContactProto(hContact); + if ( szProto ) { + // leave this menu item hidden for chats + if ( !db_get_b(hContact, szProto, "ChatRoom", 0)) + if ( CallProtoService( szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) + bEnabled = true; } + + Menu_ShowItem(hMsgMenuItem, bEnabled); return 0; } -static int AvatarChanged(WPARAM wParam, LPARAM lParam) { - if (wParam == 0) { // protocol picture has changed... - WindowList_Broadcast(g_dat.hMessageWindowList, DM_AVATARCHANGED, wParam, lParam); - } else { - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam); - SendMessage(hwnd, DM_AVATARCHANGED, wParam, lParam); - } - return 0; +static int AvatarChanged(WPARAM wParam, LPARAM lParam) +{ + if (wParam == 0) // protocol picture has changed... + WindowList_Broadcast(g_dat.hMessageWindowList, DM_AVATARCHANGED, wParam, lParam); + else { + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam); + SendMessage(hwnd, DM_AVATARCHANGED, wParam, lParam); + } + return 0; } -static void RegisterStatusIcons() { - StatusIconData sid; - sid.cbSize = sizeof(sid); +static void RegisterStatusIcons() +{ + StatusIconData sid = { sizeof(sid) }; sid.szModule = SRMMMOD; - sid.dwId = 1; sid.hIcon = CopyIcon(GetCachedIcon("scriver_TYPING")); sid.hIconDisabled = CopyIcon(GetCachedIcon("scriver_TYPINGOFF")); sid.flags = MBF_HIDDEN; sid.szTooltip = NULL; - AddStickyStatusIcon((WPARAM) 0, (LPARAM) &sid); + AddStickyStatusIcon((WPARAM) 0, (LPARAM)&sid); } -void ChangeStatusIcons() { - StatusIconData sid; - sid.cbSize = sizeof(sid); +void ChangeStatusIcons() +{ + StatusIconData sid = { sizeof(sid) }; sid.szModule = SRMMMOD; - sid.dwId = 0; sid.hIcon = CopyIcon(GetCachedIcon("scriver_UNICODEON")); sid.hIconDisabled = CopyIcon(GetCachedIcon("scriver_UNICODEOFF")); - sid.flags = 0; - sid.szTooltip = NULL; - ModifyStatusIcon(0, (LPARAM) &sid); + ModifyStatusIcon(0, (LPARAM)&sid); sid.dwId = 1; sid.hIcon = CopyIcon(GetCachedIcon("scriver_TYPING")); sid.hIconDisabled = CopyIcon(GetCachedIcon("scriver_TYPINGOFF")); sid.flags = MBF_HIDDEN; - sid.szTooltip = NULL; - ModifyStatusIcon(0, (LPARAM) &sid); + ModifyStatusIcon(0, (LPARAM)&sid); } -int StatusIconPressed(WPARAM wParam, LPARAM lParam) { -// HANDLE hContact = (HANDLE) wParam; +int StatusIconPressed(WPARAM wParam, LPARAM lParam) +{ StatusIconClickData *sicd = (StatusIconClickData *) lParam; HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam); - if (hwnd == NULL) { + if (hwnd == NULL) hwnd = SM_FindWindowByContact((HANDLE)wParam); - } if (hwnd != NULL) { if (!strcmp(SRMMMOD, sicd->szModule)) { if (sicd->dwId == 0 && g_dat.hMenuANSIEncoding) { if (sicd->flags & MBCF_RIGHTBUTTON) { int codePage = (int) SendMessage(hwnd, DM_GETCODEPAGE, 0, 0); if (codePage != 1200) { - int i, iSel; - for (i = 0; i < GetMenuItemCount(g_dat.hMenuANSIEncoding); i++) { + for (int i = 0; i < GetMenuItemCount(g_dat.hMenuANSIEncoding); i++) CheckMenuItem (g_dat.hMenuANSIEncoding, i, MF_BYPOSITION | MF_UNCHECKED); - } - if (codePage == CP_ACP) { + + if (codePage == CP_ACP) CheckMenuItem(g_dat.hMenuANSIEncoding, 0, MF_BYPOSITION | MF_CHECKED); - } else { + else CheckMenuItem(g_dat.hMenuANSIEncoding, codePage, MF_BYCOMMAND | MF_CHECKED); - } - iSel = TrackPopupMenu(g_dat.hMenuANSIEncoding, TPM_RETURNCMD, sicd->clickLocation.x, sicd->clickLocation.y, 0, GetParent(hwnd), NULL); + + int iSel = TrackPopupMenu(g_dat.hMenuANSIEncoding, TPM_RETURNCMD, sicd->clickLocation.x, sicd->clickLocation.y, 0, GetParent(hwnd), NULL); if (iSel >= 500) { if (iSel == 500) iSel = CP_ACP; SendMessage(hwnd, DM_SETCODEPAGE, 0, iSel); } } } - } else { - SendMessage(hwnd, DM_SWITCHTYPING, 0, 0); } + else SendMessage(hwnd, DM_SWITCHTYPING, 0, 0); } } return 0; @@ -535,18 +498,18 @@ int OnUnloadModule(void) return 0; } -int OnLoadModule(void) { - HMODULE hDLL = 0; +int OnLoadModule(void) +{ if (LoadLibraryA("riched20.dll") == NULL) { - if (IDYES != - MessageBox(0, - TranslateT - ("Miranda could not load the built-in message module, riched20.dll is missing. If you are using Windows 95 or WINE please make sure you have riched20.dll installed. Press 'Yes' to continue loading Miranda."), - TranslateT("Information"), MB_YESNO | MB_ICONINFORMATION)) + if (IDYES != MessageBox(0, + TranslateT + ("Miranda could not load the built-in message module, riched20.dll is missing. If you are using Windows 95 or WINE please make sure you have riched20.dll installed. Press 'Yes' to continue loading Miranda."), + TranslateT("Information"), MB_YESNO | MB_ICONINFORMATION)) return 1; return 0; } - hDLL = GetModuleHandle(_T("user32")); + + HMODULE hDLL = GetModuleHandle(_T("user32")); pSetLayeredWindowAttributes = (PSLWA) GetProcAddress(hDLL,"SetLayeredWindowAttributes"); InitGlobals(); @@ -587,7 +550,6 @@ int OnLoadModule(void) { hCurHyperlinkHand = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_HYPERLINKHAND)); hDragCursor = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_DRAGCURSOR)); - Chat_Load(); return 0; } @@ -602,9 +564,9 @@ STDMETHODIMP CREOleCallback::QueryInterface(REFIID riid, LPVOID * ppvObj) *ppvObj = this; AddRef(); return S_OK; - } - *ppvObj = NULL; - return E_NOINTERFACE; + } + *ppvObj = NULL; + return E_NOINTERFACE; } STDMETHODIMP_(ULONG) CREOleCallback::AddRef() @@ -680,4 +642,4 @@ STDMETHODIMP CREOleCallback::QueryInsertObject(LPCLSID lpclsid, LPSTORAGE lpstg, STDMETHODIMP CREOleCallback::ShowContainerUI(BOOL fShow) { return S_OK; -} \ No newline at end of file +} diff --git a/plugins/Scriver/src/msgtimedout.cpp b/plugins/Scriver/src/msgtimedout.cpp index dc9bfbfd1c..d185ce1900 100644 --- a/plugins/Scriver/src/msgtimedout.cpp +++ b/plugins/Scriver/src/msgtimedout.cpp @@ -64,11 +64,11 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: - SendMessage(ewd->hwndParent, DM_ERRORDECIDED, MSGERROR_RETRY, (LPARAM) ewd->queueItem); + SendMessage(ewd->hwndParent, DM_ERRORDECIDED, MSGERROR_RETRY, (LPARAM)ewd->queueItem); DestroyWindow(hwndDlg); break; case IDCANCEL: - SendMessage(ewd->hwndParent, DM_ERRORDECIDED, MSGERROR_CANCEL, (LPARAM) ewd->queueItem); + SendMessage(ewd->hwndParent, DM_ERRORDECIDED, MSGERROR_CANCEL, (LPARAM)ewd->queueItem); DestroyWindow(hwndDlg); break; } diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index c8f32696a2..186a832f3a 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -60,7 +60,7 @@ TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto) tokens[0] = GetNickname(hContact, szProto); tokenLen[0] = lstrlen(tokens[0]); tokens[1] = mir_tstrdup((TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto ? - DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE) : ID_STATUS_OFFLINE, GSMDF_TCHAR)); + db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) : ID_STATUS_OFFLINE, GSMDF_TCHAR)); tokenLen[1] = lstrlen(tokens[1]); tokens[2] = DBGetStringT(hContact, "CList", "StatusMsg"); if (tokens[2] != NULL) { @@ -245,7 +245,7 @@ static void GetMinimunWindowSize(ParentWindowData *dat, SIZE *size) GetChildWindowRect(dat, &rc); for (i=0;ichildrenCount;i++) { MessageWindowTabData * mwtd = GetChildFromTab(dat->hwndTabs, i); - SendMessage(mwtd->hwnd, WM_GETMINMAXINFO, 0, (LPARAM) &mmi); + SendMessage(mwtd->hwnd, WM_GETMINMAXINFO, 0, (LPARAM)&mmi); if (i==0 || mmi.ptMinTrackSize.x > minW) minW = mmi.ptMinTrackSize.x; if (i==0 || mmi.ptMinTrackSize.y > minH) minH = mmi.ptMinTrackSize.y; } @@ -268,7 +268,7 @@ static void SetupStatusBar(ParentWindowData *dat) statwidths[1] = rc.right - rc.left - SB_UNICODE_WIDTH - 2 * (statusIconNum > 0) - statusIconNum * (GetSystemMetrics(SM_CXSMICON) + 2); statwidths[2] = rc.right - rc.left - SB_UNICODE_WIDTH; statwidths[3] = -1; - SendMessage(dat->hwndStatus, SB_SETPARTS, 4, (LPARAM) statwidths); + SendMessage(dat->hwndStatus, SB_SETPARTS, 4, (LPARAM)statwidths); SendMessage(dat->hwndStatus, SB_SETTEXT, (WPARAM)(SBT_OWNERDRAW) | 2, 0); SendMessage(dat->hwndStatus, SB_SETTEXT, (WPARAM)(SBT_NOBORDERS) | 3, 0); } @@ -350,7 +350,7 @@ static void AddChild(ParentWindowData *dat, HWND hwnd, HANDLE hContact) mwtd->parent = dat; dat->childrenCount++; tci.mask = TCIF_PARAM | TCIF_IMAGE | TCIF_TEXT; - tci.lParam = (LPARAM) mwtd; + tci.lParam = (LPARAM)mwtd; tci.iImage = -1; tci.pszText = _T(""); tabId = TabCtrl_InsertItem(dat->hwndTabs, dat->childrenCount-1, &tci); @@ -514,7 +514,7 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetWindowPos(hwndDlg, 0, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_HIDEWINDOW); if (!savePerContact && db_get_b(NULL, SRMMMOD, SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE)) - WindowList_Broadcast(g_dat.hParentWindowList, DM_CASCADENEWWINDOW, (WPARAM) hwndDlg, (LPARAM) &dat->windowWasCascaded); + WindowList_Broadcast(g_dat.hParentWindowList, DM_CASCADENEWWINDOW, (WPARAM) hwndDlg, (LPARAM)&dat->windowWasCascaded); hMenu = GetSystemMenu( hwndDlg, FALSE ); InsertMenu( hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, NULL ); @@ -627,7 +627,7 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } case WM_COMMAND: - if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM) dat->hContact)) + if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact)) break; if ( LOWORD(wParam) == IDCANCEL) @@ -681,7 +681,7 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CloseOtherChilden(dat, mwtd->hwnd); break; default: - CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(menuResult), MPCF_CONTACTMENU), (LPARAM) mwtd->hContact); + CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(menuResult), MPCF_CONTACTMENU), (LPARAM)mwtd->hContact); } if (hUserMenu != NULL) { DestroyMenu(hUserMenu); @@ -912,7 +912,7 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ShowWindow(hwndDlg, SW_SHOWMINNOACTIVE); if (dat->childrenCount == 1 || ((g_dat.flags2 & SMF2_SWITCHTOACTIVE) && (IsIconic(hwndDlg) || GetForegroundWindow() != hwndDlg))) - SendMessage(hwndDlg, CM_ACTIVATECHILD, 0, (LPARAM) lParam); + SendMessage(hwndDlg, CM_ACTIVATECHILD, 0, (LPARAM)lParam); } else { ShowWindow(hwndDlg, IsIconic(hwndDlg) ? SW_SHOWNORMAL : SW_SHOWNA); @@ -1002,9 +1002,9 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } } if (tbd->iFlags & TBDF_ICON) { - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) tbd->hIcon); + SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)tbd->hIcon); if (tbd->hIconBig != NULL) { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) tbd->hIconBig); + SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)tbd->hIconBig); } if (pTaskbarInterface) pTaskbarInterface->SetOverlayIcon(hwndDlg, tbd->hIconNot, L""); @@ -1018,10 +1018,10 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR StatusBarData *sbd = (StatusBarData *) wParam; if (sbd != NULL) { if ((sbd->iFlags & SBDF_TEXT) && dat->hwndActive == hwnd) { - SendMessage(dat->hwndStatus, SB_SETTEXT, sbd->iItem, (LPARAM) sbd->pszText); + SendMessage(dat->hwndStatus, SB_SETTEXT, sbd->iItem, (LPARAM)sbd->pszText); } if ((sbd->iFlags & SBDF_ICON) && dat->hwndActive == hwnd) { - SendMessage(dat->hwndStatus, SB_SETICON, sbd->iItem, (LPARAM) sbd->hIcon); + SendMessage(dat->hwndStatus, SB_SETICON, sbd->iItem, (LPARAM)sbd->hIcon); } RedrawWindow(dat->hwndStatus, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); } @@ -1377,7 +1377,7 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) HMONITOR hMonitor; RECT rc, rcDesktop; newData.hContact = hContact; - hParent = (HWND)CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGWIN), NULL, DlgProcParentWindow, (LPARAM) & newData); + hParent = (HWND)CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGWIN), NULL, DlgProcParentWindow, (LPARAM)& newData); GetWindowRect(hParent, &rc); rc.right = (rc.right - rc.left); rc.bottom = (rc.bottom - rc.top); @@ -1399,11 +1399,11 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) NotifyLocalWinEvent(hContact, hChild, MSG_WINDOW_EVT_CLOSING); NotifyLocalWinEvent(hContact, hChild, MSG_WINDOW_EVT_CLOSE); SetParent(hChild, hParent); - SendMessage(GetParent(hwnd), CM_REMOVECHILD, 0, (LPARAM) hChild); - SendMessage(hChild, DM_SETPARENT, 0, (LPARAM) hParent); - SendMessage(hParent, CM_ADDCHILD, (WPARAM)hChild, (LPARAM) hContact); + SendMessage(GetParent(hwnd), CM_REMOVECHILD, 0, (LPARAM)hChild); + SendMessage(hChild, DM_SETPARENT, 0, (LPARAM)hParent); + SendMessage(hParent, CM_ADDCHILD, (WPARAM)hChild, (LPARAM)hContact); SendMessage(hChild, DM_UPDATETABCONTROL, 0, 0); - SendMessage(hParent, CM_ACTIVATECHILD, 0, (LPARAM) hChild); + SendMessage(hParent, CM_ACTIVATECHILD, 0, (LPARAM)hChild); NotifyLocalWinEvent(hContact, hChild, MSG_WINDOW_EVT_OPENING); NotifyLocalWinEvent(hContact, hChild, MSG_WINDOW_EVT_OPEN); ShowWindow(hParent, SW_SHOWNA); @@ -1601,5 +1601,5 @@ HWND GetParentWindow(HANDLE hContact, BOOL bChat) { if (!(g_dat.flags2 & SMF2_SEPARATECHATSCONTAINERS)) { newData.isChat =FALSE; } - return CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGWIN), NULL, DlgProcParentWindow, (LPARAM) & newData); + return CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGWIN), NULL, DlgProcParentWindow, (LPARAM)& newData); } diff --git a/plugins/Scriver/src/sendqueue.cpp b/plugins/Scriver/src/sendqueue.cpp index de081b0776..6367999a44 100644 --- a/plugins/Scriver/src/sendqueue.cpp +++ b/plugins/Scriver/src/sendqueue.cpp @@ -219,5 +219,5 @@ void SendSendQueueItem(MessageSendQueueItem* item) { } // logInfo(" item sent [%s] next: [%s] prev: [%s]", item->sendBuffer, item->next != NULL ? item->next->sendBuffer : "", item->prev != NULL ? item->prev->sendBuffer : ""); LeaveCriticalSection(&queueMutex); - item->hSendId = (HANDLE) CallContactService(item->hContact, MsgServiceName(item->hContact), item->flags, (LPARAM) item->sendBuffer); + item->hSendId = (HANDLE)CallContactService(item->hContact, MsgServiceName(item->hContact), item->flags, (LPARAM)item->sendBuffer); } diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index 1963baafd9..d445914a4f 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -158,7 +158,7 @@ TCHAR *GetRichText(HWND hwnd, int codepage) { gt.cb = textBufferSize; gt.flags = GT_USECRLF; gt.codepage = codepage; - SendMessage(hwnd, EM_GETTEXTEX, (WPARAM) >, (LPARAM) textBuffer); + SendMessage(hwnd, EM_GETTEXTEX, (WPARAM) >, (LPARAM)textBuffer); } return textBuffer; } @@ -315,7 +315,7 @@ TCHAR *GetRichEditSelection(HWND hwnd) dwFlags = SF_TEXT|SF_UNICODE|SFF_SELECTION; msi.sendBuffer = NULL; msi.sendBufferSize = 0; - SendMessage(hwnd, EM_STREAMOUT, (WPARAM)dwFlags, (LPARAM) & stream); + SendMessage(hwnd, EM_STREAMOUT, (WPARAM)dwFlags, (LPARAM)& stream); return (TCHAR *)msi.sendBuffer; } return NULL; @@ -461,7 +461,7 @@ void SearchWord(TCHAR * word, int engine) break; } - CallService(MS_UTILS_OPENURL, 1, (LPARAM) szURL); + CallService(MS_UTILS_OPENURL, 1, (LPARAM)szURL); } } @@ -484,7 +484,7 @@ void GetContactUniqueId(struct SrmmWindowData *dat, char *buf, int maxlen) { ci.szProto = dat->szProto; ci.dwFlag = CNF_UNIQUEID; buf[0] = 0; - if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) { + if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)& ci)) { switch (ci.type) { case CNFT_ASCIIZ: mir_snprintf(buf, maxlen, "%s", ci.pszVal); @@ -515,7 +515,7 @@ HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle, RECT* rec ti.hinst = g_hInst; ti.lpszText = ptszText; ti.rect = *rect; - SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); + SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM)(LPTOOLINFO) &ti); SendMessage(hwndTT, TTM_SETTITLE, TTI_NONE, (LPARAM)ptszTitle); return hwndTT; } @@ -526,7 +526,7 @@ void SetToolTipText(HWND hwndParent, HWND hwndTT, LPTSTR ptszText, LPTSTR ptszTi ti.hinst = g_hInst; ti.hwnd = hwndParent; ti.lpszText = ptszText; - SendMessage(hwndTT, TTM_UPDATETIPTEXT, 0, (LPARAM) (LPTOOLINFO) &ti); + SendMessage(hwndTT, TTM_UPDATETIPTEXT, 0, (LPARAM)(LPTOOLINFO) &ti); SendMessage(hwndTT, TTM_SETTITLE, TTI_NONE, (LPARAM)ptszTitle); } @@ -537,7 +537,7 @@ void SetToolTipRect(HWND hwndParent, HWND hwndTT, RECT* rect) ti.hinst = g_hInst; ti.hwnd = hwndParent; ti.rect = *rect; - SendMessage(hwndTT, TTM_NEWTOOLRECT, 0, (LPARAM) (LPTOOLINFO) &ti); + SendMessage(hwndTT, TTM_NEWTOOLRECT, 0, (LPARAM)(LPTOOLINFO) &ti); } /* toolbar-related stuff, to be moved to a separate file */ diff --git a/plugins/StatusPlugins/commonstatus.cpp b/plugins/StatusPlugins/commonstatus.cpp index c788042af3..40fe36365d 100644 --- a/plugins/StatusPlugins/commonstatus.cpp +++ b/plugins/StatusPlugins/commonstatus.cpp @@ -248,7 +248,7 @@ INT_PTR SetStatusEx(WPARAM wParam, LPARAM lParam) things get messy because SRAway hooks ME_CLIST_STATUSMODECHANGE, so the status messages of SRAway and commonstatus will clash */ - NotifyEventHooks( hCSStatusChangedExEvent, ( WPARAM )&protoSettings, 0 ); + NotifyEventHooks(hCSStatusChangedExEvent, (WPARAM)&protoSettings, 0); // set all status messages first for (int i=0; i < protoList->getCount(); i++) { diff --git a/plugins/TabSRMM/src/chat/clist.cpp b/plugins/TabSRMM/src/chat/clist.cpp index 5506aa5cad..18172a2e01 100644 --- a/plugins/TabSRMM/src/chat/clist.cpp +++ b/plugins/TabSRMM/src/chat/clist.cpp @@ -194,7 +194,7 @@ INT_PTR CList_JoinChat(WPARAM wParam, LPARAM lParam) if ( hContact ) { char* szProto = GetContactProto(hContact); if ( szProto ) { - if ( DBGetContactSettingWord( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE ) + if ( db_get_w( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE ) CallProtoService( szProto, PS_JOINCHAT, wParam, lParam ); else CList_RoomDoubleclicked( wParam, 0 ); @@ -217,31 +217,28 @@ INT_PTR CList_LeaveChat(WPARAM wParam, LPARAM lParam) int CList_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { HANDLE hContact = (HANDLE)wParam; - if ( hContact ) { - char* szProto = GetContactProto(hContact); + if (hContact == NULL) + return 0; - CLISTMENUITEM clmi = { sizeof(clmi) }; - clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN; + bool bEnabled = false; + char *szProto = GetContactProto(hContact); + if ( szProto ) { + // display this menu item only for chats + if ( M->GetByte(hContact, szProto, "ChatRoom", 0 )) { + // still hide it for offline protos + if (CallProtoService( szProto, PS_GETSTATUS, 0, 0 ) != ID_STATUS_OFFLINE) { + CLISTMENUITEM clmi = { sizeof(clmi) }; + clmi.flags = CMIM_NAME; + if (db_get_w( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE) + clmi.pszName = (char*)LPGEN("Join chat"); + else + clmi.pszName = (char*)LPGEN("Open chat window"); + Menu_ModifyItem(hJoinMenuItem, &clmi); + bEnabled = true; + } } } - if ( szProto ) { - // display this menu item only for chats - if ( M->GetByte(hContact, szProto, "ChatRoom", 0 )) { - // still hide it for offline protos - if ( CallProtoService( szProto, PS_GETSTATUS, 0, 0 ) != ID_STATUS_OFFLINE ) { - clmi.flags &= ~CMIF_HIDDEN; - clmi.flags |= CMIM_NAME; - - if ( DBGetContactSettingWord( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE ) - clmi.pszName = ( char* )LPGEN("Join chat"); - else - clmi.pszName = ( char* )LPGEN("Open chat window"); - } } } - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hJoinMenuItem, ( LPARAM )&clmi ); - - clmi.flags &= ~(CMIM_NAME | CMIF_DEFAULT); - clmi.flags |= CMIF_NOTOFFLINE; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hLeaveMenuItem, ( LPARAM )&clmi ); - } + Menu_ShowItem(hJoinMenuItem, bEnabled); + Menu_ShowItem(hLeaveMenuItem, bEnabled); return 0; } @@ -250,7 +247,6 @@ INT_PTR CList_PrebuildContactMenuSvc(WPARAM wParam, LPARAM lParam) return CList_PrebuildContactMenu(wParam, lParam); } - void CList_CreateGroup(TCHAR* group) { if (!group) diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index c3a1ada839..bcd2cc9452 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -40,7 +40,8 @@ CRITICAL_SECTION cs; HANDLE hSendEvent; HANDLE hBuildMenuEvent; -HANDLE hJoinMenuItem, hLeaveMenuItem; + +HGENMENU hJoinMenuItem, hLeaveMenuItem; static HANDLE hServiceRegister = NULL, @@ -458,8 +459,8 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT else lstrcpyn(newcontactname, _T("_U_"), SIZEOF(newcontactname)); char *szProto = GetContactProto(newData.hContact); - WORD wStatus = szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord((HANDLE) newData.hContact, szProto, "Status", ID_STATUS_OFFLINE); - char *szStatus = (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord((HANDLE)newData.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0); + WORD wStatus = szProto == NULL ? ID_STATUS_OFFLINE : db_get_w((HANDLE) newData.hContact, szProto, "Status", ID_STATUS_OFFLINE); + char *szStatus = (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w((HANDLE)newData.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0); newData.item.pszText = newcontactname; newData.item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM; diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index a18b760cc8..d424e03f78 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -287,7 +287,7 @@ static void Chat_UpdateWindowState(TWindowData *dat, UINT msg) dat->hTabIcon = dat->hTabStatusIcon; if (dat->iTabID >= 0) { - if (DBGetContactSettingWord(si->hContact, si->pszModule , "ApparentMode", 0) != 0) + if (db_get_w(si->hContact, si->pszModule , "ApparentMode", 0) != 0) DBWriteContactSettingWord(si->hContact, si->pszModule , "ApparentMode", (LPARAM)0); if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0)) CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)szChatIconString); diff --git a/plugins/TabSRMM/src/commonheaders.h b/plugins/TabSRMM/src/commonheaders.h index be9094e797..8b2bdf2609 100644 --- a/plugins/TabSRMM/src/commonheaders.h +++ b/plugins/TabSRMM/src/commonheaders.h @@ -265,7 +265,7 @@ extern const TCHAR *pszIDCSAVE_save, *pszIDCSAVE_close; extern char *TemplateNames[]; extern HANDLE hUserPrefsWindowList; extern struct TCpTable cpTable[]; -extern HANDLE hJoinMenuItem, hLeaveMenuItem; +extern HGENMENU hJoinMenuItem, hLeaveMenuItem; extern FONTINFO aFonts[OPTIONS_FONTCOUNT]; extern TCHAR *pszActiveWndID; extern char *pszActiveWndModule; diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 28ae75bb1d..74238bb783 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -148,14 +148,12 @@ bool CContactCache::updateNick() */ bool CContactCache::updateStatus() { - if (m_Valid) { - m_wOldStatus = m_wStatus; - m_wStatus = (WORD)DBGetContactSettingWord(m_hContact, m_szProto, "Status", ID_STATUS_OFFLINE); + if (!m_Valid) + return false; - return(m_wOldStatus != m_wStatus); - } - else - return(false); + m_wOldStatus = m_wStatus; + m_wStatus = (WORD)db_get_w(m_hContact, m_szProto, "Status", ID_STATUS_OFFLINE); + return m_wOldStatus != m_wStatus; } /** @@ -174,7 +172,7 @@ void CContactCache::updateMeta(bool fForce) PROTOACCOUNT *acc = reinterpret_cast(::CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)m_szMetaProto)); if (acc && acc->tszAccountName) m_szAccount = acc->tszAccountName; - m_wMetaStatus = DBGetContactSettingWord(m_hSubContact, m_szMetaProto, "Status", ID_STATUS_OFFLINE); + m_wMetaStatus = db_get_w(m_hSubContact, m_szMetaProto, "Status", ID_STATUS_OFFLINE); MultiByteToWideChar(CP_ACP, 0, m_szMetaProto, -1, m_tszMetaProto, 40); m_tszMetaProto[39] = 0; } diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index d28e8c7625..5e96b41fa4 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -2546,7 +2546,7 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg) if ((handle = (HANDLE)M->GetDword(dat->hContact, PluginConfig.szMetaName, szTemp, 0)) != 0) { nick = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)handle, GCDNF_TCHAR); mir_snprintf(szTemp, sizeof(szTemp), "Status%d", i); - wStatus = (WORD)DBGetContactSettingWord(dat->hContact, PluginConfig.szMetaName, szTemp, 0); + wStatus = (WORD)db_get_w(dat->hContact, PluginConfig.szMetaName, szTemp, 0); szStatusText = (TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, wStatus, GSMDF_TCHAR); } mir_sntprintf(szMenuLine, SIZEOF(szMenuLine), _T("%s: %s [%s] %s"), acc->tszAccountName, nick, szStatusText, diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index dddc88f579..ee0bd16407 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -805,7 +805,7 @@ int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szPro if (tszFinalProto == 0) return 0; // should also NOT happen - wMyStatus = (wStatus == 0) ? DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE) : wStatus; + wMyStatus = (wStatus == 0) ? db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) : wStatus; szMyStatus = (szStatus == NULL) ? (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)wMyStatus, GSMDF_TCHAR) : szStatus; mii.wID = (UINT)hContact; mii.hbmpItem = HBMMENU_CALLBACK; diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index dc1ec8c84e..5cad2d5e0b 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1033,7 +1033,7 @@ void TSAPI DM_SetDBButtonStates(HWND hwndChild, struct TWindowData *dat) break; } case DBVT_WORD: { - WORD val = DBGetContactSettingWord(hFinalContact, szModule, szSetting, 0); + WORD val = db_get_w(hFinalContact, szModule, szSetting, 0); result = (val == *((WORD *) & buttonItem->bValuePush)); break; } @@ -1440,10 +1440,10 @@ void TSAPI DM_NotifyTyping(struct TWindowData *dat, int mode) * check visibility/invisibility lists to not "accidentially" send MTN to contacts who * should not see them (privacy issue) */ - if (protoCaps & PF1_VISLIST && DBGetContactSettingWord(hContact, szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE) + if (protoCaps & PF1_VISLIST && db_get_w(hContact, szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE) return; - if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && DBGetContactSettingWord(hContact, szProto, "ApparentMode", 0) != ID_STATUS_ONLINE) + if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(hContact, szProto, "ApparentMode", 0) != ID_STATUS_ONLINE) return; /* diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index e0fdecf406..38581de550 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -230,7 +230,7 @@ void CGlobals::reloadSettings(bool fReloadSkins) m_SendOnDblEnter = (int)M->GetByte("SendOnDblEnter", 0); m_AutoLocaleSupport = (int)M->GetByte("al", 0); m_AutoSwitchTabs = (int)M->GetByte("autoswitchtabs", 1); - m_CutContactNameTo = (int) DBGetContactSettingWord(NULL, SRMSGMOD_T, "cut_at", 15); + m_CutContactNameTo = (int)db_get_w(NULL, SRMSGMOD_T, "cut_at", 15); m_CutContactNameOnTabs = (int)M->GetByte("cuttitle", 0); m_StatusOnTabs = (int)M->GetByte("tabstatus", 1); m_LogStatusChanges = (int)M->GetByte("logstatuschanges", 0); diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 4e13942b16..344c9ef134 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -192,7 +192,7 @@ public: BYTE m_dontUseDefaultKbd; HANDLE hSvc[SERVICE_LAST]; HANDLE m_event_MsgWin, m_event_MsgPopup; - HANDLE m_hMenuItem; + HGENMENU m_hMenuItem; BYTE m_useAeroPeek; WINDOWPLACEMENT m_GlobalContainerWpos; diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 4deb632c9f..cc067fd278 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -647,20 +647,19 @@ int CMimAPI::ProtoAck(WPARAM wParam, LPARAM lParam) int CMimAPI::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { HANDLE hContact = (HANDLE)wParam; - if ( hContact ) { - CLISTMENUITEM clmi = { sizeof(clmi) }; - clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN; - - char *szProto = GetContactProto(hContact); - if ( szProto ) { - // leave this menu item hidden for chats - if ( !M->GetByte(hContact, szProto, "ChatRoom", 0 )) - if ( CallProtoService( szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND ) - clmi.flags &= ~CMIF_HIDDEN; - } - - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)PluginConfig.m_hMenuItem, (LPARAM)&clmi); + if (hContact == NULL) + return NULL; + + bool bEnabled = false; + char *szProto = GetContactProto(hContact); + if (szProto) { + // leave this menu item hidden for chats + if ( !M->GetByte(hContact, szProto, "ChatRoom", 0 )) + if ( CallProtoService( szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND ) + bEnabled = true; } + + Menu_ShowItem(PluginConfig.m_hMenuItem, bEnabled); return 0; } diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 5778442b2b..10c5b6fbbb 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1319,7 +1319,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat->cache->updateUIN(); if (dat->hContact && dat->szProto != NULL) { - dat->wStatus = DBGetContactSettingWord(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE); + dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE); mir_sntprintf(dat->szStatus, SIZEOF(dat->szStatus), _T("%s"), (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, dat->szProto == NULL ? ID_STATUS_OFFLINE : dat->wStatus, GSMDF_TCHAR)); } else dat->wStatus = ID_STATUS_OFFLINE; @@ -3362,7 +3362,7 @@ quote_from_last: if ((isForced = M->GetDword(dat->hContact, "tabSRMM_forced", -1)) >= 0) { char szTemp[64]; mir_snprintf(szTemp, sizeof(szTemp), "Status%d", isForced); - if (DBGetContactSettingWord(dat->hContact, PluginConfig.szMetaName, szTemp, 0) == ID_STATUS_OFFLINE) { + if (db_get_w(dat->hContact, PluginConfig.szMetaName, szTemp, 0) == ID_STATUS_OFFLINE) { TCHAR szBuffer[200]; mir_sntprintf(szBuffer, 200, TranslateT("Warning: you have selected a subprotocol for sending the following messages which is currently offline")); SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)szBuffer); diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 47ed9fc84d..c6ba4665cf 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -1399,7 +1399,7 @@ void TSAPI FindFirstEvent(TWindowData *dat) if (dat->bActualHistory) i = dat->cache->getSessionMsgCount(); else - i = DBGetContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT); + i = db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT); // for (; i > 0; i--) { if (dat->hDbEventFirst == NULL) @@ -1426,7 +1426,7 @@ void TSAPI FindFirstEvent(TWindowData *dat) dbei.timestamp = time(NULL); else db_event_get(dat->hDbEventFirst, &dbei); - firstTime = dbei.timestamp - 60 * DBGetContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME); + firstTime = dbei.timestamp - 60 * db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME); for (;;) { if (dat->hDbEventFirst == NULL) hPrevEvent = db_event_last(dat->hContact); @@ -2407,10 +2407,10 @@ void TSAPI SendHBitmapAsFile(const TWindowData* dat, HBITMAP hbmp) if ((ID_STATUS_OFFLINE == wMyStatus) || (ID_STATUS_OFFLINE == dat->cache->getActiveStatus() && !(typeCaps & PF4_OFFLINEFILES))) fSend = false; - if (protoCaps & PF1_VISLIST && DBGetContactSettingWord(dat->cache->getActiveContact(), szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE) + if (protoCaps & PF1_VISLIST && db_get_w(dat->cache->getActiveContact(), szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE) fSend = false; - if (protoCaps & PF1_INVISLIST && wMyStatus == ID_STATUS_INVISIBLE && DBGetContactSettingWord(dat->cache->getActiveContact(), szProto, "ApparentMode", 0) != ID_STATUS_ONLINE) + if (protoCaps & PF1_INVISLIST && wMyStatus == ID_STATUS_INVISIBLE && db_get_w(dat->cache->getActiveContact(), szProto, "ApparentMode", 0) != ID_STATUS_ONLINE) fSend = false; if (!fSend) { diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 0b3db15ff0..9fae10db4e 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -558,7 +558,7 @@ int TSAPI DbEventIsShown(struct TWindowData *dat, DBEVENTINFO * dbei) static int DbEventIsForMsgWindow(DBEVENTINFO *dbei) { - DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )CallService( MS_DB_EVENT_GETTYPE, ( WPARAM )dbei->szModule, ( LPARAM )dbei->eventType ); + DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType); return et && ( et->flags & DETF_MSGWINDOW ); } diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 3de3ae9d61..4392e11dc6 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -623,9 +623,9 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, } SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); - SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT)); + SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT)); SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETRANGE, 0, MAKELONG(24 * 60, 0)); - SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME)); + SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME)); SetDlgItemInt(hwndDlg, IDC_INDENTAMOUNT, M->GetDword("IndentAmount", 20), FALSE); SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 0)); @@ -1049,7 +1049,7 @@ static INT_PTR CALLBACK DlgProcTabbedOptions(HWND hwndDlg, UINT msg, WPARAM wPar CheckDlgButton(hwndDlg, IDC_CUT_TABTITLE, M->GetByte("cuttitle", 0)); SendDlgItemMessage(hwndDlg, IDC_CUT_TITLEMAXSPIN, UDM_SETRANGE, 0, MAKELONG(20, 5)); - SendDlgItemMessage(hwndDlg, IDC_CUT_TITLEMAXSPIN, UDM_SETPOS, 0, (WPARAM)DBGetContactSettingWord(NULL, SRMSGMOD_T, "cut_at", 15)); + SendDlgItemMessage(hwndDlg, IDC_CUT_TITLEMAXSPIN, UDM_SETPOS, 0, (WPARAM)db_get_w(NULL, SRMSGMOD_T, "cut_at", 15)); Utils::enableDlgControl(hwndDlg, IDC_CUT_TITLEMAX, IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE)); Utils::enableDlgControl(hwndDlg, IDC_CUT_TITLEMAXSPIN, IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE)); @@ -1399,7 +1399,7 @@ DWORD OptCheckBox_LoadValue(struct OptCheckBox *cb) case DBVT_BYTE: return M->GetByte(cb->dbModule, cb->dbSetting, cb->defValue); case DBVT_WORD: - return DBGetContactSettingWord(NULL, cb->dbModule, cb->dbSetting, cb->defValue); + return db_get_w(NULL, cb->dbModule, cb->dbSetting, cb->defValue); case DBVT_DWORD: return M->GetDword(cb->dbModule, cb->dbSetting, cb->defValue); } @@ -1521,9 +1521,9 @@ static INT_PTR CALLBACK DlgProcTabSrmmModernOptions(HWND hwndDlg, UINT msg, WPAR } SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); - SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT)); + SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT)); SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETRANGE, 0, MAKELONG(24 * 60, 0)); - SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME)); + SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME)); SendDlgItemMessage(hwndDlg, IDC_TRIMSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 5)); SendDlgItemMessage(hwndDlg, IDC_TRIMSPIN, UDM_SETPOS, 0, maxhist); diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp index 1684601ae2..212ba2d8b4 100644 --- a/plugins/TabSRMM/src/trayicon.cpp +++ b/plugins/TabSRMM/src/trayicon.cpp @@ -249,7 +249,7 @@ void TSAPI AddContactToFavorites(HANDLE hContact, const TCHAR *szNickname, const szProto = GetContactProto(hContact); if (szProto) { if (wStatus == 0) - wStatus = DBGetContactSettingWord((HANDLE)hContact, szProto, "Status", ID_STATUS_OFFLINE); + wStatus = db_get_w((HANDLE)hContact, szProto, "Status", ID_STATUS_OFFLINE); if (szStatus == NULL) szStatus = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, wStatus, GSMDF_TCHAR); } diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index a0e5509ed8..86b4c469be 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -46,7 +46,7 @@ void InsertSBut(int i) ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISSBUTTON | TTBBF_INTERNAL; ttb.wParamDown = i; - TTBAddButton(( WPARAM )&ttb, 0); + TTBAddButton((WPARAM)&ttb, 0); } void LoadAllSButs() @@ -83,7 +83,7 @@ void InsertLBut(int i) ttb.name = LPGEN("Default"); ttb.program = _T("Execute Path"); ttb.wParamDown = i; - TTBAddButton(( WPARAM )&ttb, 0); + TTBAddButton((WPARAM)&ttb, 0); } void LoadAllLButs() diff --git a/plugins/XSoundNotify/src/Common.h b/plugins/XSoundNotify/src/Common.h index edccbabc4f..3b5edc0daa 100644 --- a/plugins/XSoundNotify/src/Common.h +++ b/plugins/XSoundNotify/src/Common.h @@ -25,9 +25,9 @@ struct XSN_Data HANDLE hContact; TCHAR path[MAX_PATH]; -__inline XSN_Data(HANDLE _aContact, TCHAR *_path) : - hContact(_aContact) -{ - _tcsncpy(path, _path, SIZEOF(path)); -} + __forceinline XSN_Data(HANDLE _aContact, TCHAR *_path) : + hContact(_aContact) + { + _tcsncpy(path, _path, SIZEOF(path)); + } }; \ No newline at end of file -- cgit v1.2.3