summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-04-05 16:54:27 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-04-05 16:54:27 +0000
commitb665a90f50f09435aef5bc3b5b9da710e4558690 (patch)
tree3053606dcddc1b15f73e7af1fb2507afbf20f052
parent6c01981a8452577f3751298c7cdbe59b3ae81d51 (diff)
various menu items quirks, simplifications & optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@4319 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/AVS/src/main.cpp16
-rw-r--r--plugins/AuthState/src/main.cpp47
-rw-r--r--plugins/BuddyExpectator/src/BuddyExpectator.cpp11
-rw-r--r--plugins/FloatingContacts/src/main.cpp4
-rw-r--r--plugins/MirOTR/MirOTR/src/dllmain.cpp2
-rw-r--r--plugins/MirOTR/MirOTR/src/mirotrmenu.cpp4
-rw-r--r--plugins/MirOTR/MirOTR/src/utils.cpp4
-rw-r--r--plugins/Scriver/src/chat/clist.cpp221
-rw-r--r--plugins/Scriver/src/chat/log.cpp16
-rw-r--r--plugins/Scriver/src/chat/main.cpp2
-rw-r--r--plugins/Scriver/src/chat/manager.cpp6
-rw-r--r--plugins/Scriver/src/chat/options.cpp34
-rw-r--r--plugins/Scriver/src/chat/services.cpp16
-rw-r--r--plugins/Scriver/src/chat/tools.cpp4
-rw-r--r--plugins/Scriver/src/chat/window.cpp62
-rw-r--r--plugins/Scriver/src/globals.cpp2
-rw-r--r--plugins/Scriver/src/infobar.cpp4
-rw-r--r--plugins/Scriver/src/input.cpp6
-rw-r--r--plugins/Scriver/src/msgdialog.cpp82
-rw-r--r--plugins/Scriver/src/msglog.cpp24
-rw-r--r--plugins/Scriver/src/msgoptions.cpp20
-rw-r--r--plugins/Scriver/src/msgs.cpp474
-rw-r--r--plugins/Scriver/src/msgtimedout.cpp4
-rw-r--r--plugins/Scriver/src/msgwindow.cpp36
-rw-r--r--plugins/Scriver/src/sendqueue.cpp2
-rw-r--r--plugins/Scriver/src/utils.cpp14
-rw-r--r--plugins/StatusPlugins/commonstatus.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/clist.cpp46
-rw-r--r--plugins/TabSRMM/src/chat/services.cpp7
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp2
-rw-r--r--plugins/TabSRMM/src/commonheaders.h2
-rw-r--r--plugins/TabSRMM/src/contactcache.cpp14
-rw-r--r--plugins/TabSRMM/src/container.cpp2
-rw-r--r--plugins/TabSRMM/src/eventpopups.cpp2
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp6
-rw-r--r--plugins/TabSRMM/src/globals.cpp2
-rw-r--r--plugins/TabSRMM/src/globals.h2
-rw-r--r--plugins/TabSRMM/src/mim.cpp25
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp4
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp8
-rw-r--r--plugins/TabSRMM/src/msglog.cpp2
-rw-r--r--plugins/TabSRMM/src/msgoptions.cpp12
-rw-r--r--plugins/TabSRMM/src/trayicon.cpp2
-rw-r--r--plugins/TopToolBar/src/toolbar.cpp4
-rw-r--r--plugins/XSoundNotify/src/Common.h10
-rw-r--r--protocols/AimOscar/src/theme.cpp26
-rw-r--r--protocols/FacebookRM/src/theme.cpp8
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp8
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.h14
-rw-r--r--protocols/Gadu-Gadu/src/links.cpp15
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp12
-rw-r--r--protocols/IRCG/src/input.cpp4
-rw-r--r--protocols/IRCG/src/irclib.cpp2
-rw-r--r--protocols/IRCG/src/ircproto.cpp4
-rw-r--r--protocols/IRCG/src/options.cpp2
-rw-r--r--protocols/IRCG/src/services.cpp70
-rw-r--r--protocols/IRCG/src/windows.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_advsearch.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_menu.cpp90
-rw-r--r--protocols/IcqOscarJ/src/icq_proto.h3
-rw-r--r--protocols/IcqOscarJ/src/icq_xstatus.cpp6
-rw-r--r--protocols/IcqOscarJ/src/init.cpp11
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp135
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp2
-rw-r--r--protocols/JabberG/src/jabber_proto.h6
-rw-r--r--protocols/JabberG/src/jabber_xstatus.cpp3
-rw-r--r--protocols/JabberG/src/jabber_xstatus.h4
-rw-r--r--protocols/MSN/src/msn_menu.cpp60
-rw-r--r--protocols/Yahoo/src/services.cpp17
-rw-r--r--protocols/Yahoo/src/util.cpp4
-rw-r--r--protocols/Yahoo/src/yahoo.cpp4
-rw-r--r--src/modules/clist/clui.cpp89
-rw-r--r--src/modules/findadd/findadd.cpp8
73 files changed, 846 insertions, 1036 deletions
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<TCHAR> 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) &gt, (LPARAM) msi.sendBuffer);
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETTEXTEX, (WPARAM) &gt, (LPARAM)msi.sendBuffer);
gt.cb = bufSize - ansiBufSize;
gt.codepage = 1200;
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETTEXTEX, (WPARAM) &gt, (LPARAM) &msi.sendBuffer[ansiBufSize]);
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETTEXTEX, (WPARAM) &gt, (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)&gtxl, 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;i<dat->childrenCount;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) &gt, (LPARAM) textBuffer);
+ SendMessage(hwnd, EM_GETTEXTEX, (WPARAM) &gt, (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<PROTOACCOUNT *>(::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
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp
index 2aeb05fed5..f20de16ff5 100644
--- a/protocols/AimOscar/src/theme.cpp
+++ b/protocols/AimOscar/src/theme.cpp
@@ -85,8 +85,8 @@ void ReleaseIconEx(const char* name, bool big)
void WindowSetIcon(HWND hWnd, const char* name)
{
- SendMessage(hWnd, WM_SETICON, ICON_BIG, ( LPARAM )LoadIconEx( name, true ));
- SendMessage(hWnd, WM_SETICON, ICON_SMALL, ( LPARAM )LoadIconEx( name ));
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx( name, true ));
+ SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx( name ));
}
void WindowFreeIcon(HWND hWnd)
@@ -224,24 +224,14 @@ int CAimProto::OnPreBuildContactMenu(WPARAM wParam,LPARAM /*lParam*/)
bool isChatRoom = getByte(hContact, "ChatRoom", 0) != 0;
//see if we should add the html away message context menu items
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE;
- if (getWord(hContact, AIM_KEY_ST, ID_STATUS_OFFLINE) != ID_STATUS_AWAY || isChatRoom)
- mi.flags |= CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hHTMLAwayContextMenuItem,(LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_NOTONLINE;
- if (getBuddyId(hContact, 1) || state == 0 || isChatRoom)
- mi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hAddToServerListContextMenuItem,(LPARAM)&mi);
+ Menu_ShowItem(hHTMLAwayContextMenuItem, getWord(hContact, AIM_KEY_ST, ID_STATUS_OFFLINE) == ID_STATUS_AWAY && !isChatRoom);
+ Menu_ShowItem(hAddToServerListContextMenuItem, !getBuddyId(hContact, 1) && state != 0 && !isChatRoom);
DBVARIANT dbv;
- if (!getString(hContact, AIM_KEY_SN, &dbv))
- {
+ if (!getString(hContact, AIM_KEY_SN, &dbv)) {
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_NAME | CMIM_FLAGS;
- switch(pd_mode)
- {
+ switch(pd_mode) {
case 1:
mi.pszName = LPGEN("&Block");
break;
@@ -264,7 +254,7 @@ int CAimProto::OnPreBuildContactMenu(WPARAM wParam,LPARAM /*lParam*/)
break;
}
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hBlockContextMenuItem, (LPARAM)&mi);
+ Menu_ModifyItem(hBlockContextMenuItem, &mi);
DBFreeVariant(&dbv);
}
diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp
index 7ce279371b..c71e8df0bc 100644
--- a/protocols/FacebookRM/src/theme.cpp
+++ b/protocols/FacebookRM/src/theme.cpp
@@ -203,7 +203,7 @@ int FacebookProto::OnBuildStatusMenu(WPARAM wParam,LPARAM lParam)
hRoot = m_hMenuRoot = Menu_AddProtoMenuItem(&mi);
} else {
if ( m_hMenuRoot )
- CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )m_hMenuRoot, 0 );
+ CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)m_hMenuRoot, 0);
m_hMenuRoot = NULL;
}
@@ -266,7 +266,7 @@ void FacebookProto::ToggleStatusMenuItems( BOOL bEnable )
CLISTMENUITEM clmi = {sizeof(clmi)};
clmi.flags = CMIM_FLAGS | (( bEnable ) ? 0 : CMIF_GRAYED);
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuRoot, ( LPARAM )&clmi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hStatusMind, ( LPARAM )&clmi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuServicesRoot, ( LPARAM )&clmi );
+ CallService( MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuRoot, ( LPARAM )&clmi );
+ CallService( MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hStatusMind, ( LPARAM )&clmi );
+ CallService( MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuServicesRoot, ( LPARAM )&clmi );
}
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index 57dcf2a2da..548aaecce0 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -238,12 +238,12 @@ static int gg_prebuildcontactmenu(WPARAM wParam, LPARAM lParam)
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_NAME | CMIM_FLAGS | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
- if ( db_get_dw(hContact, gg->m_szModuleName, GG_KEY_UIN, 0) == db_get_b(NULL, gg->m_szModuleName, GG_KEY_UIN, 0) ||
- db_get_b(hContact, gg->m_szModuleName, "ChatRoom", 0) ||
- db_get_b(hContact, "CList", "NotOnList", 0))
+ if ( db_get_dw(hContact, gg->m_szModuleName, GG_KEY_UIN, 0) == db_get_b(NULL, gg->m_szModuleName, GG_KEY_UIN, 0)
+ || db_get_b(hContact, gg->m_szModuleName, "ChatRoom", 0)
+ || db_get_b(hContact, "CList", "NotOnList", 0))
mi.flags |= CMIF_HIDDEN;
mi.ptszName = db_get_b(hContact, gg->m_szModuleName, GG_KEY_BLOCK, 0) ? LPGENT("&Unblock") : LPGENT("&Block");
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)gg->hBlockMenuItem, (LPARAM)&mi);
+ Menu_ModifyItem(gg->hBlockMenuItem, &mi);
return 0;
}
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h
index d462f420f3..baf396ad37 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.h
+++ b/protocols/Gadu-Gadu/src/gg_proto.h
@@ -279,14 +279,12 @@ struct GGPROTO : public PROTO_INTERFACE
HANDLE netlib;
HGENMENU hMenuRoot;
HGENMENU hMainMenu[7];
- HANDLE hPrebuildMenuHook;
- HANDLE hBlockMenuItem;
- HANDLE hImageMenuItem;
- HANDLE hInstanceMenuItem;
- HANDLE hAvatarsFolder;
- HANDLE hImagesFolder;
- HWND hwndSessionsDlg;
- HANDLE hPopupNotify, hPopupError;
+ HGENMENU hBlockMenuItem, hImageMenuItem, hInstanceMenuItem;
+ HANDLE hPrebuildMenuHook;
+ HANDLE hAvatarsFolder;
+ HANDLE hImagesFolder;
+ HWND hwndSessionsDlg;
+ HANDLE hPopupNotify, hPopupError;
};
typedef struct
diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp
index 7cc0c37215..0da199062d 100644
--- a/protocols/Gadu-Gadu/src/links.cpp
+++ b/protocols/Gadu-Gadu/src/links.cpp
@@ -74,12 +74,9 @@ static INT_PTR gg_parselink(WPARAM wParam, LPARAM lParam)
mi.flags |= CMIM_ICON;
mi.hIcon = LoadSkinnedProtoIcon(gg->m_szModuleName, gg->m_iStatus);
}
- else {
- mi.flags |= CMIF_HIDDEN;
- mi.hIcon = NULL;
- }
+ else mi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)gginst->hInstanceMenuItem, (LPARAM)&mi);
+ Menu_ModifyItem(gginst->hInstanceMenuItem, &mi);
if (mi.hIcon)
Skin_ReleaseIcon(mi.hIcon);
}
@@ -156,14 +153,12 @@ void gg_links_destroy()
void GGPROTO::links_instance_init()
{
- if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
- {
- TMO_MenuItem tmi = {0};
- tmi.cbSize = sizeof(tmi);
+ if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) {
+ TMO_MenuItem tmi = { sizeof(tmi) };
tmi.flags = CMIF_TCHAR;
tmi.ownerdata = this;
tmi.position = list_count(g_Instances);
tmi.ptszName = m_tszUserName;
- hInstanceMenuItem = (HANDLE)CallService(MO_ADDNEWMENUITEM, (WPARAM)hInstanceMenu, (LPARAM)&tmi);
+ hInstanceMenuItem = (HGENMENU)CallService(MO_ADDNEWMENUITEM, (WPARAM)hInstanceMenu, (LPARAM)&tmi);
}
}
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index 3108066951..bd6021e292 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -2332,9 +2332,9 @@ void CIrcProto::OnIrcDisconnected()
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS | CMIF_GRAYED;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuJoin, ( LPARAM )&mi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuList, ( LPARAM )&mi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuNick, ( LPARAM )&mi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuJoin, (LPARAM)&mi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuList, (LPARAM)&mi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuNick, (LPARAM)&mi);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -2362,9 +2362,9 @@ bool CIrcProto::DoOnConnect( const CIrcMessage* )
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuJoin, ( LPARAM )&mi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuList, ( LPARAM )&mi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuNick, ( LPARAM )&mi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuJoin, (LPARAM)&mi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuList, (LPARAM)&mi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuNick, (LPARAM)&mi);
int Temp = m_iStatus;
m_iStatus = ID_STATUS_ONLINE;
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp
index c564b7844c..eafeae75fb 100644
--- a/protocols/IRCG/src/input.cpp
+++ b/protocols/IRCG/src/input.cpp
@@ -587,7 +587,7 @@ BOOL CIrcProto::DoHardcodedCommand( CMString text, TCHAR* window, HANDLE hContac
DoUserhostWithReason(2, S.c_str(), true, one.c_str());
} }
- CallService( MS_MSG_SENDMESSAGE, ( WPARAM )hContact2, 0 );
+ CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact2, 0);
}
if ( !two.IsEmpty()) {
@@ -661,7 +661,7 @@ BOOL CIrcProto::DoHardcodedCommand( CMString text, TCHAR* window, HANDLE hContac
} }
if ( three.IsEmpty())
- CallService( MS_FILE_SENDFILE, ( WPARAM )hContact, 0 );
+ CallService(MS_FILE_SENDFILE, (WPARAM)hContact, 0);
else {
CMString temp = GetWordAddress(text.c_str(), 3);
TCHAR* pp[2];
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp
index 1f13b5159f..e6fd017765 100644
--- a/protocols/IRCG/src/irclib.cpp
+++ b/protocols/IRCG/src/irclib.cpp
@@ -206,7 +206,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info)
FindLocalIP(con); // get the local ip used for filetransfers etc
if ( info.m_iSSL > 0 ) {
- if ( !CallService( MS_NETLIB_STARTSSL, ( WPARAM ) con, 0 ) && info.m_iSSL == 2 ) {
+ if ( !CallService(MS_NETLIB_STARTSSL, (WPARAM)con, 0) && info.m_iSSL == 2) {
Netlib_CloseHandle( con );
con = NULL;
m_info.Reset();
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp
index 42aeddb16e..95df8741a2 100644
--- a/protocols/IRCG/src/ircproto.cpp
+++ b/protocols/IRCG/src/ircproto.cpp
@@ -160,7 +160,7 @@ CIrcProto::~CIrcProto()
DeleteCriticalSection( &m_gchook );
if (hMenuRoot)
- CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )hMenuRoot, 0 );
+ CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)hMenuRoot, 0);
mir_free( m_alias );
@@ -1035,7 +1035,7 @@ int __cdecl CIrcProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
mi.ptszName = m_tszUserName;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuRoot, ( LPARAM )&mi );
+ CallService( MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuRoot, ( LPARAM )&mi );
}
break;
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp
index 36f211655f..d05b07df1a 100644
--- a/protocols/IRCG/src/options.cpp
+++ b/protocols/IRCG/src/options.cpp
@@ -765,7 +765,7 @@ void CConnectPrefsDlg::OnApply()
mi.flags = CMIM_FLAGS;
if ( !m_proto->m_useServer )
mi.flags |= CMIF_GRAYED;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_proto->hMenuServer, ( LPARAM )&mi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_proto->hMenuServer, (LPARAM)&mi);
m_proto->m_joinOnInvite = m_autoJoin.GetState();
m_proto->m_hideServerWindow = !m_showServer.GetState();
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index b65c92f728..c8204ac5d6 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -44,7 +44,7 @@ void CIrcProto::InitMainMenus(void)
}
else {
if (hMenuRoot)
- CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )hMenuRoot, 0 );
+ CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)hMenuRoot, 0);
hMenuRoot = NULL;
}
@@ -129,15 +129,12 @@ static INT_PTR IrcMenuIgnore(WPARAM wParam, LPARAM lParam)
int IrcPrebuildContactMenu( WPARAM wParam, LPARAM lParam )
{
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
-
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&mi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuWhois, ( LPARAM )&mi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuDisconnect, ( LPARAM )&mi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuIgnore, ( LPARAM )&mi );
+ Menu_ShowItem(hUMenuChanSettings, false);
+ Menu_ShowItem(hUMenuWhois, false);
+ Menu_ShowItem(hUMenuDisconnect, false);
+ Menu_ShowItem(hUMenuIgnore, false);
- CIrcProto* ppro = IrcGetInstanceByHContact((HANDLE)wParam);
+ CIrcProto *ppro = IrcGetInstanceByHContact((HANDLE)wParam);
return (ppro) ? ppro->OnMenuPreBuild(wParam, lParam) : 0;
}
@@ -1006,53 +1003,44 @@ int __cdecl CIrcProto::OnPreShutdown(WPARAM, LPARAM)
int __cdecl CIrcProto::OnMenuPreBuild(WPARAM wParam, LPARAM)
{
DBVARIANT dbv;
- HANDLE hContact = ( HANDLE )wParam;
- if ( !hContact )
+ HANDLE hContact = (HANDLE)wParam;
+ if (hContact == NULL)
return 0;
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON;
-
char *szProto = GetContactProto(hContact);
- if ( szProto && !lstrcmpiA(szProto, m_szModuleName)) {
- bool bIsOnline = getWord(hContact, "Status", ID_STATUS_OFFLINE)== ID_STATUS_OFFLINE ? false : true;
- if ( getByte(hContact, "ChatRoom", 0) == GCW_CHATROOM) {
- // context menu for chatrooms
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&mi );
- }
- else if ( !getTString( hContact, "Default", &dbv )) {
- // context menu for contact
- BYTE bDcc = getByte( hContact, "DCC", 0) ;
+ if (szProto && !lstrcmpiA(szProto, m_szModuleName)) {
+ bool bIsOnline = getWord(hContact, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE;
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&mi );
+ // context menu for chatrooms
+ if (getByte(hContact, "ChatRoom", 0) == GCW_CHATROOM)
+ Menu_ShowItem(hUMenuChanSettings, true);
- mi.flags = CMIM_FLAGS;
- if ( bDcc ) {
- // for DCC contact
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuDisconnect, ( LPARAM )&mi );
- }
+ // context menu for contact
+ else if ( !getTString( hContact, "Default", &dbv )) {
+ Menu_ShowItem(hUMenuChanSettings, false);
+
+ // for DCC contact
+ BYTE bDcc = getByte( hContact, "DCC", 0) ;
+ if (bDcc)
+ Menu_ShowItem(hUMenuDisconnect, true);
else {
// for normal contact
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE;
- if ( !IsConnected())
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuWhois, ( LPARAM )&mi );
+ Menu_ShowItem(hUMenuWhois, IsConnected());
+ bool bEnabled = true;
if (bIsOnline) {
DBVARIANT dbv3;
if ( !getString( hContact, "Host", &dbv3)) {
if (dbv3.pszVal[0] == 0)
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- DBFreeVariant( &dbv3 );
+ bEnabled = false;
+ DBFreeVariant(&dbv3);
}
}
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuIgnore, ( LPARAM )&mi );
+ Menu_ShowItem(hUMenuIgnore, bEnabled);
}
DBFreeVariant( &dbv );
- } }
+ }
+ }
return 0;
}
@@ -1245,5 +1233,5 @@ void CIrcProto::DoNetlibLog( const char* fmt, ... )
mir_vsnprintf( str, 32000, fmt, vararg );
va_end( vararg );
- CallService( MS_NETLIB_LOG, ( WPARAM )hNetlib, ( LPARAM )str );
+ CallService( MS_NETLIB_LOG, (WPARAM)hNetlib, ( LPARAM )str );
}
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp
index ad8a16fec7..c20ceebc1c 100644
--- a/protocols/IRCG/src/windows.cpp
+++ b/protocols/IRCG/src/windows.cpp
@@ -87,7 +87,7 @@ void CWhoisDlg::OnInitDialog()
GetObject( hFont, sizeof( lf ), &lf );
lf.lfWeight = FW_BOLD;
hFont = CreateFontIndirect( &lf );
- m_AwayTime.SendMsg( WM_SETFONT, ( WPARAM )hFont, 0 );
+ m_AwayTime.SendMsg(WM_SETFONT, (WPARAM)hFont, 0);
CCoolIrcDlg::OnInitDialog();
diff --git a/protocols/IcqOscarJ/src/icq_advsearch.cpp b/protocols/IcqOscarJ/src/icq_advsearch.cpp
index 6c3a3ffa89..05d0d8f442 100644
--- a/protocols/IcqOscarJ/src/icq_advsearch.cpp
+++ b/protocols/IcqOscarJ/src/icq_advsearch.cpp
@@ -45,7 +45,7 @@ static void InitComboBox(HWND hwndCombo, const FieldNamesItem *names)
else {
int ctryCount;
struct CountryListEntry *countries;
- CallService( MS_UTILS_GETCOUNTRYLIST, ( WPARAM )&ctryCount, ( LPARAM )&countries );
+ CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&ctryCount, (LPARAM)&countries);
for (i = 0; i < ctryCount; i++) {
if (countries[i].id != 0xFFFF && countries[i].id != 0)
iItem = ComboBoxAddStringUtf(hwndCombo, LPGEN(countries[i].szName), countries[i].id);
diff --git a/protocols/IcqOscarJ/src/icq_menu.cpp b/protocols/IcqOscarJ/src/icq_menu.cpp
index a038d9f792..a62b1da5f7 100644
--- a/protocols/IcqOscarJ/src/icq_menu.cpp
+++ b/protocols/IcqOscarJ/src/icq_menu.cpp
@@ -29,8 +29,8 @@
#include <m_skin.h>
-HANDLE g_hContactMenuItems[6];
-HANDLE g_hContactMenuSvc[6];
+HGENMENU g_hContactMenuItems[6];
+HANDLE g_hContactMenuSvc[6];
static int sttCompareProtocols(const CIcqProto *p1, const CIcqProto *p2)
{
@@ -88,24 +88,14 @@ static INT_PTR IcqMenuHandleOpenProfile(WPARAM wParam, LPARAM lParam)
return (ppro) ? ppro->OpenWebProfile(wParam, lParam) : 0;
}
-static void sttEnableMenuItem( HANDLE hMenuItem, bool bEnable )
-{
- CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.flags = CMIM_FLAGS;
- if ( !bEnable )
- clmi.flags |= CMIF_HIDDEN;
-
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuItem, ( LPARAM )&clmi );
-}
-
static int IcqPrebuildContactMenu( WPARAM wParam, LPARAM lParam )
{
- sttEnableMenuItem(g_hContactMenuItems[ICMI_AUTH_REQUEST], FALSE);
- sttEnableMenuItem(g_hContactMenuItems[ICMI_AUTH_GRANT], FALSE);
- sttEnableMenuItem(g_hContactMenuItems[ICMI_AUTH_REVOKE], FALSE);
- sttEnableMenuItem(g_hContactMenuItems[ICMI_ADD_TO_SERVLIST], FALSE);
- sttEnableMenuItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], FALSE);
- sttEnableMenuItem(g_hContactMenuItems[ICMI_OPEN_PROFILE], FALSE);
+ Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_REQUEST], FALSE);
+ Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_GRANT], FALSE);
+ Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_REVOKE], FALSE);
+ Menu_ShowItem(g_hContactMenuItems[ICMI_ADD_TO_SERVLIST], FALSE);
+ Menu_ShowItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], FALSE);
+ Menu_ShowItem(g_hContactMenuItems[ICMI_OPEN_PROFILE], FALSE);
CIcqProto* ppro = IcqGetInstanceByHContact((HANDLE)wParam);
return (ppro) ? ppro->OnPreBuildContactMenu(wParam, lParam) : 0;
@@ -121,58 +111,58 @@ void g_MenuInit(void)
// Contact menu initialization
char str[MAXMODULELABELLENGTH], *pszDest = str + 3;
- strcpy( str, "ICQ" );
+ strcpy(str, "ICQ");
CLISTMENUITEM mi = { sizeof(mi) };
mi.pszService = str;
mi.flags = CMIF_ICONFROMICOLIB;
// "Request authorization"
+ strcpy(pszDest, MS_REQ_AUTH); CreateServiceFunction(str, IcqMenuHandleRequestAuth );
+
mi.pszName = LPGEN("Request authorization");
mi.position = 1000030000;
mi.icolibItem = g_IconsList[ISI_AUTH_REQUEST].hIcolib;
- strcpy(pszDest, MS_REQ_AUTH);
g_hContactMenuItems[ICMI_AUTH_REQUEST] = Menu_AddContactMenuItem(&mi);
- g_hContactMenuSvc[ICMI_AUTH_REQUEST] = CreateServiceFunction( str, IcqMenuHandleRequestAuth );
-
+
// "Grant authorization"
+ strcpy(pszDest, MS_GRANT_AUTH); CreateServiceFunction(str, IcqMenuHandleGrantAuth);
+
mi.pszName = LPGEN("Grant authorization");
mi.position = 1000029999;
mi.icolibItem = g_IconsList[ISI_AUTH_GRANT].hIcolib;
- strcpy(pszDest, MS_GRANT_AUTH);
g_hContactMenuItems[ICMI_AUTH_GRANT] = Menu_AddContactMenuItem(&mi);
- g_hContactMenuSvc[ICMI_AUTH_GRANT] = CreateServiceFunction(mi.pszService, IcqMenuHandleGrantAuth);
-
+
// "Revoke authorization"
+ strcpy(pszDest, MS_REVOKE_AUTH); CreateServiceFunction(str, IcqMenuHandleRevokeAuth);
+
mi.pszName = LPGEN("Revoke authorization");
mi.position = 1000029998;
mi.icolibItem = g_IconsList[ISI_AUTH_REVOKE].hIcolib;
- strcpy(pszDest, MS_REVOKE_AUTH);
g_hContactMenuItems[ICMI_AUTH_REVOKE] = Menu_AddContactMenuItem(&mi);
- g_hContactMenuSvc[ICMI_AUTH_REVOKE] = CreateServiceFunction(mi.pszService, IcqMenuHandleRevokeAuth);
-
+
// "Add to server list"
+ strcpy(pszDest, MS_ICQ_ADDSERVCONTACT); CreateServiceFunction(str, IcqMenuHandleAddServContact);
+
mi.pszName = LPGEN("Add to server list");
mi.position = -2049999999;
mi.icolibItem = g_IconsList[ISI_ADD_TO_SERVLIST].hIcolib;
- strcpy(pszDest, MS_ICQ_ADDSERVCONTACT);
g_hContactMenuItems[ICMI_ADD_TO_SERVLIST] = Menu_AddContactMenuItem(&mi);
- g_hContactMenuSvc[ICMI_ADD_TO_SERVLIST] = CreateServiceFunction(mi.pszService, IcqMenuHandleAddServContact);
-
+
// "Show custom status details"
- mi.pszName = LPGEN("Show custom status details");
+ strcpy(pszDest, MS_XSTATUS_SHOWDETAILS); CreateServiceFunction(str, IcqMenuHandleXStatusDetails);
+
+ mi.pszName = LPGEN("Show custom status details");
mi.position = -2000004999;
mi.flags = 0;
- strcpy(pszDest, MS_XSTATUS_SHOWDETAILS);
g_hContactMenuItems[ICMI_XSTATUS_DETAILS] = Menu_AddContactMenuItem(&mi);
- g_hContactMenuSvc[ICMI_XSTATUS_DETAILS] = CreateServiceFunction(mi.pszService, IcqMenuHandleXStatusDetails);
-
+
// "Open ICQ profile"
+ strcpy(pszDest, MS_OPEN_PROFILE); CreateServiceFunction(str, IcqMenuHandleOpenProfile);
+
mi.pszName = LPGEN("Open ICQ profile");
mi.position = 1000029997;
- strcpy(pszDest, MS_OPEN_PROFILE);
g_hContactMenuItems[ICMI_OPEN_PROFILE] = Menu_AddContactMenuItem(&mi);
- g_hContactMenuSvc[ICMI_OPEN_PROFILE] = CreateServiceFunction(mi.pszService, IcqMenuHandleOpenProfile);
}
void g_MenuUninit(void)
@@ -183,13 +173,6 @@ void g_MenuUninit(void)
CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_ADD_TO_SERVLIST], 0);
CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_XSTATUS_DETAILS], 0);
CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_OPEN_PROFILE], 0);
-
- DestroyServiceFunction(g_hContactMenuSvc[ICMI_AUTH_REQUEST]);
- DestroyServiceFunction(g_hContactMenuSvc[ICMI_AUTH_GRANT]);
- DestroyServiceFunction(g_hContactMenuSvc[ICMI_AUTH_REVOKE]);
- DestroyServiceFunction(g_hContactMenuSvc[ICMI_ADD_TO_SERVLIST]);
- DestroyServiceFunction(g_hContactMenuSvc[ICMI_XSTATUS_DETAILS]);
- DestroyServiceFunction(g_hContactMenuSvc[ICMI_OPEN_PROFILE]);
}
@@ -209,37 +192,34 @@ int CIcqProto::OnPreBuildContactMenu(WPARAM wParam, LPARAM)
if (hContact == NULL)
return 0;
- if (icqOnline())
- {
+ if (icqOnline()) {
BOOL bCtrlPressed = (GetKeyState(VK_CONTROL)&0x8000 ) != 0;
DWORD dwUin = getContactUin(hContact);
-
- sttEnableMenuItem(g_hContactMenuItems[ICMI_AUTH_REQUEST],
+ Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_REQUEST],
dwUin && (bCtrlPressed || (getSettingByte((HANDLE)wParam, "Auth", 0) && getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0))));
- sttEnableMenuItem(g_hContactMenuItems[ICMI_AUTH_GRANT], dwUin && (bCtrlPressed || getSettingByte((HANDLE)wParam, "Grant", 0)));
- sttEnableMenuItem(g_hContactMenuItems[ICMI_AUTH_REVOKE],
+ Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_GRANT], dwUin && (bCtrlPressed || getSettingByte((HANDLE)wParam, "Grant", 0)));
+ Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_REVOKE],
dwUin && (bCtrlPressed || (getSettingByte(NULL, "PrivacyItems", 0) && !getSettingByte((HANDLE)wParam, "Grant", 0))));
- sttEnableMenuItem(g_hContactMenuItems[ICMI_ADD_TO_SERVLIST],
+ Menu_ShowItem(g_hContactMenuItems[ICMI_ADD_TO_SERVLIST],
m_bSsiEnabled && !getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0) &&
!getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_IGNORE, 0) &&
!db_get_b(hContact, "CList", "NotOnList", 0));
}
- sttEnableMenuItem(g_hContactMenuItems[ICMI_OPEN_PROFILE],getContactUin(hContact) != 0);
+ Menu_ShowItem(g_hContactMenuItems[ICMI_OPEN_PROFILE],getContactUin(hContact) != 0);
BYTE bXStatus = getContactXStatus((HANDLE)wParam);
- sttEnableMenuItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], m_bHideXStatusUI ? 0 : bXStatus != 0);
+ Menu_ShowItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], m_bHideXStatusUI ? 0 : bXStatus != 0);
if (bXStatus && !m_bHideXStatusUI) {
CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_ICON;
-
if (bXStatus > 0 && bXStatus <= XSTATUS_COUNT)
clmi.hIcon = getXStatusIcon(bXStatus, LR_SHARED);
else
clmi.hIcon = LoadSkinnedIcon(SKINICON_OTHER_SMALLDOT);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_XSTATUS_DETAILS], (LPARAM)&clmi);
+ Menu_ModifyItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], &clmi);
}
return 0;
diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h
index fb35b0a227..561fe3e60b 100644
--- a/protocols/IcqOscarJ/src/icq_proto.h
+++ b/protocols/IcqOscarJ/src/icq_proto.h
@@ -813,8 +813,7 @@ struct CIcqProto : public PROTO_INTERFACE
HANDLE hHookExtraIconsRebuild;
HANDLE hHookStatusBuild;
HANDLE hHookExtraIconsApply;
-
- HANDLE hXStatusItems[XSTATUS_COUNT + 1];
+ HGENMENU hXStatusItems[XSTATUS_COUNT + 1];
void InitXStatusItems(BOOL bAllowStatus);
BYTE getContactXStatus(HANDLE hContact);
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp
index e9461d24bb..dc1efbdacf 100644
--- a/protocols/IcqOscarJ/src/icq_xstatus.cpp
+++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp
@@ -32,8 +32,6 @@
#include "m_extraicons.h"
#include "..\icons_pack\src\resource.h"
-void CListShowMenuItem(HANDLE hMenuItem, BYTE bShow);
-
static HANDLE hXStatusIcons[XSTATUS_COUNT];
static int hXStatusCListIcons[XSTATUS_COUNT];
static BOOL bXStatusCListIconsValid[XSTATUS_COUNT];
@@ -882,9 +880,7 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus)
mi.pszContactOwner = m_szModuleName;
hXStatusItems[i] = Menu_AddStatusMenuItem(&mi);
-
- // CMIF_HIDDEN does not work for adding services
- CListShowMenuItem(hXStatusItems[i], !(m_bHideXStatusUI || m_bHideXStatusMenu));
+ Menu_ShowItem(hXStatusItems[i], !(m_bHideXStatusUI || m_bHideXStatusMenu));
}
}
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp
index d943b29ee8..0cf65d5eb7 100644
--- a/protocols/IcqOscarJ/src/init.cpp
+++ b/protocols/IcqOscarJ/src/init.cpp
@@ -148,17 +148,6 @@ extern "C" int __declspec(dllexport) Unload(void)
/////////////////////////////////////////////////////////////////////////////////////////
// OnPrebuildContactMenu event
-void CListShowMenuItem(HANDLE hMenuItem, BYTE bShow)
-{
- CLISTMENUITEM mi = { sizeof(mi) };
- if (bShow)
- mi.flags = CMIM_FLAGS;
- else
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&mi);
-}
-
static void CListSetMenuItemIcon(HANDLE hMenuItem, HICON hIcon)
{
CLISTMENUITEM mi = { sizeof(mi) };
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index d70d2c5241..f6f404c4e0 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -162,30 +162,20 @@ static INT_PTR JabberMenuHandleDirectPresence(WPARAM wParam, LPARAM lParam, LPAR
return(ppro) ? ppro->OnMenuHandleDirectPresence(wParam, lParam, lRes) : 0;
}
-static void sttEnableMenuItem(HANDLE hMenuItem, BOOL bEnable)
-{
- CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.flags = CMIM_FLAGS;
- if ( !bEnable)
- clmi.flags |= CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&clmi);
-}
-
static int JabberPrebuildContactMenu(WPARAM wParam, LPARAM lParam)
{
- sttEnableMenuItem(g_hMenuRequestAuth, FALSE);
- sttEnableMenuItem(g_hMenuGrantAuth, FALSE);
- sttEnableMenuItem(g_hMenuRevokeAuth, FALSE);
- sttEnableMenuItem(g_hMenuCommands, FALSE);
- sttEnableMenuItem(g_hMenuSendNote, FALSE);
- sttEnableMenuItem(g_hMenuConvert, FALSE);
- sttEnableMenuItem(g_hMenuRosterAdd, FALSE);
- sttEnableMenuItem(g_hMenuLogin, FALSE);
- sttEnableMenuItem(g_hMenuRefresh, FALSE);
- sttEnableMenuItem(g_hMenuAddBookmark, FALSE);
- sttEnableMenuItem(g_hMenuResourcesRoot, FALSE);
- sttEnableMenuItem(g_hMenuDirectPresence[0], FALSE);
+ Menu_ShowItem(g_hMenuRequestAuth, FALSE);
+ Menu_ShowItem(g_hMenuGrantAuth, FALSE);
+ Menu_ShowItem(g_hMenuRevokeAuth, FALSE);
+ Menu_ShowItem(g_hMenuCommands, FALSE);
+ Menu_ShowItem(g_hMenuSendNote, FALSE);
+ Menu_ShowItem(g_hMenuConvert, FALSE);
+ Menu_ShowItem(g_hMenuRosterAdd, FALSE);
+ Menu_ShowItem(g_hMenuLogin, FALSE);
+ Menu_ShowItem(g_hMenuRefresh, FALSE);
+ Menu_ShowItem(g_hMenuAddBookmark, FALSE);
+ Menu_ShowItem(g_hMenuResourcesRoot, FALSE);
+ Menu_ShowItem(g_hMenuDirectPresence[0], FALSE);
CJabberProto* ppro = JabberGetInstanceByHContact((HANDLE)wParam);
return(ppro) ? ppro->OnPrebuildContactMenu(wParam, lParam) : 0;
@@ -367,6 +357,7 @@ void g_MenuUninit(void)
int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
{
+ DBVARIANT dbv;
HANDLE hContact;
if ((hContact=(HANDLE)wParam) == NULL)
return 0;
@@ -375,74 +366,72 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
BYTE bIsTransport = (BYTE)JGetByte(hContact, "IsTransport", 0);
if ((bIsChatRoom == GCW_CHATROOM) || bIsChatRoom == 0) {
- DBVARIANT dbv;
if ( !JGetStringT(hContact, bIsChatRoom?(char*)"ChatRoomID":(char*)"jid", &dbv)) {
db_free(&dbv);
- sttEnableMenuItem(g_hMenuConvert, TRUE);
+ Menu_ShowItem(g_hMenuConvert, TRUE);
CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.pszName = bIsChatRoom ? (char *)LPGEN("&Convert to Contact") : (char *)LPGEN("&Convert to Chat Room");
clmi.flags = CMIM_NAME | CMIM_FLAGS;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuConvert, (LPARAM)&clmi);
- } }
+ Menu_ModifyItem(g_hMenuConvert, &clmi);
+ }
+ }
if ( !m_bJabberOnline)
return 0;
- sttEnableMenuItem(g_hMenuDirectPresence[0], TRUE);
- for (int i = 0; i < SIZEOF(PresenceModeArray); i++)
- {
+ Menu_ShowItem(g_hMenuDirectPresence[0], TRUE);
+ for (int i = 0; i < SIZEOF(PresenceModeArray); i++) {
CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.flags = CMIM_ICON|CMIM_FLAGS;
+ clmi.flags = CMIM_ICON | CMIM_FLAGS;
clmi.hIcon = (HICON)LoadSkinnedProtoIcon(m_szModuleName, PresenceModeArray[i].mode);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuDirectPresence[i+1], (LPARAM)&clmi);
+ Menu_ModifyItem(g_hMenuDirectPresence[i+1], &clmi);
}
if (bIsChatRoom) {
- DBVARIANT dbv;
if ( !JGetStringT(hContact, "ChatRoomID", &dbv)) {
- sttEnableMenuItem(g_hMenuRosterAdd, FALSE);
+ Menu_ShowItem(g_hMenuRosterAdd, FALSE);
if (ListGetItemPtr(LIST_BOOKMARK, dbv.ptszVal) == NULL)
if (m_ThreadInfo && m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE)
- sttEnableMenuItem(g_hMenuAddBookmark, TRUE);
+ Menu_ShowItem(g_hMenuAddBookmark, TRUE);
db_free(&dbv);
- } }
+ }
+ }
if (bIsChatRoom == GCW_CHATROOM)
return 0;
if (bIsTransport) {
- sttEnableMenuItem(g_hMenuLogin, TRUE);
- sttEnableMenuItem(g_hMenuRefresh, TRUE);
+ Menu_ShowItem(g_hMenuLogin, TRUE);
+ Menu_ShowItem(g_hMenuRefresh, TRUE);
}
- DBVARIANT dbv;
if ( !JGetStringT(hContact, "jid", &dbv)) {
JabberCapsBits jcb = GetTotalJidCapabilites(dbv.ptszVal);
JABBER_LIST_ITEM* item = ListGetItemPtr(LIST_ROSTER, dbv.ptszVal);
db_free(&dbv);
if (item != NULL) {
BOOL bCtrlPressed = (GetKeyState(VK_CONTROL)&0x8000) != 0;
- sttEnableMenuItem(g_hMenuRequestAuth, item->subscription == SUB_FROM || item->subscription == SUB_NONE || bCtrlPressed);
- sttEnableMenuItem(g_hMenuGrantAuth, bCtrlPressed);
- sttEnableMenuItem(g_hMenuRevokeAuth, item->subscription == SUB_FROM || item->subscription == SUB_BOTH || bCtrlPressed);
- sttEnableMenuItem(g_hMenuCommands, ((jcb & JABBER_CAPS_COMMANDS) != 0) || bCtrlPressed);
- sttEnableMenuItem(g_hMenuSendNote, TRUE);
+ Menu_ShowItem(g_hMenuRequestAuth, item->subscription == SUB_FROM || item->subscription == SUB_NONE || bCtrlPressed);
+ Menu_ShowItem(g_hMenuGrantAuth, bCtrlPressed);
+ Menu_ShowItem(g_hMenuRevokeAuth, item->subscription == SUB_FROM || item->subscription == SUB_BOTH || bCtrlPressed);
+ Menu_ShowItem(g_hMenuCommands, ((jcb & JABBER_CAPS_COMMANDS) != 0) || bCtrlPressed);
+ Menu_ShowItem(g_hMenuSendNote, TRUE);
if (item->resourceCount >= 1) {
- sttEnableMenuItem(g_hMenuResourcesRoot, TRUE);
+ Menu_ShowItem(g_hMenuResourcesRoot, TRUE);
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_ICON|CMIM_FLAGS;
mi.icolibItem = m_hProtoIcon;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuResourcesRoot, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuResourcesActive, (LPARAM)&mi);
+ Menu_ModifyItem(g_hMenuResourcesRoot, &mi);
+ Menu_ModifyItem(g_hMenuResourcesActive, &mi);
int nMenuResourceItemsNew = m_nMenuResourceItems;
if (m_nMenuResourceItems < item->resourceCount) {
- m_phMenuResourceItems = (HANDLE *)mir_realloc(m_phMenuResourceItems, item->resourceCount * sizeof(HANDLE));
+ m_phMenuResourceItems = (HGENMENU*)mir_realloc(m_phMenuResourceItems, item->resourceCount * sizeof(HGENMENU));
nMenuResourceItemsNew = item->resourceCount;
}
@@ -482,19 +471,17 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
(TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, item->resource[i].status, GSMDF_TCHAR),
item->resource[i].priority);
clmi.ptszName = szTmp;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_phMenuResourceItems[i], (LPARAM)&clmi);
+ Menu_ModifyItem(m_phMenuResourceItems[i], &clmi);
DestroyIcon(clmi.hIcon);
}
- else sttEnableMenuItem(m_phMenuResourceItems[i], FALSE);
+ else Menu_ShowItem(m_phMenuResourceItems[i], FALSE);
}
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | CMIF_ICONFROMICOLIB |
- ((item->resourceMode == RSMODE_LASTSEEN) ? CMIF_CHECKED : 0);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuResourcesActive, (LPARAM)&mi);
+ mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | CMIF_ICONFROMICOLIB | ((item->resourceMode == RSMODE_LASTSEEN) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(g_hMenuResourcesActive, &mi);
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | CMIF_ICONFROMICOLIB |
- ((item->resourceMode == RSMODE_SERVER) ? CMIF_CHECKED : 0);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuResourcesServer, (LPARAM)&mi);
+ mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | CMIF_ICONFROMICOLIB | ((item->resourceMode == RSMODE_SERVER) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(g_hMenuResourcesServer, &mi);
m_nMenuResourceItems = nMenuResourceItemsNew;
}
@@ -878,7 +865,7 @@ void CJabberProto::UpdatePriorityMenu(short priority)
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_TCHAR | CMIM_NAME;
mi.ptszName = szName;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuPriorityRoot, (LPARAM)&mi);
+ Menu_ModifyItem(m_hMenuPriorityRoot, &mi);
m_priorityMenuVal = priority;
m_priorityMenuValSet = true;
@@ -896,7 +883,7 @@ void CJabberProto::GlobalMenuInit()
tmi.ownerdata = this;
tmi.position = iChooserMenuPos++;
tmi.ptszName = m_tszUserName;
- m_hChooseMenuItem = (HANDLE)CallService(MO_ADDNEWMENUITEM, (WPARAM)hChooserMenu, (LPARAM)&tmi);
+ m_hChooseMenuItem = (HGENMENU)CallService(MO_ADDNEWMENUITEM, (WPARAM)hChooserMenu, (LPARAM)&tmi);
//////////////////////////////////////////////////////////////////////////////////////
// Hotkeys
@@ -1005,30 +992,26 @@ void CJabberProto::CheckMenuItems()
if ( !m_menuItemsStatus)
clmi.flags |= CMIF_GRAYED;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuChangePassword, (LPARAM)&clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuGroupchat, (LPARAM)&clmi);
+ Menu_ModifyItem(m_hMenuChangePassword, &clmi);
+ Menu_ModifyItem(m_hMenuGroupchat, &clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuPrivacyLists, (LPARAM)&clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuRosterControl, (LPARAM)&clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuServiceDiscovery, (LPARAM)&clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuSDMyTransports, (LPARAM)&clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuSDTransports, (LPARAM)&clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuSDConferences, (LPARAM)&clmi);
+ Menu_ModifyItem(m_hMenuPrivacyLists, &clmi);
+ Menu_ModifyItem(m_hMenuRosterControl, &clmi);
+ Menu_ModifyItem(m_hMenuServiceDiscovery, &clmi);
+ Menu_ModifyItem(m_hMenuSDMyTransports, &clmi);
+ Menu_ModifyItem(m_hMenuSDTransports, &clmi);
+ Menu_ModifyItem(m_hMenuSDConferences, &clmi);
- clmi.flags = CMIM_FLAGS | ((m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE)) ? 0 : CMIF_HIDDEN);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuBookmarks, (LPARAM)&clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuNotes, (LPARAM)&clmi);
+ bool bEnabled = m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE);
+ Menu_ShowItem(m_hMenuNotes, bEnabled);
+ Menu_ShowItem(m_hMenuBookmarks, bEnabled);
- clmi.flags = CMIM_FLAGS | ((m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVACY_LISTS)) ? 0 : CMIF_HIDDEN);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hPrivacyMenuRoot, (LPARAM)&clmi);
+ Menu_ShowItem(m_hPrivacyMenuRoot, m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVACY_LISTS));
- clmi.flags = CMIM_FLAGS | (m_menuItemsStatus ? 0 : CMIF_HIDDEN);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuPriorityRoot, (LPARAM)&clmi);
+ Menu_ShowItem(m_hMenuPriorityRoot, m_menuItemsStatus != 0);
- if ( !m_bPepSupported)
- clmi.flags |= CMIF_HIDDEN;
for (int i=0; i < m_pepServices.getCount(); i++)
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_pepServices[i].GetMenu(), (LPARAM)&clmi);
+ Menu_ShowItem(m_pepServices[i].GetMenu(), m_bPepSupported);
JabberUpdateDialogs(m_menuItemsStatus);
}
@@ -1273,7 +1256,7 @@ CJabberProto *JabberChooseInstance(bool bIsLink)
}
else clmi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)ppro->m_hChooseMenuItem, (LPARAM)&clmi);
+ Menu_ModifyItem(ppro->m_hChooseMenuItem, &clmi);
}
if (nItems > 1) {
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 19a4745d34..b4083314e9 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -1589,7 +1589,7 @@ int __cdecl CJabberProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARA
CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
clmi.ptszName = m_tszUserName;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuRoot, (LPARAM)&clmi);
+ Menu_ModifyItem(m_hMenuRoot, &clmi);
}
break;
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index 90ef79398a..ea534109d1 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -346,7 +346,7 @@ struct CJabberProto : public PROTO_INTERFACE
DWORD m_dwSDLastRefresh;
DWORD m_dwSDLastAutoDisco;
- HANDLE m_hChooseMenuItem;
+ HGENMENU m_hChooseMenuItem;
int m_privacyMenuServiceAllocated;
TFilterInfo m_filterInfo;
@@ -1005,8 +1005,8 @@ private:
BOOL m_menuItemsStatus;
LIST<void> m_hPrivacyMenuItems;
- int m_nMenuResourceItems;
- HANDLE* m_phMenuResourceItems;
+ int m_nMenuResourceItems;
+ HGENMENU *m_phMenuResourceItems;
};
extern LIST<CJabberProto> g_Instances;
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp
index 95d1b60946..5427401826 100644
--- a/protocols/JabberG/src/jabber_xstatus.cpp
+++ b/protocols/JabberG/src/jabber_xstatus.cpp
@@ -481,7 +481,6 @@ void CPepGuiService::RebuildMenu()
mi.pszService = szService;
mi.position = 200010;
mi.flags = CMIF_TCHAR | CMIF_ICONFROMICOLIB | CMIF_HIDDEN | CMIF_ROOTHANDLE;
-
mi.icolibItem = m_hIcolibItem;
mi.ptszName = m_szText ? m_szText : _T("<advanced status slot>");
m_hMenuItem = Menu_AddProtoMenuItem(&mi);
@@ -510,7 +509,7 @@ void CPepGuiService::UpdateMenuItem(HANDLE hIcolibIcon, TCHAR *text)
mi.flags = CMIF_TCHAR | CMIF_ICONFROMICOLIB | CMIM_ICON | CMIM_NAME;
mi.icolibItem = m_hIcolibItem;
mi.ptszName = m_szText ? m_szText : _T("<advanced status slot>");
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuItem, (LPARAM)&mi);
+ Menu_ModifyItem(m_hMenuItem, &mi);
}
int CPepGuiService::OnMenuItemClick(WPARAM, LPARAM)
diff --git a/protocols/JabberG/src/jabber_xstatus.h b/protocols/JabberG/src/jabber_xstatus.h
index dbbd95c678..2fc8cb77ab 100644
--- a/protocols/JabberG/src/jabber_xstatus.h
+++ b/protocols/JabberG/src/jabber_xstatus.h
@@ -34,7 +34,7 @@ public:
CPepService(CJabberProto *proto, char *name, TCHAR *node);
virtual ~CPepService();
- HANDLE GetMenu() { return m_hMenuItem; }
+ HGENMENU GetMenu() { return m_hMenuItem; }
TCHAR *GetNode() { return m_node; }
virtual void ProcessItems(const TCHAR *from, HXML items) = 0;
@@ -51,7 +51,7 @@ protected:
CJabberProto *m_proto;
char *m_name;
TCHAR *m_node;
- HANDLE m_hMenuItem;
+ HGENMENU m_hMenuItem;
int m_wasPublished;
diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp
index aa8c3cb5ab..24038dfad1 100644
--- a/protocols/MSN/src/msn_menu.cpp
+++ b/protocols/MSN/src/msn_menu.cpp
@@ -23,12 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "msn_global.h"
#include "msn_proto.h"
-static HGENMENU
- hBlockMenuItem,
- hLiveSpaceMenuItem,
- hNetmeetingMenuItem,
- hChatInviteMenuItem,
- hOpenInboxMenuItem;
+static HGENMENU hBlockMenuItem, hLiveSpaceMenuItem, hNetmeetingMenuItem, hChatInviteMenuItem, hOpenInboxMenuItem;
+
HANDLE hNetMeeting, hBlockCom, hSendHotMail, hInviteChat, hViewProfile;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -147,24 +143,20 @@ int CMsnProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
bool isMe = MSN_IsMeByContact(hContact, szEmail);
if (szEmail[0]) {
int listId = Lists_GetMask(szEmail);
-
bool noChat = !(listId & LIST_FL) || isMe || getByte(hContact, "ChatRoom", 0);
CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_NAME | CMIM_FLAGS | CMIF_ICONFROMICOLIB;
- if (noChat) mi.flags |= CMIF_HIDDEN;
+ mi.flags = CMIM_NAME;
mi.pszName = (char*)((listId & LIST_BL) ? "&Unblock" : "&Block");
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hBlockMenuItem, (LPARAM)&mi);
+ Menu_ModifyItem(hBlockMenuItem, &mi);
+ Menu_ShowItem(hBlockMenuItem, !noChat);
- mi.flags = CMIM_NAME | CMIM_FLAGS | CMIF_ICONFROMICOLIB;
- if (!emailEnabled) mi.flags |= CMIF_HIDDEN;
mi.pszName = isMe ? LPGEN("Open &Hotmail Inbox") : LPGEN("Send &Hotmail E-mail");
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hOpenInboxMenuItem, (LPARAM)&mi);
+ Menu_ModifyItem(hOpenInboxMenuItem, &mi);
+ Menu_ShowItem(hOpenInboxMenuItem, emailEnabled);
- mi.flags = CMIM_FLAGS | CMIF_ICONFROMICOLIB | CMIF_NOTOFFLINE;
- if (noChat) mi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hNetmeetingMenuItem, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hChatInviteMenuItem, (LPARAM)&mi);
+ Menu_ShowItem(hNetmeetingMenuItem, !noChat);
+ Menu_ShowItem(hChatInviteMenuItem, !noChat);
}
return 0;
@@ -365,15 +357,12 @@ void CMsnProto::MSN_EnableMenuItems(bool bEnable)
if (!bEnable)
mi.flags |= CMIF_GRAYED;
- for (unsigned i=0; i < SIZEOF(menuItemsMain); i++)
+ for (int i=0; i < SIZEOF(menuItemsMain); i++)
if (menuItemsMain[i] != NULL)
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)menuItemsMain[i], (LPARAM)&mi);
+ Menu_ModifyItem(menuItemsMain[i], &mi);
- if (bEnable) {
- mi.flags = CMIM_FLAGS;
- if (!emailEnabled) mi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)menuItemsMain[1], (LPARAM)&mi);
- }
+ if (bEnable)
+ Menu_ShowItem(menuItemsMain[1], emailEnabled);
}
//////////////////////////////////////////////////////////////////////////////////////
@@ -415,28 +404,17 @@ static INT_PTR MsnMenuSendHotmail(WPARAM wParam, LPARAM lParam)
return (ppro) ? ppro->MsnSendHotmail(wParam, lParam) : 0;
}
-static void sttEnableMenuItem(HANDLE hMenuItem, bool bEnable)
-{
- CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.flags = CMIM_FLAGS;
- if (!bEnable)
- clmi.flags |= CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&clmi);
-}
-
static int MSN_OnPrebuildContactMenu(WPARAM wParam, LPARAM lParam)
{
CMsnProto* ppro = GetProtoInstanceByHContact((HANDLE)wParam);
if (ppro)
ppro->OnPrebuildContactMenu(wParam, lParam);
- else
- {
- sttEnableMenuItem(hBlockMenuItem, false);
- sttEnableMenuItem(hLiveSpaceMenuItem, false);
- sttEnableMenuItem(hNetmeetingMenuItem, false);
- sttEnableMenuItem(hChatInviteMenuItem, false);
- sttEnableMenuItem(hOpenInboxMenuItem, false);
+ else {
+ Menu_ShowItem(hBlockMenuItem, false);
+ Menu_ShowItem(hLiveSpaceMenuItem, false);
+ Menu_ShowItem(hNetmeetingMenuItem, false);
+ Menu_ShowItem(hChatInviteMenuItem, false);
+ Menu_ShowItem(hOpenInboxMenuItem, false);
}
return 0;
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp
index e28d9f08fd..6aed26d1a0 100644
--- a/protocols/Yahoo/src/services.cpp
+++ b/protocols/Yahoo/src/services.cpp
@@ -391,8 +391,8 @@ void CYahooProto::MenuMainInit( void )
hRoot = mainMenuRoot = Menu_AddProtoMenuItem(&mi);
}
else {
- if ( mainMenuRoot )
- CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )mainMenuRoot, 0);
+ if (mainMenuRoot)
+ CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)mainMenuRoot, 0);
mainMenuRoot = NULL;
}
@@ -498,25 +498,20 @@ void CYahooProto::MenuContactInit( void )
void CYahooProto::MenuUninit( void )
{
if ( mainMenuRoot )
- CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )mainMenuRoot, 0);
+ CallService( MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)mainMenuRoot, 0);
- CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )hShowProfileMenuItem, 0);
+ CallService( MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hShowProfileMenuItem, 0);
}
int __cdecl CYahooProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
{
const HANDLE hContact = (HANDLE)wParam;
- if (!IsMyContact(hContact)) {
+ if (!IsMyContact(hContact)) {
DebugLog("[OnPrebuildContactMenu] Not a Yahoo Contact!!!");
return 0;
}
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
- if (GetWord( hContact, "yprotoid", 0) != 0)
- mi.flags |= CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hShowProfileMenuItem, (LPARAM)&mi);
+ Menu_ShowItem(hShowProfileMenuItem, GetWord(hContact, "yprotoid", 0) == 0);
return 0;
}
diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp
index bfbc5e61e8..864fedd128 100644
--- a/protocols/Yahoo/src/util.cpp
+++ b/protocols/Yahoo/src/util.cpp
@@ -61,7 +61,7 @@ int CYahooProto::DebugLog( const char *fmt, ... )
va_end( vararg );
- return CallService( MS_NETLIB_LOG, ( WPARAM )m_hNetlibUser, (LPARAM)str );
+ return CallService(MS_NETLIB_LOG, (WPARAM)m_hNetlibUser, (LPARAM)str);
}
extern HANDLE g_hNetlibUser;
@@ -78,7 +78,7 @@ int DebugLog( const char *fmt, ... )
va_end( vararg );
- return CallService( MS_NETLIB_LOG, ( WPARAM )g_hNetlibUser, (LPARAM)str );
+ return CallService(MS_NETLIB_LOG, (WPARAM)g_hNetlibUser, (LPARAM)str);
}
int CYahooProto::GetByte( const char* valueName, int parDefltValue )
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp
index 29eadd3304..ada93c72db 100644
--- a/protocols/Yahoo/src/yahoo.cpp
+++ b/protocols/Yahoo/src/yahoo.cpp
@@ -329,8 +329,8 @@ HANDLE CYahooProto::add_buddy( const char *yahoo_id, const char *yahoo_name, int
//not already there: add
LOG(("[add_buddy] Adding buddy id: %s (Nick: %s), flags: %lu", yid, yahoo_name, flags));
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_ADD, 0, 0);
- CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM )hContact,(LPARAM)m_szModuleName );
+ hContact = (HANDLE)CallService( MS_DB_CONTACT_ADD, 0, 0);
+ CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact,(LPARAM)m_szModuleName);
SetString( hContact, YAHOO_LOGINID, yid );
Set_Protocol( hContact, protocol );
diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp
index 26e9894606..ab38b19c07 100644
--- a/src/modules/clist/clui.cpp
+++ b/src/modules/clist/clui.cpp
@@ -85,7 +85,7 @@ static int CluiIconsChanged(WPARAM, LPARAM)
return 0;
}
-static HANDLE hRenameMenuItem;
+static HGENMENU hRenameMenuItem;
static int MenuItem_PreBuild(WPARAM, LPARAM)
{
@@ -93,14 +93,10 @@ static int MenuItem_PreBuild(WPARAM, LPARAM)
HANDLE hItem;
HWND hwndClist = GetFocus();
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
GetClassName(hwndClist, cls, SIZEOF(cls));
hwndClist = ( !lstrcmp( _T(CLISTCONTROL_CLASS), cls)) ? hwndClist : cli.hwndContactList;
hItem = (HANDLE) SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
- if ( !hItem)
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) hRenameMenuItem, (LPARAM) & mi);
+ Menu_ShowItem(hRenameMenuItem, hItem != 0);
return 0;
}
@@ -340,49 +336,44 @@ int LoadCLUIModule(void)
PostMessage(cli.hwndContactList, M_RESTORESTATUS, 0, 0);
- {
- int state = db_get_b(NULL, "CList", "State", SETTING_STATE_NORMAL);
- cli.hMenuMain = GetMenu(cli.hwndContactList);
- if ( !db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT))
- SetMenu(cli.hwndContactList, NULL);
- if (state == SETTING_STATE_NORMAL)
- ShowWindow(cli.hwndContactList, SW_SHOW);
- else if (state == SETTING_STATE_MINIMIZED)
- ShowWindow(cli.hwndContactList, SW_SHOWMINIMIZED);
- SetWindowPos(cli.hwndContactList,
- db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST,
- 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
- }
- {
- CLISTMENUITEM mi = { sizeof(mi) };
-
- CreateServiceFunction("CList/DeleteContactCommand", MenuItem_DeleteContact);
- mi.position = 2000070000;
- mi.flags = CMIF_ICONFROMICOLIB;
- mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_DELETE);
- mi.pszContactOwner = NULL; //on every contact
- mi.pszName = LPGEN("De&lete");
- mi.pszService = "CList/DeleteContactCommand";
- Menu_AddContactMenuItem(&mi);
-
- CreateServiceFunction("CList/RenameContactCommand", MenuItem_RenameContact);
- mi.position = 2000050000;
- mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_RENAME);
- mi.pszContactOwner = NULL; //on every contact
- mi.pszName = LPGEN("&Rename");
- mi.pszService = "CList/RenameContactCommand";
- hRenameMenuItem = Menu_AddContactMenuItem(&mi);
-
- CreateServiceFunction("CList/AddToListContactCommand", MenuItem_AddContactToList);
- mi.position = -2050000000;
- mi.flags |= CMIF_NOTONLIST;
- mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_ADDCONTACT);
- mi.pszName = LPGEN("&Add permanently to list");
- mi.pszService = "CList/AddToListContactCommand";
- Menu_AddContactMenuItem(&mi);
-
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU, MenuItem_PreBuild);
- }
+ int state = db_get_b(NULL, "CList", "State", SETTING_STATE_NORMAL);
+ cli.hMenuMain = GetMenu(cli.hwndContactList);
+ if ( !db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT))
+ SetMenu(cli.hwndContactList, NULL);
+ if (state == SETTING_STATE_NORMAL)
+ ShowWindow(cli.hwndContactList, SW_SHOW);
+ else if (state == SETTING_STATE_MINIMIZED)
+ ShowWindow(cli.hwndContactList, SW_SHOWMINIMIZED);
+ SetWindowPos(cli.hwndContactList,
+ db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST,
+ 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
+
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags = CMIF_ICONFROMICOLIB;
+
+ CreateServiceFunction("CList/DeleteContactCommand", MenuItem_DeleteContact);
+ mi.position = 2000070000;
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_DELETE);
+ mi.pszName = LPGEN("De&lete");
+ mi.pszService = "CList/DeleteContactCommand";
+ Menu_AddContactMenuItem(&mi);
+
+ CreateServiceFunction("CList/RenameContactCommand", MenuItem_RenameContact);
+ mi.position = 2000050000;
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_RENAME);
+ mi.pszName = LPGEN("&Rename");
+ mi.pszService = "CList/RenameContactCommand";
+ hRenameMenuItem = Menu_AddContactMenuItem(&mi);
+
+ CreateServiceFunction("CList/AddToListContactCommand", MenuItem_AddContactToList);
+ mi.position = -2050000000;
+ mi.flags |= CMIF_NOTONLIST;
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_ADDCONTACT);
+ mi.pszName = LPGEN("&Add permanently to list");
+ mi.pszService = "CList/AddToListContactCommand";
+ Menu_AddContactMenuItem(&mi);
+
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, MenuItem_PreBuild);
return 0;
}
diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp
index 8c47bb8862..98197ddaf4 100644
--- a/src/modules/findadd/findadd.cpp
+++ b/src/modules/findadd/findadd.cpp
@@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static HWND hwndFindAdd = NULL;
static HANDLE hHookModulesLoaded = 0;
-static HANDLE hMainMenuItem = NULL;
+static HGENMENU hMainMenuItem = NULL;
static int OnSystemModulesLoaded(WPARAM wParam, LPARAM lParam);
static int FindAddDlgResizer(HWND, LPARAM lParam, UTILRESIZECONTROL *urc)
@@ -1046,10 +1046,6 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM)
netProtoCount++;
}
- CLISTMENUITEM cmi = { sizeof(cmi) };
- cmi.flags = CMIM_FLAGS;
- if (netProtoCount == 0)
- cmi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMainMenuItem, (LPARAM)&cmi);
+ Menu_ShowItem(hMainMenuItem, netProtoCount != 0);
return 0;
}