diff options
author | George Hazan <george.hazan@gmail.com> | 2014-05-30 15:31:28 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-05-30 15:31:28 +0000 |
commit | 581204a18bc5a50d1c8a7412e147e560503d11b8 (patch) | |
tree | 59f78fa2cc227e4feae48c9cf4e10544c80c4c71 | |
parent | fd0d38e50db088692bfff7608df3b765d804e847 (diff) |
db_mc_getMostOnline - a handy helper for MS_MC_GETMOSTONLINECONTACT
git-svn-id: http://svn.miranda-ng.org/main/trunk@9372 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
35 files changed, 422 insertions, 562 deletions
diff --git a/include/m_metacontacts.h b/include/m_metacontacts.h index 9be9c6819a..3b9ba43d14 100644 --- a/include/m_metacontacts.h +++ b/include/m_metacontacts.h @@ -70,6 +70,10 @@ extern "C" {
#endif
+MCONTACT __forceinline db_mc_getMostOnline(MCONTACT hContact)
+{ return CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+}
+
// checks whether metacontacts are enabled
MIR_CORE_DLL(BOOL) db_mc_isEnabled(void);
MIR_CORE_DLL(void) db_mc_enable(BOOL);
diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp index ec4171836f..4e7c28bdab 100644 --- a/plugins/AVS/src/cache.cpp +++ b/plugins/AVS/src/cache.cpp @@ -154,8 +154,7 @@ void NotifyMetaAware(MCONTACT hContact, CacheNode *node = NULL, AVATARCACHEENTRY if ((node->dwFlags & MC_ISSUBCONTACT) && db_get_b(NULL, META_PROTO, "Enabled", 0)) {
MCONTACT hMasterContact = db_mc_getMeta(hContact);
- if (hMasterContact && (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hMasterContact, 0) == hContact &&
- !db_get_b(hMasterContact, "ContactPhoto", "Locked", 0))
+ if (hMasterContact && db_mc_getMostOnline(hMasterContact) == hContact && !db_get_b(hMasterContact, "ContactPhoto", "Locked", 0))
NotifyEventHooks(hEventChanged, (WPARAM)hMasterContact, (LPARAM)ace);
}
diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index 2565b6cad7..244282cc25 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -514,7 +514,7 @@ MCONTACT GetContactThatHaveTheAvatar(MCONTACT hContact, int locked) locked = db_get_b(hContact, "ContactPhoto", "Locked", 0);
if (!locked)
- hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ hContact = db_mc_getMostOnline(hContact);
}
}
return hContact;
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index febfdd72f8..fce65a6422 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -205,7 +205,7 @@ void CSmileyString::ReplaceSmileys(struct SHORTDATA *dat, ClcCacheEntry *pdnce, sp.Protocolname = pdnce->m_cache_cszProto;
if (db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) != 1 && pdnce->m_cache_cszProto != NULL && strcmp(pdnce->m_cache_cszProto, META_PROTO) == 0) {
- MCONTACT hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (LPARAM)pdnce->hContact, 0);
+ MCONTACT hContact = db_mc_getMostOnline(pdnce->hContact);
if (hContact != 0)
sp.Protocolname = GetContactProto(hContact);
}
diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index b4e4d06ab1..aa9dade438 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -89,7 +89,7 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, MCONTACT hContact) MCONTACT hActContact = hContact;
if (!db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) && !mir_strcmp(szActProto, META_PROTO)) {
// substitute params by mostonline contact datas
- MCONTACT hMostOnlineContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hActContact, 0);
+ MCONTACT hMostOnlineContact = db_mc_getMostOnline(hActContact);
if (hMostOnlineContact) {
ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hMostOnlineContact);
if (cacheEntry && cacheEntry->m_cache_cszProto) {
diff --git a/plugins/Clist_mw/src/clistmod.cpp b/plugins/Clist_mw/src/clistmod.cpp index 7c998de4db..869fcfc56c 100644 --- a/plugins/Clist_mw/src/clistmod.cpp +++ b/plugins/Clist_mw/src/clistmod.cpp @@ -50,7 +50,7 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, MCONTACT hContact) MCONTACT hActContact = hContact;
if (!db_get_b(NULL, "CLC", "Meta", 0) && !strcmp(szActProto, META_PROTO)) {
// substitute params by mostonline contact datas
- MCONTACT hMostOnlineContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hActContact, 0);
+ MCONTACT hMostOnlineContact = db_mc_getMostOnline(hActContact);
if (hMostOnlineContact && hMostOnlineContact != (MCONTACT)CALLSERVICE_NOTFOUND) {
ClcCacheEntry *cacheEntry = (ClcCacheEntry *)pcli->pfnGetCacheEntry(hMostOnlineContact);
if (cacheEntry && cacheEntry->szProto) {
@@ -74,19 +74,6 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, MCONTACT hContact) int ExtIconFromStatusMode(MCONTACT hContact, const char *szProto,int status)
{
-/* if ( db_get_b( NULL, "CLC", "Meta", 0 ) == 1 )
- return pcli->pfnIconFromStatusMode(szProto,status,hContact);
-
- if ( szProto != NULL ) {
- if (strcmp(szProto,"MetaContacts") == 0 ) {
- hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT,(UINT)hContact,0);
- if ( hContact != 0 ) {
- szProto = GetContactProto((UINT)hContact,0);
- status = db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE);
- }
- }
- }*/
-
return pcli->pfnIconFromStatusMode(szProto,status,hContact);
}
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 725d78358b..5af0e66a5d 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -385,7 +385,7 @@ LBL_Def: break;
if (contact->bIsMeta && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) {
- contact->hSubContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)contact->hContact, 0);
+ contact->hSubContact = db_mc_getMostOnline(contact->hContact);
contact->metaProto = GetContactProto(contact->hSubContact);
contact->iImage = pcli->pfnGetContactIcon(contact->hSubContact);
if (contact->pExtra) {
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index cc80971641..e0a21a84b7 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -105,7 +105,7 @@ int AddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hContact) else
p->bIsMeta = FALSE;
if (p->bIsMeta && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) {
- p->hSubContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ p->hSubContact = db_mc_getMostOnline(hContact);
p->metaProto = GetContactProto(p->hSubContact);
p->iImage = pcli->pfnGetContactIcon(p->hSubContact);
}
diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index b83aa19b74..bcdd29a34c 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -55,7 +55,7 @@ int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact, HICON int finalStatus;
if (szProto != NULL && !strcmp(szProto, META_PROTO) && hContact != 0 && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) {
- MCONTACT hSubContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ MCONTACT hSubContact = db_mc_getMostOnline(hContact);
szFinalProto = GetContactProto(hSubContact);
finalStatus = (status == 0) ? (WORD) cfg::getWord(hSubContact, szFinalProto, "Status", ID_STATUS_OFFLINE) : status;
hContact = hSubContact;
diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp index 6557980145..67bf8f0161 100644 --- a/plugins/IEView/src/HTMLBuilder.cpp +++ b/plugins/IEView/src/HTMLBuilder.cpp @@ -149,7 +149,7 @@ char* HTMLBuilder::getRealProto(MCONTACT hContact) char *szProto = mir_strdup(GetContactProto(hContact));
if (szProto != NULL && !strcmp(szProto, META_PROTO)) {
- hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ hContact = db_mc_getMostOnline(hContact);
if (hContact != NULL) {
mir_free(szProto);
szProto = mir_strdup(GetContactProto(hContact));
@@ -161,7 +161,7 @@ char* HTMLBuilder::getRealProto(MCONTACT hContact) char *HTMLBuilder::getRealProto(MCONTACT hContact, const char *szProto)
{
if (szProto != NULL && !strcmp(szProto, META_PROTO)) {
- hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ hContact = db_mc_getMostOnline(hContact);
if (hContact != NULL)
return mir_strdup(GetContactProto(hContact));
}
@@ -172,7 +172,7 @@ MCONTACT HTMLBuilder::getRealContact(MCONTACT hContact) {
char *szProto = GetContactProto(hContact);
if (szProto != NULL && !strcmp(szProto, META_PROTO))
- hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ hContact = db_mc_getMostOnline(hContact);
return hContact;
}
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index 16f00fbdc9..fa49ad2906 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -247,7 +247,7 @@ BOOL metaCheckProtocol(char *szProto, MCONTACT hContact, WORD eventType) MCONTACT hSubContact=NULL;
if (bMetaProtoEnabled && szProto && !strcmp(META_PROTO, szProto))
- if (hSubContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0))
+ if (hSubContact = db_mc_getMostOnline(hContact))
szProto = GetContactProto(hSubContact);
return checkProtocol(szProto) && checkIgnore(hSubContact?hSubContact:hContact, eventType);
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 38d0187e8d..46a1ab65e3 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -268,11 +268,6 @@ BOOL isMetaContact(MCONTACT hContact) return FALSE;
}
-MCONTACT getMostOnline(MCONTACT hContact)
-{
- return (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
-}
-
void GetID(MCONTACT hContact, LPSTR szProto, LPSTR szID)
{
DBVARIANT dbv_uniqueid;
@@ -336,19 +331,12 @@ BOOL IPExists(MCONTACT hContact) BOOL MirVerExists(MCONTACT hContact)
{
- LPSTR szProto, msg;
- BOOL ret = 0;
-
- szProto = GetContactProto(hContact);
- if (!szProto) return 0;
-
- msg = db_get_sa(hContact,szProto,"MirVer");
- if (msg) {
- if (strlen(msg)) ret = 1;
- mir_free(msg);
- }
+ LPSTR szProto = GetContactProto(hContact);
+ if (!szProto)
+ return 0;
- return ret;
+ ptrT msg(db_get_tsa(hContact, szProto, "MirVer"));
+ return lstrlen(msg) != 0;
}
void getIP(MCONTACT hContact,LPSTR szProto,LPSTR szIP)
@@ -506,7 +494,7 @@ void ModifyCopyID(MCONTACT hContact, BOOL bShowID, BOOL bTrimID) mi.flags = CMIM_ICON | CMIM_NAME | CMIF_UNICODE;
if (isMetaContact(hContact)) {
- MCONTACT hC = getMostOnline(hContact);
+ MCONTACT hC = db_mc_getMostOnline(hContact);
if (!hContact) hC = db_mc_getDefault(hContact);
hContact = hC;
}
@@ -605,7 +593,7 @@ INT_PTR onCopyID(WPARAM wparam, LPARAM lparam) MCONTACT hContact = (MCONTACT)wparam;
if (isMetaContact(hContact)) {
- MCONTACT hC = getMostOnline(hContact);
+ MCONTACT hC = db_mc_getMostOnline(hContact);
if (!hContact)
hC = db_mc_getDefault(hContact);
hContact = hC;
diff --git a/plugins/MirOTR/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/MirOTR/src/dbfilter.cpp index 795a058c0c..7ee8866104 100644 --- a/plugins/MirOTR/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/MirOTR/src/dbfilter.cpp @@ -62,7 +62,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) return 0;
if(strcmp(proto, META_PROTO) == 0) {
- hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ hContact = db_mc_getMostOnline(hContact);
if (!hContact) return 0;
proto = contact_get_proto(hContact);
if (!proto ) return 0;
@@ -196,7 +196,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) if (!db_event_get((HANDLE)lParam, &info)) {
if(info.eventType == EVENTTYPE_MESSAGE) {
MCONTACT hSub;
- if((hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
+ if((hSub = db_mc_getMostOnline(hContact)) != 0)
hContact = hSub;
ConnContext *context = otrl_context_find_miranda(otr_user_state, hContact);
@@ -252,7 +252,7 @@ int WindowEvent(WPARAM wParam, LPARAM lParam) { if(mwd->uType != MSG_WINDOW_EVT_OPEN) return 0;
MCONTACT hContact = mwd->hContact, hTemp;
- if((hTemp = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
+ if((hTemp = db_mc_getMostOnline(hContact)) != 0)
hContact = hTemp;
if (!CallService(MS_PROTO_ISPROTOONCONTACT, hContact, (LPARAM)MODULENAME))
diff --git a/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp index 317fcd749f..d446e8b57f 100644 --- a/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp +++ b/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp @@ -86,7 +86,7 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam,LPARAM) return TRUE;
MCONTACT hContact = (MCONTACT)pcpp->wParam, hSub;
- if((hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
+ if((hSub = db_mc_getMostOnline(hContact)) != 0)
hContact = hSub;
TrustLevel level = ( TrustLevel )otr_context_get_trust(otrl_context_find_miranda(otr_user_state, hContact));
diff --git a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp index de7aa6c4e6..0c636c36f0 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp @@ -26,7 +26,7 @@ int StartOTR(MCONTACT hContact) { INT_PTR SVC_StartOTR(WPARAM hContact, LPARAM lParam)
{
MCONTACT hSub;
- if((hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
+ if((hSub = db_mc_getMostOnline(hContact)) != 0)
hContact = hSub;
if ( options.bHaveSecureIM && CallService("SecureIM/IsContactSecured", hContact, 0) != 0 ) {
@@ -46,7 +46,7 @@ INT_PTR SVC_StartOTR(WPARAM hContact, LPARAM lParam) INT_PTR SVC_RefreshOTR(WPARAM hContact, LPARAM lParam)
{
MCONTACT hSub;
- if((hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
+ if((hSub = db_mc_getMostOnline(hContact)) != 0)
hContact = hSub;
if ( options.bHaveSecureIM && CallService("SecureIM/IsContactSecured", hContact, 0) != 0 ) {
@@ -69,7 +69,7 @@ INT_PTR SVC_RefreshOTR(WPARAM hContact, LPARAM lParam) int otr_disconnect_contact(MCONTACT hContact)
{
MCONTACT hSub;
- if(ServiceExists(MS_MC_GETMOSTONLINECONTACT) && (hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
+ if((hSub = db_mc_getMostOnline(hContact)) != 0)
hContact = hSub;
const char *proto = contact_get_proto(hContact);
@@ -100,7 +100,7 @@ INT_PTR SVC_StopOTR(WPARAM hContact, LPARAM lParam) INT_PTR SVC_VerifyOTR(WPARAM hContact, LPARAM lParam)
{
MCONTACT hSub;
- if((hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
+ if((hSub = db_mc_getMostOnline(hContact)) != 0)
hContact = hSub;
ConnContext *context = otrl_context_find_miranda(otr_user_state, hContact);
@@ -166,7 +166,7 @@ hide_all: if(proto && strcmp(proto, META_PROTO) == 0) {
// make menu act as per most online subcontact
- hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ hContact = db_mc_getMostOnline(hContact);
if (!hContact)
goto hide_all;
proto = contact_get_proto(hContact);
diff --git a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp index fc273282b2..f7ea8c2167 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp @@ -71,7 +71,7 @@ void SetEncryptionStatus(MCONTACT hContact, TrustLevel level) if (!chat_room) {
MCONTACT hMeta = db_mc_getMeta(hContact);
- MCONTACT hMostOnline = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hMeta, 0);
+ MCONTACT hMostOnline = db_mc_getMostOnline(hMeta);
if(hMeta && hContact == hMostOnline)
SetEncryptionStatus(hMeta, level);
else if(hMeta) {
diff --git a/plugins/MirOTR/MirOTR/src/utils.cpp b/plugins/MirOTR/MirOTR/src/utils.cpp index 0adebc46e5..9782eca20b 100644 --- a/plugins/MirOTR/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/MirOTR/src/utils.cpp @@ -352,26 +352,6 @@ void ShowMessage(const MCONTACT hContact, const TCHAR *msg) { ShowPopup(TranslateT(LANG_OTR_INFO), msg, 0, hContact);
}
-
-/*
-bool GetEncryptionStatus(MCONTACT hContact) {
- char *proto = GetContactProto(hContact);
- bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0));
-
- if (!chat_room) {
- if (options.bHaveMetaContacts) {
- HANDLE hMeta = (HANDLE)CallService(MS_MC_GETMETACONTACT, hContact, 0);
- if(hMeta && hContact == (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hMeta, 0)) {
- //strcat(dbg_msg, "\nrecursing for meta");
- return GetEncryptionStatus(hMeta);
- }
- return 0!=db_get_b(hContact, MODULENAME, "Encrypted", 0 );
- }
- }
- return 0;
-}
-*/
-
const TCHAR *policy_to_string(OtrlPolicy policy) {
switch (policy) {
case OTRL_POLICY_NEVER:
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index b3d2fa8f18..26886b1404 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -784,7 +784,7 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus,WORD newStatus) }
if (!strcmp(szProto, META_PROTO)) { //this contact is Meta
- MCONTACT hSubContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ MCONTACT hSubContact = db_mc_getMostOnline(hContact);
char *szSubProto = GetContactProto(hSubContact);
if (szSubProto == NULL)
return 0;
diff --git a/plugins/New_GPG/src/metacontacts.cpp b/plugins/New_GPG/src/metacontacts.cpp index 42d2050f75..7db1725be3 100644 --- a/plugins/New_GPG/src/metacontacts.cpp +++ b/plugins/New_GPG/src/metacontacts.cpp @@ -33,6 +33,6 @@ bool metaIsDefaultSubContact(MCONTACT hContact) MCONTACT metaGetMostOnline(MCONTACT hContact)
{
if(metaIsProtoMetaContacts(hContact))
- return (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT,hContact,0);
+ return db_mc_getMostOnline(hContact);
return NULL;
}
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index 1b9f82ad51..6cd7065ba3 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -455,12 +455,9 @@ void EnableButtons(HWND hwndDlg, MCONTACT hContact) else
{
// Is a meta?
- if (ServiceExists(MS_MC_GETMOSTONLINECONTACT))
- {
- MCONTACT hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
- if (hSub != NULL)
- hContact = hSub;
- }
+ MCONTACT hSub = db_mc_getMostOnline(hContact);
+ if (hSub != NULL)
+ hContact = hSub;
// Get caps
INT_PTR caps = 0;
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 2511c65cc6..a079227134 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -258,7 +258,7 @@ void SetStatusIcon(SrmmWindowData *dat) MCONTACT hContact = dat->windowData.hContact;
if (!strcmp(dat->szProto, META_PROTO) && db_get_b(NULL,"CLC","Meta",0) == 0) {
- hContact = CallService(MS_MC_GETMOSTONLINECONTACT, dat->windowData.hContact, 0);
+ hContact = db_mc_getMostOnline(dat->windowData.hContact);
if (hContact != NULL)
szProto = GetContactProto(hContact);
else
@@ -1760,7 +1760,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, META_PROTO) == 0) {
- MCONTACT hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)dat->windowData.hContact, 0);
+ MCONTACT hContact = db_mc_getMostOnline(dat->windowData.hContact);
if (hContact != NULL) {
smaddInfo.Protocolname = GetContactProto(hContact);
}
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index a72b25cd85..5e4485a9aa 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -918,7 +918,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, META_PROTO) == 0) {
- MCONTACT hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)dat->windowData.hContact, 0);
+ MCONTACT hContact = db_mc_getMostOnline(dat->windowData.hContact);
if (hContact != NULL)
smre.Protocolname = GetContactProto(hContact);
}
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 738d552810..997243ea5a 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -63,7 +63,7 @@ int IsAutoPopup(MCONTACT hContact) { if (g_dat.flags & SMF_AUTOPOPUP) {
char *szProto = GetContactProto(hContact);
if (strcmp(szProto, META_PROTO) == 0) {
- hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ hContact = db_mc_getMostOnline(hContact);
if (hContact != NULL)
szProto = GetContactProto(hContact);
}
diff --git a/plugins/SecureIM/src/crypt.h b/plugins/SecureIM/src/crypt.h index 42bbe51f9b..7b68e027f5 100644 --- a/plugins/SecureIM/src/crypt.h +++ b/plugins/SecureIM/src/crypt.h @@ -146,7 +146,6 @@ void showPopupRM(MCONTACT); // crypt_meta.cpp
BOOL isProtoMetaContacts(MCONTACT);
BOOL isDefaultSubContact(MCONTACT);
-MCONTACT getMostOnline(MCONTACT);
void DeinitMetaContact(MCONTACT);
// crypt_dll.cpp
diff --git a/plugins/SecureIM/src/crypt_check.cpp b/plugins/SecureIM/src/crypt_check.cpp index 2359af5240..941e279220 100644 --- a/plugins/SecureIM/src/crypt_check.cpp +++ b/plugins/SecureIM/src/crypt_check.cpp @@ -24,7 +24,7 @@ BYTE isContactSecured(MCONTACT hContact) if (!arClist.getCount()) return 0;
if (isProtoMetaContacts(hContact))
- hContact = getMostOnline(hContact); // возьмем тот, через который пойдет сообщение
+ hContact = db_mc_getMostOnline(hContact); // возьмем тот, через который пойдет сообщение
pUinKey p = findUinKey(hContact);
if (!p || !p->proto || !p->proto->inspecting)
diff --git a/plugins/SecureIM/src/crypt_metacontacts.cpp b/plugins/SecureIM/src/crypt_metacontacts.cpp index ababa88f60..54d3ffd797 100644 --- a/plugins/SecureIM/src/crypt_metacontacts.cpp +++ b/plugins/SecureIM/src/crypt_metacontacts.cpp @@ -13,11 +13,6 @@ BOOL isDefaultSubContact(MCONTACT hContact) return db_mc_getDefault(db_mc_getMeta(hContact)) == hContact;
}
-MCONTACT getMostOnline(MCONTACT hContact)
-{
- return (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
-}
-
// remove all secureim connections on subcontacts
void DeinitMetaContact(MCONTACT hContact)
{
diff --git a/plugins/SecureIM/src/svcs_clist.cpp b/plugins/SecureIM/src/svcs_clist.cpp index a25f9f91f4..bb1f422cbe 100644 --- a/plugins/SecureIM/src/svcs_clist.cpp +++ b/plugins/SecureIM/src/svcs_clist.cpp @@ -67,7 +67,8 @@ int __cdecl onExtraImageApplying(WPARAM wParam, LPARAM) int __cdecl onRebuildContactMenu(WPARAM hContact,LPARAM lParam)
{
BOOL bMC = isProtoMetaContacts(hContact);
- if (bMC ) hContact = getMostOnline(hContact); // возьмем тот, через который пойдет сообщение
+ if (bMC)
+ hContact = db_mc_getMostOnline(hContact); // возьмем тот, через который пойдет сообщение
pUinKey ptr = getUinKey(hContact);
int i;
CLISTMENUITEM mi = { sizeof(mi) };
@@ -153,5 +154,4 @@ int __cdecl onRebuildContactMenu(WPARAM hContact,LPARAM lParam) return 0;
}
-
// EOF
diff --git a/plugins/SecureIM/src/svcs_srmm.cpp b/plugins/SecureIM/src/svcs_srmm.cpp index de0b384350..e9ba237a51 100644 --- a/plugins/SecureIM/src/svcs_srmm.cpp +++ b/plugins/SecureIM/src/svcs_srmm.cpp @@ -12,7 +12,7 @@ int __cdecl onWindowEvent(WPARAM, LPARAM lParam) int __cdecl onIconPressed(WPARAM hContact, LPARAM lParam)
{
if (isProtoMetaContacts(hContact))
- hContact = getMostOnline(hContact); // возьмем тот, через который пойдет сообщение
+ hContact = db_mc_getMostOnline(hContact); // возьмем тот, через который пойдет сообщение
StatusIconClickData *sicd = (StatusIconClickData *)lParam;
if (strcmp(sicd->szModule, MODULENAME) != 0 || !isSecureProtocol(hContact))
diff --git a/plugins/SmileyAdd/src/general.cpp b/plugins/SmileyAdd/src/general.cpp index 403d196cfb..535eb37d5f 100644 --- a/plugins/SmileyAdd/src/general.cpp +++ b/plugins/SmileyAdd/src/general.cpp @@ -213,8 +213,10 @@ void DestroyGdiPlus(void) MCONTACT DecodeMetaContact(MCONTACT hContact)
{
- if (hContact == NULL) return NULL;
- MCONTACT hReal = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ if (hContact == NULL)
+ return NULL;
+
+ MCONTACT hReal = db_mc_getMostOnline(hContact);
if (hReal == NULL || hReal == (MCONTACT)CALLSERVICE_NOTFOUND)
hReal = hContact;
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 6d9f900326..75337b1161 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -150,7 +150,7 @@ bool CContactCache::updateStatus() */
void CContactCache::updateMeta(bool fForce)
{
- m_szMetaProto = (m_Valid) ? GetContactProto(CallService(MS_MC_GETMOSTONLINECONTACT, cc->contactID, 0)) : NULL;
+ m_szMetaProto = (m_Valid) ? GetContactProto(db_mc_getMostOnline(cc->contactID)) : NULL;
}
/**
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index f8f876b80f..ff669fcf33 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -1,31 +1,30 @@ /*
- * Miranda NG: the free IM client for Microsoft* Windows*
- *
- * Copyright (c) 2000-09 Miranda ICQ/IM project,
- * all portions of this codebase are copyrighted to the people
- * listed in contributors.txt.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * you should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * part of tabSRMM messaging plugin for Miranda.
- *
- * (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors
- *
- * implements the "Container" window which acts as a toplevel window
- * for message sessions.
- *
+// Miranda NG: the free IM client for Microsoft* Windows*
+//
+// Copyright (c) 2000-09 Miranda ICQ/IM project,
+// all portions of this codebase are copyrighted to the people
+// listed in contributors.txt.
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// you should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// part of tabSRMM messaging plugin for Miranda.
+//
+// (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors
+//
+// implements the "Container" window which acts as a toplevel window
+// for message sessions.
*/
#include "commonheaders.h"
@@ -53,12 +52,10 @@ static int ServiceParamsOK(ButtonItem *item, WPARAM *wParam, LPARAM *lParam, MCO return 1; // doesn't need a paramter
}
-/*
- * Windows Vista+
- * extend the glassy area to get aero look for the status bar, tab bar, info panel
- * and outer margins.
- */
-
+// Windows Vista+
+// extend the glassy area to get aero look for the status bar, tab bar, info panel
+// and outer margins.
+
void TSAPI SetAeroMargins(TContainerData *pContainer)
{
if ( !M.isAero() || !pContainer || CSkin::m_skinEnabled) {
@@ -91,10 +88,7 @@ void TSAPI SetAeroMargins(TContainerData *pContainer) m.cyTopHeight = pt.y;
pContainer->MenuBar->setAero(true);
- /*
- * bottom part
- */
-
+ // bottom part
GetWindowRect(dat->hwnd, &rcWnd);
pt.x = rcWnd.left;
@@ -126,36 +120,28 @@ void TSAPI SetAeroMargins(TContainerData *pContainer) }
}
-/*
- * CreateContainer MUST mir_alloc() a struct ContainerWindowData and pass its address
- * to CreateDialogParam() via the LPARAM. It also adds the struct to the linked list
- * of containers.
- *
- * The WM_DESTROY handler of the container DlgProc is responsible for mir_free()'ing the
- * pointer and for removing the struct from the linked list.
- */
-
+// CreateContainer MUST allocate a ContainerWindowData and pass its address
+// to CreateDialogParam() via the LPARAM. It also adds the struct to the linked list
+// of containers.
+//
+// The WM_DESTROY handler of the container DlgProc is responsible for mir_free()'ing the
+// pointer and for removing the struct from the linked list.
+
TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, MCONTACT hContactFrom)
{
if (CMimAPI::m_shutDown)
return NULL;
- int iFirstFree = -1, iFound = FALSE;
-
TContainerData *pContainer = (TContainerData*)mir_calloc(sizeof(TContainerData));
- if (!pContainer)
- return NULL;
-
_tcsncpy(pContainer->szName, name, CONTAINER_NAMELEN + 1);
AppendToContainerList(pContainer);
if (M.GetByte("limittabs", 0) && !_tcscmp(name, _T("default")))
iTemp |= CNT_CREATEFLAG_CLONED;
- /*
- * save container name to the db
- */
- int i=0;
+
+ // save container name to the db
if (!M.GetByte("singlewinmode", 0)) {
+ int iFirstFree = -1, iFound = FALSE, i = 0;
do {
char szCounter[10];
itoa(i, szCounter, 10);
@@ -267,15 +253,12 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, rcText.left += CSkin::m_captionPadding;
DrawText(dcMem, szWindowText, -1, &rcText, DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
SelectObject(dcMem, hOldFont);
- /*
- * icon
- */
+ // icon
hIcon = (HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0);
DrawIconEx(dcMem, 4 + CSkin::m_SkinnedFrame_left + CSkin::m_bClipBorder + CSkin::m_titleBarLeftOff, rcText.top + (rcText.bottom - rcText.top) / 2 - 8, hIcon, 16, 16, 0, 0, DI_NORMAL);
- // title buttons;
-
+ // title buttons
pContainer->rcClose.top = pContainer->rcMin.top = pContainer->rcMax.top = CSkin::m_titleButtonTopOff;
pContainer->rcClose.bottom = pContainer->rcMin.bottom = pContainer->rcMax.bottom = CSkin::m_titleButtonTopOff + CSkin::m_titleBarButtonSize.cy;
@@ -452,6 +435,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, }
}
break;
+
case WM_SETCURSOR:
if (CSkin::m_frameSkins && (HWND)wParam == hwndDlg) {
DefWindowProc(hwndDlg, msg, wParam, lParam);
@@ -544,10 +528,8 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, return mir_callNextSubclass(hwndDlg, ContainerWndProc, msg, wParam, lParam);
}
-/*
- * container window procedure...
- */
-
+// container window procedure...
+
static BOOL fHaveTipper = FALSE;
static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -615,10 +597,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, SetClassLongPtr(hwndDlg, GCL_STYLE, GetClassLongPtr(hwndDlg, GCL_STYLE) & ~CS_DROPSHADOW);
- /*
- * additional system menu items...
- */
-
+ // additional system menu items...
HMENU hSysmenu = GetSystemMenu(hwndDlg, FALSE);
int iMenuItems = GetMenuItemCount(hSysmenu);
@@ -631,10 +610,8 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, SetWindowText(hwndDlg, TranslateT("Message Session..."));
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)PluginConfig.g_iconContainer);
- /*
- * make the tab control the controlling parent window for all message dialogs
- */
-
+ // make the tab control the controlling parent window for all message dialogs
+
ws = GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSGTABS), GWL_EXSTYLE);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSGTABS), GWL_EXSTYLE, ws | WS_EX_CONTROLPARENT);
@@ -650,14 +627,10 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, SendMessage(hwndDlg, DM_CONFIGURECONTAINER, 0, 10);
- /*
- * context menu
- */
+ // context menu
pContainer->hMenuContext = PluginConfig.g_hMenuContext;
- /*
- * tab tooltips...
- */
+ // tab tooltips...
if (!fHaveTipper || M.GetByte("d_tooltips", 0) == 0) {
pContainer->hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, hwndDlg, NULL, g_hInst, (LPVOID) NULL);
@@ -689,9 +662,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, }
}
- /*
- * prevent ugly back background being visible while tabbed clients are created
- */
+ // prevent ugly back background being visible while tabbed clients are created
if (M.isAero()) {
MARGINS m = {-1};
CMimAPI::m_pfnDwmExtendFrameIntoClientArea(hwndDlg, &m);
@@ -699,33 +670,29 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, return TRUE;
case DM_RESTOREWINDOWPOS:
- {
- char szCName[CONTAINER_NAMELEN + 20];
- /*
- * retrieve the container window geometry information from the database.
- */
- if (pContainer->isCloned && pContainer->hContactFrom != 0 && !(pContainer->dwFlags & CNT_GLOBALSIZE)) {
- if (Utils_RestoreWindowPosition(hwndDlg, pContainer->hContactFrom, SRMSGMOD_T, "split")) {
- if (Utils_RestoreWindowPositionNoMove(hwndDlg, pContainer->hContactFrom, SRMSGMOD_T, "split"))
- if (Utils_RestoreWindowPosition(hwndDlg, NULL, SRMSGMOD_T, "split"))
- if (Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, SRMSGMOD_T, "split"))
- SetWindowPos(hwndDlg, 0, 50, 50, 450, 300, SWP_NOZORDER | SWP_NOACTIVATE);
- }
- }
- else {
- if (pContainer->dwFlags & CNT_GLOBALSIZE) {
+ // retrieve the container window geometry information from the database.
+ if (pContainer->isCloned && pContainer->hContactFrom != 0 && !(pContainer->dwFlags & CNT_GLOBALSIZE)) {
+ if (Utils_RestoreWindowPosition(hwndDlg, pContainer->hContactFrom, SRMSGMOD_T, "split")) {
+ if (Utils_RestoreWindowPositionNoMove(hwndDlg, pContainer->hContactFrom, SRMSGMOD_T, "split"))
if (Utils_RestoreWindowPosition(hwndDlg, NULL, SRMSGMOD_T, "split"))
if (Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, SRMSGMOD_T, "split"))
SetWindowPos(hwndDlg, 0, 50, 50, 450, 300, SWP_NOZORDER | SWP_NOACTIVATE);
- }
- else {
- mir_snprintf(szCName, sizeof(szCName), "%s%d", CONTAINER_PREFIX, pContainer->iContainerIndex);
- if (Utils_RestoreWindowPosition(hwndDlg, NULL, SRMSGMOD_T, szCName)) {
- if (Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, SRMSGMOD_T, szCName))
- if (Utils_RestoreWindowPosition(hwndDlg, NULL, SRMSGMOD_T, "split"))
- if (Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, SRMSGMOD_T, "split"))
- SetWindowPos(hwndDlg, 0, 50, 50, 450, 300, SWP_NOZORDER | SWP_NOACTIVATE);
- }
+ }
+ }
+ else {
+ if (pContainer->dwFlags & CNT_GLOBALSIZE) {
+ if (Utils_RestoreWindowPosition(hwndDlg, NULL, SRMSGMOD_T, "split"))
+ if (Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, SRMSGMOD_T, "split"))
+ SetWindowPos(hwndDlg, 0, 50, 50, 450, 300, SWP_NOZORDER | SWP_NOACTIVATE);
+ }
+ else {
+ char szCName[CONTAINER_NAMELEN + 20];
+ mir_snprintf(szCName, sizeof(szCName), "%s%d", CONTAINER_PREFIX, pContainer->iContainerIndex);
+ if (Utils_RestoreWindowPosition(hwndDlg, NULL, SRMSGMOD_T, szCName)) {
+ if (Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, SRMSGMOD_T, szCName))
+ if (Utils_RestoreWindowPosition(hwndDlg, NULL, SRMSGMOD_T, "split"))
+ if (Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, SRMSGMOD_T, "split"))
+ SetWindowPos(hwndDlg, 0, 50, 50, 450, 300, SWP_NOZORDER | SWP_NOACTIVATE);
}
}
}
@@ -787,11 +754,9 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, pContainer->preSIZE.cy = rcClient.bottom - rcClient.top;
}
- /*
- * we care about all client sessions, but we really resize only the active tab (hwndActive)
- * we tell inactive tabs to resize theirselves later when they get activated (DM_CHECKSIZE
- * just queues a resize request)
- */
+ // we care about all client sessions, but we really resize only the active tab (hwndActive)
+ // we tell inactive tabs to resize theirselves later when they get activated (DM_CHECKSIZE
+ // just queues a resize request)
int nCount = TabCtrl_GetItemCount(hwndTab);
for (int i=0; i < nCount; i++) {
@@ -902,7 +867,7 @@ panel_found: if (pContainer->hwndActive && IsWindow(pContainer->hwndActive))
ShowWindow(pContainer->hwndActive, SW_HIDE);
}
- pContainer->hwndActive = (HWND) item.lParam;
+ pContainer->hwndActive = (HWND)item.lParam;
SendMessage((HWND)item.lParam, DM_SAVESIZE, 0, 1);
ShowWindow((HWND)item.lParam, SW_SHOW);
if (!IsIconic(hwndDlg))
@@ -911,9 +876,7 @@ panel_found: SendMessage(hwndTab, EM_VALIDATEBOTTOM, 0, 0);
return 0;
- /*
- * tooltips
- */
+ // tooltips
case NM_RCLICK:
{
int iItem;
@@ -935,9 +898,7 @@ panel_found: if (item.lParam && IsWindow((HWND)item.lParam))
dat = (TWindowData*)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
}
- /*
- * sent from a sidebar button (RMB click) instead of the tab control
- */
+ // sent from a sidebar button (RMB click) instead of the tab control
else if (((LPNMHDR)lParam)->idFrom == 5000) {
TSideBarNotify* n = reinterpret_cast<TSideBarNotify *>(lParam);
dat = const_cast<TWindowData *>(n->dat);
@@ -1105,13 +1066,11 @@ panel_found: }
break;
- /*
- * determine minimum and maximum size limits
- * 1) for maximizing the window when the "vertical maximize" option is set
- * 2) to limit the minimum height when manually resizing the window
- * (this avoids overlapping of controls inside the window and ensures
- * that at least 2 lines of the message log are always visible).
- */
+ // determine minimum and maximum size limits
+ // 1) for maximizing the window when the "vertical maximize" option is set
+ // 2) to limit the minimum height when manually resizing the window
+ // (this avoids overlapping of controls inside the window and ensures
+ // that at least 2 lines of the message log are always visible).
case WM_GETMINMAXINFO:
{
RECT rc, rcWindow, rcClient = {0};
@@ -1126,11 +1085,9 @@ panel_found: GetWindowRect(hwndDlg, &rcWindow);
pt.y = rc.top;
TabCtrl_AdjustRect(GetDlgItem(hwndDlg, IDC_MSGTABS), FALSE, &rc);
- /*
- * uChildMinHeight holds the min height for the client window only
- * so let's add the container's vertical padding (title bar, tab bar,
- * window border, status bar) to this value
- */
+ // uChildMinHeight holds the min height for the client window only
+ // so let's add the container's vertical padding (title bar, tab bar,
+ // window border, status bar) to this value
if (pContainer->hwndActive)
mmi->ptMinTrackSize.y = pContainer->uChildMinHeight + (pContainer->hwndActive ? ((rcWindow.bottom - rcWindow.top) - rcClient.bottom) : 0);
@@ -1164,9 +1121,7 @@ panel_found: mmi->ptMaxPosition.y += rcDesktop.top;
}
- /*
- * protect against invalid values...
- */
+ // protect against invalid values...
if (mmi->ptMinTrackSize.y < 50 || mmi->ptMinTrackSize.y > rcDesktop.bottom)
mmi->ptMinTrackSize.y = 130;
}
@@ -1316,7 +1271,7 @@ panel_found: if (TabCtrl_GetItem(hwndTab, iNewTab, &item)) {
TabCtrl_SetCurSel(hwndTab, iNewTab);
ShowWindow(pContainer->hwndActive, SW_HIDE);
- pContainer->hwndActive = (HWND) item.lParam;
+ pContainer->hwndActive = (HWND)item.lParam;
ShowWindow((HWND)item.lParam, SW_SHOW);
SetFocus(pContainer->hwndActive);
}
@@ -1337,9 +1292,7 @@ panel_found: }
break;
- /*
- * pass the WM_ACTIVATE msg to the active message dialog child
- */
+ // pass the WM_ACTIVATE msg to the active message dialog child
case WM_NCACTIVATE:
if (IsWindowVisible(hwndDlg))
pContainer->fHidden = false;
@@ -1406,7 +1359,7 @@ panel_found: TabCtrl_GetItem(hwndTab, curItem, &item);
if (pContainer->dwFlags & CNT_DEFERREDCONFIGURE && curItem >= 0) {
pContainer->dwFlags &= ~CNT_DEFERREDCONFIGURE;
- pContainer->hwndActive = (HWND) item.lParam;
+ pContainer->hwndActive = (HWND)item.lParam;
SendMessage(hwndDlg, WM_SYSCOMMAND, SC_RESTORE, 0);
if (pContainer->hwndActive != 0 && IsWindow(pContainer->hwndActive)) {
ShowWindow(pContainer->hwndActive, SW_SHOW);
@@ -1416,7 +1369,7 @@ panel_found: }
}
else if (curItem >= 0)
- SendMessage((HWND) item.lParam, WM_ACTIVATE, WA_ACTIVE, 0);
+ SendMessage((HWND)item.lParam, WM_ACTIVATE, WA_ACTIVE, 0);
}
break;
@@ -1452,9 +1405,7 @@ panel_found: break;
case WM_ERASEBKGND:
- /*
- * avoid flickering of the menu bar when aero is active
- */
+ // avoid flickering of the menu bar when aero is active
if (pContainer) {
HDC hdc = (HDC)wParam;
RECT rc;
@@ -1642,19 +1593,17 @@ panel_found: }
return 0;
- /*
- * search the first and most recent unread events in all client tabs...
- * return all information via a RECENTINFO structure (tab indices,
- * window handles and timestamps).
- */
- case DM_QUERYRECENT:
+ // search the first and most recent unread events in all client tabs...
+ // return all information via a RECENTINFO structure (tab indices,
+ // window handles and timestamps).
+ case DM_QUERYRECENT:
{
int iItems = TabCtrl_GetItemCount(hwndTab);
- RECENTINFO *ri = (RECENTINFO *)lParam;
TCITEM item = {0};
DWORD dwTimestamp, dwMostRecent = 0;
+ RECENTINFO *ri = (RECENTINFO *)lParam;
ri->iFirstIndex = ri->iMostRecent = -1;
ri->dwFirst = ri->dwMostRecent = 0;
ri->hwndFirst = ri->hwndMostRecent = 0;
@@ -1662,25 +1611,23 @@ panel_found: for (int i=0; i < iItems; i++) {
item.mask = TCIF_PARAM;
TabCtrl_GetItem(hwndTab, i, &item);
- SendMessage((HWND) item.lParam, DM_QUERYLASTUNREAD, 0, (LPARAM)&dwTimestamp);
+ SendMessage((HWND)item.lParam, DM_QUERYLASTUNREAD, 0, (LPARAM)&dwTimestamp);
if (dwTimestamp > ri->dwMostRecent) {
ri->dwMostRecent = dwTimestamp;
ri->iMostRecent = i;
- ri->hwndMostRecent = (HWND) item.lParam;
+ ri->hwndMostRecent = (HWND)item.lParam;
if (ri->iFirstIndex == -1) {
ri->iFirstIndex = i;
ri->dwFirst = dwTimestamp;
- ri->hwndFirst = (HWND) item.lParam;
+ ri->hwndFirst = (HWND)item.lParam;
}
}
}
}
return 0;
- /*
- * search tab with either next or most recent unread message and select it
- */
- case DM_QUERYPENDING:
+ // search tab with either next or most recent unread message and select it
+ case DM_QUERYPENDING:
{
RECENTINFO ri;
SendMessage(hwndDlg, DM_QUERYRECENT, 0, (LPARAM)&ri);
@@ -1747,9 +1694,7 @@ panel_found: }
}
- /*
- * default handling (no win7 taskbar)
- */
+ // default handling (no win7 taskbar)
if ((HICON)lParam == PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]) { // always set typing icon, but don't save it...
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)PluginConfig.g_IconTypingEventBig);
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, lParam);
@@ -1960,18 +1905,16 @@ panel_found: return FALSE;
}
-/*
-* search the list of tabs and return the tab (by index) which "belongs" to the given
-* hwnd. The hwnd is the handle of a message dialog childwindow. At creation,
-* the dialog handle is stored in the TCITEM.lParam field, because we need
-* to know the owner of the tab.
-*
-* hwndTab: handle of the tab control itself.
-* hwnd: handle of a message dialog.
-*
-* returns the tab index (zero based), -1 if no tab is found (which SHOULD not
-* really happen, but who knows... ;))
-*/
+// search the list of tabs and return the tab (by index) which "belongs" to the given
+// hwnd. The hwnd is the handle of a message dialog childwindow. At creation,
+// the dialog handle is stored in the TCITEM.lParam field, because we need
+// to know the owner of the tab.
+//
+// hwndTab: handle of the tab control itself.
+// hwnd: handle of a message dialog.
+//
+// returns the tab index (zero based), -1 if no tab is found (which SHOULD not
+// really happen, but who knows... ;))
int TSAPI GetTabIndexFromHWND(HWND hwndTab, HWND hwnd)
{
@@ -1987,18 +1930,16 @@ int TSAPI GetTabIndexFromHWND(HWND hwndTab, HWND hwnd) return -1;
}
-/*
-* search the list of tabs and return the tab (by index) which "belongs" to the given
-* hwnd. The hwnd is the handle of a message dialog childwindow. At creation,
-* the dialog handle is stored in the TCITEM.lParam field, because we need
-* to know the owner of the tab.
-*
-* hwndTab: handle of the tab control itself.
-* hwnd: handle of a message dialog.
-*
-* returns the tab index (zero based), -1 if no tab is found (which SHOULD not
-* really happen, but who knows... ;))
-*/
+// search the list of tabs and return the tab (by index) which "belongs" to the given
+// hwnd. The hwnd is the handle of a message dialog childwindow. At creation,
+// the dialog handle is stored in the TCITEM.lParam field, because we need
+// to know the owner of the tab.
+//
+// hwndTab: handle of the tab control itself.
+// hwnd: handle of a message dialog.
+//
+// returns the tab index (zero based), -1 if no tab is found (which SHOULD not
+// really happen, but who knows... ;))
HWND TSAPI GetHWNDFromTabIndex(HWND hwndTab, int idx)
{
@@ -2014,10 +1955,8 @@ HWND TSAPI GetHWNDFromTabIndex(HWND hwndTab, int idx) return NULL;
}
-/*
-* activates the tab belonging to the given client HWND (handle of the actual
-* message window.
-*/
+// activates the tab belonging to the given client HWND (handle of the actual
+// message window.
int TSAPI ActivateTabFromHWND(HWND hwndTab, HWND hwnd)
{
@@ -2033,11 +1972,9 @@ int TSAPI ActivateTabFromHWND(HWND hwndTab, HWND hwnd) return -1;
}
-/*
-* returns the index of the tab under the mouse pointer. Used for
-* context menu popup and tooltips
-* pt: mouse coordinates, obtained from GetCursorPos()
-*/
+// returns the index of the tab under the mouse pointer. Used for
+// context menu popup and tooltips
+// pt: mouse coordinates, obtained from GetCursorPos()
int TSAPI GetTabItemFromMouse(HWND hwndTab, POINT *pt)
{
@@ -2049,8 +1986,8 @@ int TSAPI GetTabItemFromMouse(HWND hwndTab, POINT *pt) return TabCtrl_HitTest(hwndTab, &tch);
}
-/*enumerates tabs and closes all of them, but the one in dat */
-void TSAPI CloseOtherTabs(HWND hwndTab, TWindowData &dat)
+// enumerates tabs and closes all of them, but the one in dat
+void TSAPI CloseOtherTabs(HWND hwndTab, TWindowData &dat)
{
for (int idxt = 0; idxt < dat.pContainer->iChilds; ) {
HWND otherTab = GetHWNDFromTabIndex(hwndTab, idxt);
@@ -2061,14 +1998,12 @@ void TSAPI CloseOtherTabs(HWND hwndTab, TWindowData &dat) }
}
-/*
-* cut off contact name to the option value set via Options->Tabbed messaging
-* some people were requesting this, because really long contact list names
-* are causing extraordinary wide tabs and these are looking ugly and wasting
-* screen space.
-*
-* size = max length of target string
-*/
+// cut off contact name to the option value set via Options->Tabbed messaging
+// some people were requesting this, because really long contact list names
+// are causing extraordinary wide tabs and these are looking ugly and wasting
+// screen space.
+//
+// size = max length of target string
int TSAPI CutContactName(const TCHAR *oldname, TCHAR *newname, unsigned int size)
{
@@ -2087,9 +2022,7 @@ int TSAPI CutContactName(const TCHAR *oldname, TCHAR *newname, unsigned int size return 0;
}
-/*
-* functions for handling the linked list of struct ContainerWindowData *foo
-*/
+// functions for handling the linked list of struct ContainerWindowData *foo
static TContainerData* TSAPI AppendToContainerList(TContainerData *pContainer)
{
@@ -2150,12 +2083,10 @@ static TContainerData* TSAPI RemoveContainerFromList(TContainerData *pContainer) return NULL;
}
-/*
-* calls the TabCtrl_AdjustRect to calculate the "real" client area of the tab.
-* also checks for the option "hide tabs when only one tab open" and adjusts
-* geometry if necessary
-* rc is the RECT obtained by GetClientRect(hwndTab)
-*/
+// calls the TabCtrl_AdjustRect to calculate the "real" client area of the tab.
+// also checks for the option "hide tabs when only one tab open" and adjusts
+// geometry if necessary
+// rc is the RECT obtained by GetClientRect(hwndTab)
void TSAPI AdjustTabClientRect(TContainerData *pContainer, RECT *rc)
{
@@ -2210,10 +2141,8 @@ void TSAPI AdjustTabClientRect(TContainerData *pContainer, RECT *rc) rc->right -= pContainer->SideBar->getWidth();
}
-/*
-* retrieve the container name for the given contact handle.
-* if none is assigned, return the name of the default container
-*/
+// retrieve the container name for the given contact handle.
+// if none is assigned, return the name of the default container
int TSAPI GetContainerNameForContact(MCONTACT hContact, TCHAR *szName, int iNameLen)
{
@@ -2328,11 +2257,9 @@ HMENU TSAPI BuildContainerMenu() return hMenu;
}
-/*
-* flashes the container
-* iMode != 0: turn on flashing
-* iMode == 0: turn off flashing
-*/
+// flashes the container
+// iMode != 0: turn on flashing
+// iMode == 0: turn off flashing
void TSAPI FlashContainer(TContainerData *pContainer, int iMode, int iCount)
{
@@ -2387,9 +2314,7 @@ void TSAPI ReflashContainer(TContainerData *pContainer) pContainer->dwFlashingStarted = dwStartTime;
}
-/*
-* broadcasts a message to all child windows (tabs/sessions)
-*/
+// broadcasts a message to all child windows (tabs/sessions)
void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WPARAM wParam, LPARAM lParam, BYTE bType)
{
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 649ed59f93..57bae214e2 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -597,7 +597,7 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM lParam) else { char *szProto = GetContactProto(hContact); if (szProto && !strcmp(szProto, META_PROTO)) { - MCONTACT hSubconttact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0); + MCONTACT hSubconttact = db_mc_getMostOnline(hContact); szProto = GetContactProto(hSubconttact); } if (szProto) { diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 8bb06815d4..653ed2a655 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -218,7 +218,7 @@ TCHAR* GetStatusMessageText(MCONTACT hContact) char *szProto = GetContactProto(hContact);
if (szProto) {
if (!strcmp(szProto, META_PROTO))
- hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ hContact = db_mc_getMostOnline(hContact);
else {
WORD wStatus = (int)CallProtoService(szProto, PS_GETSTATUS, 0, 0);
if (wStatus == ID_STATUS_OFFLINE)
@@ -303,21 +303,23 @@ bool GetSysSubstText(MCONTACT hContact, TCHAR *swzRawSpec, TCHAR *buff, int buff }
else if (!_tcscmp(swzRawSpec, _T("meta_subname"))) {
// get contact list name of active subcontact
- HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
- if (!hSubContact || (INT_PTR)hSubContact == CALLSERVICE_NOTFOUND) return false;
+ MCONTACT hSubContact = db_mc_getMostOnline(hContact);
+ if (!hSubContact)
+ return false;
+
TCHAR *swzNick = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hSubContact, GCDNF_TCHAR);
if (swzNick) _tcsncpy(buff, swzNick, bufflen);
return true;
}
else if (!_tcscmp(swzRawSpec, _T("meta_subuid"))) {
- MCONTACT hSubContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ MCONTACT hSubContact = db_mc_getMostOnline(hContact);
if (!hSubContact || (INT_PTR)hSubContact == CALLSERVICE_NOTFOUND)
return false;
return Uid(hSubContact, 0, buff, bufflen);
}
else if (!_tcscmp(swzRawSpec, _T("meta_subproto"))) {
// get protocol of active subcontact
- MCONTACT hSubContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ MCONTACT hSubContact = db_mc_getMostOnline(hContact);
if (!hSubContact || (INT_PTR)hSubContact == CALLSERVICE_NOTFOUND)
return false;
return GetSysSubstText(hSubContact, _T("account"), buff, bufflen);
diff --git a/plugins/Utils/mir_options.cpp b/plugins/Utils/mir_options.cpp index f1960d30d5..ce4a474bb2 100644 --- a/plugins/Utils/mir_options.cpp +++ b/plugins/Utils/mir_options.cpp @@ -35,17 +35,15 @@ Boston, MA 02111-1307, USA. static TCHAR* MyDBGetContactSettingTString(MCONTACT hContact, char* module, char* setting, TCHAR* out, size_t len, TCHAR *def)
{
- DBVARIANT dbv = {0};
+ DBVARIANT dbv = { 0 };
out[0] = _T('\0');
- if ( !db_get_ts(hContact, module, setting, &dbv))
- {
+ if (!db_get_ts(hContact, module, setting, &dbv)) {
lstrcpyn(out, dbv.ptszVal, (int)len);
db_free(&dbv);
}
- else
- {
+ else {
if (def != NULL)
lstrcpyn(out, def, (int)len);
}
@@ -54,46 +52,45 @@ static TCHAR* MyDBGetContactSettingTString(MCONTACT hContact, char* module, char }
-static TCHAR dbPath[MAX_PATH] = {0}; // database profile path (read at startup only)
+static TCHAR dbPath[MAX_PATH] = { 0 }; // database profile path (read at startup only)
static int PathIsAbsolute(const TCHAR *path)
{
- if ( !path || !(lstrlen(path) > 2))
+ if (!path || !(lstrlen(path) > 2))
return 0;
- if ((path[1]==_T(':') && path[2]==_T('\\')) || (path[0]==_T('\\')&&path[1]==_T('\\')))
+ if ((path[1] == _T(':') && path[2] == _T('\\')) || (path[0] == _T('\\') && path[1] == _T('\\')))
return 1;
return 0;
}
static void PathToRelative(TCHAR *pOut, size_t outSize, const TCHAR *pSrc)
{
- if ( !PathIsAbsolute(pSrc))
+ if (!PathIsAbsolute(pSrc))
lstrcpyn(pOut, pSrc, (int)outSize);
else {
if (dbPath[0] == _T('\0')) {
char tmp[1024];
- CallService(MS_DB_GETPROFILEPATH, SIZEOF(tmp), (LPARAM) tmp);
+ CallService(MS_DB_GETPROFILEPATH, SIZEOF(tmp), (LPARAM)tmp);
mir_sntprintf(dbPath, SIZEOF(dbPath), _T("%S\\"), tmp);
}
size_t len = lstrlen(dbPath);
- if (_tcsnicmp(pSrc, dbPath, len))
+ if (_tcsnicmp(pSrc, dbPath, len))
mir_sntprintf(pOut, outSize, _T("%s"), pSrc + len);
- else
+ else
lstrcpyn(pOut, pSrc, (int)outSize);
}
}
static void PathToAbsolute(TCHAR *pOut, size_t outSize, const TCHAR *pSrc)
{
- if (PathIsAbsolute(pSrc) || !isalnum(pSrc[0]))
+ if (PathIsAbsolute(pSrc) || !isalnum(pSrc[0]))
lstrcpyn(pOut, pSrc, (int)outSize);
else {
- if (dbPath[0] == _T('\0'))
- {
+ if (dbPath[0] == _T('\0')) {
char tmp[1024];
- CallService(MS_DB_GETPROFILEPATH, SIZEOF(tmp), (LPARAM) tmp);
+ CallService(MS_DB_GETPROFILEPATH, SIZEOF(tmp), (LPARAM)tmp);
mir_sntprintf(dbPath, SIZEOF(dbPath), _T("%S\\"), tmp);
}
@@ -105,219 +102,209 @@ static void LoadOpt(OptPageControl *ctrl, char *module) {
if (ctrl->var == NULL)
return;
-
- switch(ctrl->type) {
+
+ TCHAR tmp[1024];
+ switch (ctrl->type) {
case CONTROL_CHECKBOX:
- *((BYTE *) ctrl->var) = db_get_b(NULL, module, ctrl->setting, ctrl->dwDefValue);
+ *((BYTE *)ctrl->var) = db_get_b(NULL, module, ctrl->setting, ctrl->dwDefValue);
break;
case CONTROL_SPIN:
- *((WORD *) ctrl->var) = db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue);
+ *((WORD *)ctrl->var) = db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue);
break;
case CONTROL_COLOR:
- *((COLORREF *) ctrl->var) = (COLORREF) db_get_dw(NULL, module, ctrl->setting, ctrl->dwDefValue);
+ *((COLORREF *)ctrl->var) = (COLORREF)db_get_dw(NULL, module, ctrl->setting, ctrl->dwDefValue);
break;
case CONTROL_RADIO:
- *((WORD *) ctrl->var) = db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue);
+ *((WORD *)ctrl->var) = db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue);
break;
case CONTROL_COMBO:
- *((WORD *) ctrl->var) = db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue);
+ *((WORD *)ctrl->var) = db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue);
break;
case CONTROL_PROTOCOL_LIST:
break;
case CONTROL_TEXT:
- MyDBGetContactSettingTString(NULL, module, ctrl->setting, ((TCHAR *) ctrl->var), min(ctrl->max <= 0 ? 1024 : ctrl->max, 1024), ctrl->tszDefValue == NULL ? NULL : TranslateTS(ctrl->tszDefValue));
+ MyDBGetContactSettingTString(NULL, module, ctrl->setting, ((TCHAR *)ctrl->var), min(ctrl->max <= 0 ? 1024 : ctrl->max, 1024), ctrl->tszDefValue == NULL ? NULL : TranslateTS(ctrl->tszDefValue));
break;
case CONTROL_INT:
- *((int *) ctrl->var) = (int) db_get_dw(NULL, module, ctrl->setting, ctrl->dwDefValue);
+ *((int *)ctrl->var) = (int)db_get_dw(NULL, module, ctrl->setting, ctrl->dwDefValue);
break;
case CONTROL_FILE:
- {
- TCHAR tmp[1024];
- MyDBGetContactSettingTString(NULL, module, ctrl->setting, tmp, 1024, ctrl->tszDefValue == NULL ? NULL : ctrl->tszDefValue);
- PathToAbsolute(((TCHAR *) ctrl->var), min(ctrl->max <= 0 ? 1024 : ctrl->max, 1024), tmp);
- }
+ MyDBGetContactSettingTString(NULL, module, ctrl->setting, tmp, 1024, ctrl->tszDefValue == NULL ? NULL : ctrl->tszDefValue);
+ PathToAbsolute(((TCHAR *)ctrl->var), min(ctrl->max <= 0 ? 1024 : ctrl->max, 1024), tmp);
break;
case CONTROL_COMBO_TEXT:
case CONTROL_COMBO_ITEMDATA:
- MyDBGetContactSettingTString(NULL, module, ctrl->setting, ((TCHAR *) ctrl->var), min(ctrl->max <= 0 ? 1024 : ctrl->max, 1024), ctrl->tszDefValue == NULL ? NULL : TranslateTS(ctrl->tszDefValue));
+ MyDBGetContactSettingTString(NULL, module, ctrl->setting, ((TCHAR *)ctrl->var), min(ctrl->max <= 0 ? 1024 : ctrl->max, 1024), ctrl->tszDefValue == NULL ? NULL : TranslateTS(ctrl->tszDefValue));
break;
}
}
void LoadOpts(OptPageControl *controls, int controlsSize, char *module)
{
- for (int i = 0 ; i < controlsSize ; i++)
+ for (int i = 0; i < controlsSize; i++)
LoadOpt(&controls[i], module);
}
INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, char *module, HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ TCHAR tmp[1024];
+
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- {
- for (int i = 0 ; i < controlsSize ; i++) {
- OptPageControl *ctrl = &controls[i];
- if (GetDlgItem(hwndDlg, ctrl->nID) == NULL)
- continue;
+ for (int i = 0; i < controlsSize; i++) {
+ OptPageControl *ctrl = &controls[i];
- switch(ctrl->type) {
- case CONTROL_CHECKBOX:
- CheckDlgButton(hwndDlg, ctrl->nID, db_get_b(NULL, module, ctrl->setting, ctrl->dwDefValue) == 1 ? BST_CHECKED : BST_UNCHECKED);
- break;
+ if (GetDlgItem(hwndDlg, ctrl->nID) == NULL)
+ continue;
- case CONTROL_SPIN:
- SendDlgItemMessage(hwndDlg, ctrl->nIDSpin, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, ctrl->nID),0);
- SendDlgItemMessage(hwndDlg, ctrl->nIDSpin, UDM_SETRANGE, 0, MAKELONG(ctrl->max, ctrl->min));
- SendDlgItemMessage(hwndDlg, ctrl->nIDSpin, UDM_SETPOS,0, MAKELONG(db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue), 0));
- break;
+ switch (ctrl->type) {
+ case CONTROL_CHECKBOX:
+ CheckDlgButton(hwndDlg, ctrl->nID, db_get_b(NULL, module, ctrl->setting, ctrl->dwDefValue) == 1 ? BST_CHECKED : BST_UNCHECKED);
+ break;
- case CONTROL_COLOR:
- SendDlgItemMessage(hwndDlg, ctrl->nID, CPM_SETCOLOUR, 0, (COLORREF) db_get_dw(NULL, module, ctrl->setting, ctrl->dwDefValue));
- break;
+ case CONTROL_SPIN:
+ SendDlgItemMessage(hwndDlg, ctrl->nIDSpin, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, ctrl->nID), 0);
+ SendDlgItemMessage(hwndDlg, ctrl->nIDSpin, UDM_SETRANGE, 0, MAKELONG(ctrl->max, ctrl->min));
+ SendDlgItemMessage(hwndDlg, ctrl->nIDSpin, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue), 0));
+ break;
- case CONTROL_RADIO:
- CheckDlgButton(hwndDlg, ctrl->nID, db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue) == ctrl->value ? BST_CHECKED : BST_UNCHECKED);
- break;
+ case CONTROL_COLOR:
+ SendDlgItemMessage(hwndDlg, ctrl->nID, CPM_SETCOLOUR, 0, (COLORREF)db_get_dw(NULL, module, ctrl->setting, ctrl->dwDefValue));
+ break;
- case CONTROL_COMBO:
- SendDlgItemMessage(hwndDlg, ctrl->nID, CB_SETCURSEL, db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue), 0);
- break;
+ case CONTROL_RADIO:
+ CheckDlgButton(hwndDlg, ctrl->nID, db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue) == ctrl->value ? BST_CHECKED : BST_UNCHECKED);
+ break;
- case CONTROL_PROTOCOL_LIST:
- {
- // Fill list view
- HWND hwndProtocols = GetDlgItem(hwndDlg, ctrl->nID);
- LVCOLUMN lvc;
- LVITEM lvi;
+ case CONTROL_COMBO:
+ SendDlgItemMessage(hwndDlg, ctrl->nID, CB_SETCURSEL, db_get_w(NULL, module, ctrl->setting, ctrl->dwDefValue), 0);
+ break;
- ListView_SetExtendedListViewStyle(hwndProtocols, LVS_EX_CHECKBOXES);
+ case CONTROL_PROTOCOL_LIST:
+ {
+ // Fill list view
+ HWND hwndProtocols = GetDlgItem(hwndDlg, ctrl->nID);
+ LVCOLUMN lvc;
+ LVITEM lvi;
- ZeroMemory(&lvc, sizeof(lvc));
- lvc.mask = LVCF_FMT;
- lvc.fmt = LVCFMT_IMAGE | LVCFMT_LEFT;
- ListView_InsertColumn(hwndProtocols, 0, &lvc);
+ ListView_SetExtendedListViewStyle(hwndProtocols, LVS_EX_CHECKBOXES);
- ZeroMemory(&lvi, sizeof(lvi));
- lvi.mask = LVIF_TEXT | LVIF_PARAM;
- lvi.iSubItem = 0;
- lvi.iItem = 1000;
+ ZeroMemory(&lvc, sizeof(lvc));
+ lvc.mask = LVCF_FMT;
+ lvc.fmt = LVCFMT_IMAGE | LVCFMT_LEFT;
+ ListView_InsertColumn(hwndProtocols, 0, &lvc);
- int count;
- PROTOACCOUNT **protos;
- ProtoEnumAccounts(&count,&protos);
+ ZeroMemory(&lvi, sizeof(lvi));
+ lvi.mask = LVIF_TEXT | LVIF_PARAM;
+ lvi.iSubItem = 0;
+ lvi.iItem = 1000;
- for (int i = 0; i < count; i++) {
- PROTOACCOUNT *p = protos[i];
- if (p->szModuleName == NULL || p->szModuleName[0] == '\0')
- continue;
+ int count;
+ PROTOACCOUNT **protos;
+ ProtoEnumAccounts(&count, &protos);
- if (ctrl->allowProtocol != NULL && !ctrl->allowProtocol(p->szModuleName))
- continue;
+ for (int i = 0; i < count; i++) {
+ PROTOACCOUNT *p = protos[i];
+ if (p->szModuleName == NULL || p->szModuleName[0] == '\0')
+ continue;
- char *setting = (char *) mir_alloc(128 * sizeof(char));
- mir_snprintf(setting, 128, ctrl->setting, p->szModuleName);
+ if (ctrl->allowProtocol != NULL && !ctrl->allowProtocol(p->szModuleName))
+ continue;
- BOOL show = (BOOL)db_get_b(NULL, module, setting, ctrl->dwDefValue);
+ char *setting = (char *)mir_alloc(128 * sizeof(char));
+ mir_snprintf(setting, 128, ctrl->setting, p->szModuleName);
- lvi.lParam = (LPARAM)setting;
- lvi.pszText = p->tszAccountName;
- lvi.iItem = ListView_InsertItem(hwndProtocols, &lvi);
- ListView_SetItemState(hwndProtocols, lvi.iItem, INDEXTOSTATEIMAGEMASK(show?2:1), LVIS_STATEIMAGEMASK);
- }
+ BOOL show = (BOOL)db_get_b(NULL, module, setting, ctrl->dwDefValue);
- ListView_SetColumnWidth(hwndProtocols, 0, LVSCW_AUTOSIZE);
- ListView_Arrange(hwndProtocols, LVA_ALIGNLEFT | LVA_ALIGNTOP);
- }
- break;
- case CONTROL_TEXT:
- {
- TCHAR tmp[1024];
- SetDlgItemText(hwndDlg, ctrl->nID, MyDBGetContactSettingTString(NULL, module, ctrl->setting, tmp, 1024, ctrl->tszDefValue == NULL ? NULL : TranslateTS(ctrl->tszDefValue)));
- SendDlgItemMessage(hwndDlg, ctrl->nID, EM_LIMITTEXT, min(ctrl->max <= 0 ? 1024 : ctrl->max, 1024), 0);
- }
- break;
- case CONTROL_INT:
- {
- DWORD var = db_get_dw(NULL, module, ctrl->setting, ctrl->dwDefValue);
- SetDlgItemInt(hwndDlg, ctrl->nID, var, ctrl->min <= 0);
- SendDlgItemMessage(hwndDlg, ctrl->nID, EM_LIMITTEXT, 9, 0);
+ lvi.lParam = (LPARAM)setting;
+ lvi.pszText = p->tszAccountName;
+ lvi.iItem = ListView_InsertItem(hwndProtocols, &lvi);
+ ListView_SetItemState(hwndProtocols, lvi.iItem, INDEXTOSTATEIMAGEMASK(show ? 2 : 1), LVIS_STATEIMAGEMASK);
}
- break;
- case CONTROL_FILE:
- {
- TCHAR tmp[1024];
- MyDBGetContactSettingTString(NULL, module, ctrl->setting, tmp, 1024, ctrl->tszDefValue == NULL ? NULL : ctrl->tszDefValue);
- TCHAR abs[1024];
- PathToAbsolute(abs, 1024, tmp);
- SetDlgItemText(hwndDlg, ctrl->nID, abs);
- SendDlgItemMessage(hwndDlg, ctrl->nID, EM_LIMITTEXT, min(ctrl->max <= 0 ? 1024 : ctrl->max, 1024), 0);
- }
- break;
- case CONTROL_COMBO_TEXT:
- {
- TCHAR tmp[1024];
- MyDBGetContactSettingTString(NULL, module, ctrl->setting, tmp, 1024, ctrl->tszDefValue == NULL ? NULL : TranslateTS(ctrl->tszDefValue));
- SendDlgItemMessage(hwndDlg, ctrl->nID, CB_SELECTSTRING, 0, (WPARAM) tmp);
- }
- break;
- case CONTROL_COMBO_ITEMDATA:
- {
- TCHAR tmp[1024];
- MyDBGetContactSettingTString(NULL, module, ctrl->setting, tmp, 1024, ctrl->tszDefValue == NULL ? NULL : TranslateTS(ctrl->tszDefValue));
- int count = SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETCOUNT, 0, 0);
- int i;
- for (i = 0; i < count; i++)
- {
- TCHAR *id = (TCHAR *) SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETITEMDATA, (WPARAM) i, 0);
- if (lstrcmp(id, tmp) == 0)
- break;
- }
- if (i < count)
- SendDlgItemMessage(hwndDlg, ctrl->nID, CB_SETCURSEL, i, 0);
+ ListView_SetColumnWidth(hwndProtocols, 0, LVSCW_AUTOSIZE);
+ ListView_Arrange(hwndProtocols, LVA_ALIGNLEFT | LVA_ALIGNTOP);
+ }
+ break;
+
+ case CONTROL_TEXT:
+ SetDlgItemText(hwndDlg, ctrl->nID, MyDBGetContactSettingTString(NULL, module, ctrl->setting, tmp, 1024, ctrl->tszDefValue == NULL ? NULL : TranslateTS(ctrl->tszDefValue)));
+ SendDlgItemMessage(hwndDlg, ctrl->nID, EM_LIMITTEXT, min(ctrl->max <= 0 ? 1024 : ctrl->max, 1024), 0);
+ break;
+
+ case CONTROL_INT:
+ SetDlgItemInt(hwndDlg, ctrl->nID, db_get_dw(NULL, module, ctrl->setting, ctrl->dwDefValue), ctrl->min <= 0);
+ SendDlgItemMessage(hwndDlg, ctrl->nID, EM_LIMITTEXT, 9, 0);
+ break;
+
+ case CONTROL_FILE:
+ MyDBGetContactSettingTString(NULL, module, ctrl->setting, tmp, 1024, ctrl->tszDefValue == NULL ? NULL : ctrl->tszDefValue);
+ {
+ TCHAR abs[1024];
+ PathToAbsolute(abs, 1024, tmp);
+ SetDlgItemText(hwndDlg, ctrl->nID, abs);
+ }
+ SendDlgItemMessage(hwndDlg, ctrl->nID, EM_LIMITTEXT, min(ctrl->max <= 0 ? 1024 : ctrl->max, 1024), 0);
+ break;
+
+ case CONTROL_COMBO_TEXT:
+ MyDBGetContactSettingTString(NULL, module, ctrl->setting, tmp, 1024, ctrl->tszDefValue == NULL ? NULL : TranslateTS(ctrl->tszDefValue));
+ SendDlgItemMessage(hwndDlg, ctrl->nID, CB_SELECTSTRING, 0, (WPARAM)tmp);
+ break;
+
+ case CONTROL_COMBO_ITEMDATA:
+ MyDBGetContactSettingTString(NULL, module, ctrl->setting, tmp, 1024, ctrl->tszDefValue == NULL ? NULL : TranslateTS(ctrl->tszDefValue));
+ {
+ int count = SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETCOUNT, 0, 0);
+ int i;
+ for (i = 0; i < count; i++) {
+ TCHAR *id = (TCHAR *)SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETITEMDATA, (WPARAM)i, 0);
+ if (lstrcmp(id, tmp) == 0)
+ break;
}
- break;
+ if (i < count)
+ SendDlgItemMessage(hwndDlg, ctrl->nID, CB_SETCURSEL, i, 0);
}
+ break;
}
- break;
}
- case WM_COMMAND:
- {
- for (int i = 0 ; i < controlsSize ; i++) {
- OptPageControl *ctrl = &controls[i];
+ break;
- if (LOWORD(wParam) == ctrl->nID) {
- switch(ctrl->type) {
- case CONTROL_TEXT:
- case CONTROL_SPIN:
- case CONTROL_INT:
- // Don't make apply enabled during buddy set
- if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
- return 0;
+ case WM_COMMAND:
+ for (int i = 0; i < controlsSize; i++) {
+ OptPageControl *ctrl = &controls[i];
- break;
+ if (LOWORD(wParam) == ctrl->nID) {
+ switch (ctrl->type) {
+ case CONTROL_TEXT:
+ case CONTROL_SPIN:
+ case CONTROL_INT:
+ // Don't make apply enabled during buddy set
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
+ return 0;
- case CONTROL_COMBO_ITEMDATA:
- case CONTROL_COMBO_TEXT:
- case CONTROL_COMBO:
- if (HIWORD(wParam) != CBN_SELCHANGE || (HWND)lParam != GetFocus())
- return 0;
- break;
- }
+ break;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case CONTROL_COMBO_ITEMDATA:
+ case CONTROL_COMBO_TEXT:
+ case CONTROL_COMBO:
+ if (HIWORD(wParam) != CBN_SELCHANGE || (HWND)lParam != GetFocus())
+ return 0;
+ break;
}
+
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
}
break;
@@ -326,95 +313,94 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha {
LPNMHDR lpnmhdr = (LPNMHDR)lParam;
if (lpnmhdr->idFrom == 0 && lpnmhdr->code == PSN_APPLY) {
- for (int i = 0 ; i < controlsSize ; i++) {
+ for (int i = 0; i < controlsSize; i++) {
OptPageControl *ctrl = &controls[i];
if (GetDlgItem(hwndDlg, ctrl->nID) == NULL)
continue;
- switch(ctrl->type) {
+ switch (ctrl->type) {
case CONTROL_CHECKBOX:
- db_set_b(NULL, module, ctrl->setting, (BYTE) IsDlgButtonChecked(hwndDlg, ctrl->nID));
+ db_set_b(NULL, module, ctrl->setting, (BYTE)IsDlgButtonChecked(hwndDlg, ctrl->nID));
break;
case CONTROL_SPIN:
- db_set_w(NULL, module, ctrl->setting, (WORD) SendDlgItemMessage(hwndDlg, ctrl->nIDSpin, UDM_GETPOS, 0, 0));
+ db_set_w(NULL, module, ctrl->setting, (WORD)SendDlgItemMessage(hwndDlg, ctrl->nIDSpin, UDM_GETPOS, 0, 0));
break;
case CONTROL_COLOR:
- db_set_dw(NULL, module, ctrl->setting, (DWORD) SendDlgItemMessage(hwndDlg, ctrl->nID, CPM_GETCOLOUR, 0, 0));
+ db_set_dw(NULL, module, ctrl->setting, (DWORD)SendDlgItemMessage(hwndDlg, ctrl->nID, CPM_GETCOLOUR, 0, 0));
break;
case CONTROL_RADIO:
if (IsDlgButtonChecked(hwndDlg, ctrl->nID))
- db_set_w(NULL, module, ctrl->setting, (BYTE) ctrl->value);
+ db_set_w(NULL, module, ctrl->setting, (BYTE)ctrl->value);
break;
case CONTROL_COMBO:
- db_set_w(NULL, module, ctrl->setting, (WORD) SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, module, ctrl->setting, (WORD)SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETCURSEL, 0, 0));
break;
case CONTROL_PROTOCOL_LIST:
- {
- LVITEM lvi = {0};
- HWND hwndProtocols = GetDlgItem(hwndDlg, ctrl->nID);
- int i;
+ {
+ LVITEM lvi = { 0 };
+ HWND hwndProtocols = GetDlgItem(hwndDlg, ctrl->nID);
+ int i;
- lvi.mask = (UINT) LVIF_PARAM;
+ lvi.mask = (UINT)LVIF_PARAM;
- for (i = 0; i < ListView_GetItemCount(hwndProtocols); i++)
- {
- lvi.iItem = i;
- ListView_GetItem(hwndProtocols, &lvi);
+ for (i = 0; i < ListView_GetItemCount(hwndProtocols); i++) {
+ lvi.iItem = i;
+ ListView_GetItem(hwndProtocols, &lvi);
- char *setting = (char *)lvi.lParam;
- db_set_b(NULL, module, setting, (BYTE)ListView_GetCheckState(hwndProtocols, i));
- }
+ char *setting = (char *)lvi.lParam;
+ db_set_b(NULL, module, setting, (BYTE)ListView_GetCheckState(hwndProtocols, i));
}
+ }
break;
case CONTROL_TEXT:
- {
- TCHAR tmp[1024];
- GetDlgItemText(hwndDlg, ctrl->nID, tmp, SIZEOF(tmp));
- db_set_ts(NULL, module, ctrl->setting, tmp);
- }
+ {
+ TCHAR tmp[1024];
+ GetDlgItemText(hwndDlg, ctrl->nID, tmp, SIZEOF(tmp));
+ db_set_ts(NULL, module, ctrl->setting, tmp);
+ }
break;
case CONTROL_INT:
- {
- BOOL trans;
- int val = GetDlgItemInt(hwndDlg, ctrl->nID, &trans, ctrl->min <= 0);
- if ( !trans)
- val = ctrl->dwDefValue;
- if (ctrl->max != 0)
- val = min(val, ctrl->max);
- if (ctrl->min != 0)
- val = max(val, ctrl->min);
- db_set_dw(NULL, module, ctrl->setting, val);
- }
+ {
+ BOOL trans;
+ int val = GetDlgItemInt(hwndDlg, ctrl->nID, &trans, ctrl->min <= 0);
+ if (!trans)
+ val = ctrl->dwDefValue;
+ if (ctrl->max != 0)
+ val = min(val, ctrl->max);
+ if (ctrl->min != 0)
+ val = max(val, ctrl->min);
+ db_set_dw(NULL, module, ctrl->setting, val);
+ }
break;
case CONTROL_FILE:
- {
- TCHAR tmp[1024];
- GetDlgItemText(hwndDlg, ctrl->nID, tmp, 1024);
- TCHAR rel[1024];
- PathToRelative(rel, 1024, tmp);
- db_set_ts(NULL, module, ctrl->setting, rel);
- }
+ {
+ TCHAR tmp[1024];
+ GetDlgItemText(hwndDlg, ctrl->nID, tmp, 1024);
+ TCHAR rel[1024];
+ PathToRelative(rel, 1024, tmp);
+ db_set_ts(NULL, module, ctrl->setting, rel);
+ }
break;
case CONTROL_COMBO_TEXT:
- {
- TCHAR tmp[1024];
- GetDlgItemText(hwndDlg, ctrl->nID, tmp, 1024);
- db_set_ts(NULL, module, ctrl->setting, tmp);
- }
+ {
+ TCHAR tmp[1024];
+ GetDlgItemText(hwndDlg, ctrl->nID, tmp, 1024);
+ db_set_ts(NULL, module, ctrl->setting, tmp);
+ }
break;
case CONTROL_COMBO_ITEMDATA:
- {
- int sel = SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETCURSEL, 0, 0);
- db_set_ts(NULL, module, ctrl->setting, (TCHAR *) SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETITEMDATA, (WPARAM) sel, 0));
- }
+ {
+ int sel = SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETCURSEL, 0, 0);
+ db_set_ts(NULL, module, ctrl->setting, (TCHAR *)SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETITEMDATA, (WPARAM)sel, 0));
+ }
break;
}
@@ -423,10 +409,9 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha return TRUE;
}
- else if (lpnmhdr->idFrom != 0 && lpnmhdr->code == LVN_ITEMCHANGED)
- {
+ else if (lpnmhdr->idFrom != 0 && lpnmhdr->code == LVN_ITEMCHANGED) {
// Changed for protocols
- for (int i = 0 ; i < controlsSize ; i++) {
+ for (int i = 0; i < controlsSize; i++) {
OptPageControl *ctrl = &controls[i];
if (ctrl->type == CONTROL_PROTOCOL_LIST && ctrl->nID == lpnmhdr->idFrom) {
@@ -439,36 +424,33 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha }
}
}
- break;
}
+ break;
+
case WM_DESTROY:
- {
- for (int i = 0 ; i < controlsSize ; i++) {
- OptPageControl *ctrl = &controls[i];
+ for (int i = 0; i < controlsSize; i++) {
+ OptPageControl *ctrl = &controls[i];
- if (GetDlgItem(hwndDlg, ctrl->nID) == NULL)
- continue;
+ if (GetDlgItem(hwndDlg, ctrl->nID) == NULL)
+ continue;
- switch(ctrl->type) {
- case CONTROL_PROTOCOL_LIST:
- {
- LVITEM lvi = {0};
- HWND hwndProtocols = GetDlgItem(hwndDlg, ctrl->nID);
- int i;
+ switch (ctrl->type) {
+ case CONTROL_PROTOCOL_LIST:
+ LVITEM lvi = { 0 };
+ HWND hwndProtocols = GetDlgItem(hwndDlg, ctrl->nID);
+ int i;
- lvi.mask = (UINT) LVIF_PARAM;
+ lvi.mask = (UINT)LVIF_PARAM;
- for (i = 0; i < ListView_GetItemCount(hwndProtocols); i++) {
- lvi.iItem = i;
- ListView_GetItem(hwndProtocols, &lvi);
- mir_free((char *) lvi.lParam);
- }
- break;
- }
+ for (i = 0; i < ListView_GetItemCount(hwndProtocols); i++) {
+ lvi.iItem = i;
+ ListView_GetItem(hwndProtocols, &lvi);
+ mir_free((char *)lvi.lParam);
}
+ break;
}
- break;
}
+ break;
}
return 0;
diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp index 95503525d5..9785b30420 100644 --- a/plugins/Variables/src/parse_metacontacts.cpp +++ b/plugins/Variables/src/parse_metacontacts.cpp @@ -137,7 +137,7 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai) return NULL;
}
- hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ hContact = db_mc_getMostOnline(hContact);
if (hContact == NULL)
return NULL;
|