summaryrefslogtreecommitdiff
path: root/plugins/Clist_mw
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-04-08 17:54:19 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-04-08 17:54:19 +0000
commit78dc54f9e392b45492a2b726d6268c41f594eb41 (patch)
treefa1180153a3ac3610f22ad9f7b002d2a348c2ea5 /plugins/Clist_mw
parentafa73da4259ee9a00e60570031f94338542636d8 (diff)
bunch of mc related fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@8892 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_mw')
-rw-r--r--plugins/Clist_mw/src/clc.cpp91
-rw-r--r--plugins/Clist_mw/src/clcitems.cpp7
-rw-r--r--plugins/Clist_mw/src/clistmod.cpp9
-rw-r--r--plugins/Clist_mw/src/clistsettings.cpp2
4 files changed, 54 insertions, 55 deletions
diff --git a/plugins/Clist_mw/src/clc.cpp b/plugins/Clist_mw/src/clc.cpp
index 7f2c6c618d..a3c382c1cc 100644
--- a/plugins/Clist_mw/src/clc.cpp
+++ b/plugins/Clist_mw/src/clc.cpp
@@ -97,13 +97,13 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam)
{
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
- if (hContact != NULL && !strcmp(cws->szModule,"MetaContacts") && !strcmp(cws->szSetting,"Handle"))
- pcli->pfnClcBroadcast( INTM_NAMEORDERCHANGED, 0, 0 );
+ if (hContact != NULL && !strcmp(cws->szModule, META_PROTO) && !strcmp(cws->szSetting, "ParentMeta"))
+ pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, 0, 0);
- if (hContact != NULL && !strcmp(cws->szModule,"CList")) {
- if ( !strcmp( cws->szSetting, "noOffline" ))
+ if (hContact != NULL && !strcmp(cws->szModule, "CList")) {
+ if (!strcmp(cws->szSetting, "noOffline"))
pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, hContact, lParam);
- else if ( !strcmp(cws->szSetting,"StatusMsg"))
+ else if (!strcmp(cws->szSetting, "StatusMsg"))
pcli->pfnClcBroadcast(INTM_STATUSMSGCHANGED, hContact, lParam);
}
return 0;
@@ -111,12 +111,12 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam)
static int ClcModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- CallService(MS_BACKGROUNDCONFIG_REGISTER,(WPARAM)(LPGEN("Status bar background")"/StatusBar"),0);
- CallService(MS_BACKGROUNDCONFIG_REGISTER,(WPARAM)(LPGEN("List background")"/CLC"),0);
- CallService(MS_BACKGROUNDCONFIG_REGISTER,(WPARAM)(LPGEN("Frames title bar background")"/FrameTitleBar"),0);
- HookEvent(ME_BACKGROUNDCONFIG_CHANGED,BgClcChange);
- HookEvent(ME_BACKGROUNDCONFIG_CHANGED,BgStatusBarChange);
- HookEvent(ME_BACKGROUNDCONFIG_CHANGED,OnFrameTitleBarBackgroundChange);
+ CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Status bar background")"/StatusBar"), 0);
+ CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("List background")"/CLC"), 0);
+ CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Frames title bar background")"/FrameTitleBar"), 0);
+ HookEvent(ME_BACKGROUNDCONFIG_CHANGED, BgClcChange);
+ HookEvent(ME_BACKGROUNDCONFIG_CHANGED, BgStatusBarChange);
+ HookEvent(ME_BACKGROUNDCONFIG_CHANGED, OnFrameTitleBarBackgroundChange);
return 0;
}
@@ -129,20 +129,20 @@ static int ClcShutdown(WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct ClcData *dat = (struct ClcData*)GetWindowLongPtr(hwnd,0);
- if ( msg >= CLM_FIRST && msg < CLM_LAST )
- return pcli->pfnProcessExternalMessages(hwnd,dat,msg,wParam,lParam);
+ struct ClcData *dat = (struct ClcData*)GetWindowLongPtr(hwnd, 0);
+ if (msg >= CLM_FIRST && msg < CLM_LAST)
+ return pcli->pfnProcessExternalMessages(hwnd, dat, msg, wParam, lParam);
switch (msg) {
case WM_CREATE:
- dat = (struct ClcData*)mir_calloc( sizeof(struct ClcData));
- SetWindowLongPtr(hwnd,0,(LONG_PTR)dat);
+ dat = (struct ClcData*)mir_calloc(sizeof(struct ClcData));
+ SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat);
InitDisplayNameCache(&dat->lCLCContactsCache);
break;
case INTM_ICONCHANGED:
{
- int recalcScrollBar = 0,shouldShow;
+ int recalcScrollBar = 0, shouldShow;
MCONTACT hSelItem = NULL;
struct ClcContact *selcontact = NULL;
ClcCacheEntry *cacheEntry = GetContactFullCacheEntry(wParam);
@@ -157,14 +157,14 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
status = cacheEntry->status;
// this means an offline msg is flashing, so the contact should be shown
- shouldShow = (GetWindowLongPtr(hwnd,GWL_STYLE) & CLS_SHOWHIDDEN || !cacheEntry->bIsHidden) &&
+ shouldShow = (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !cacheEntry->bIsHidden) &&
(!pcli->pfnIsHiddenMode(dat, status) || cacheEntry->noHiddenOffline || pcli->pfnGetContactIcon(wParam) != LOWORD(lParam));
ClcContact *contact;
ClcGroup *group;
if (!FindItem(hwnd, dat, wParam, &contact, &group, NULL)) {
if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) {
- if (dat->selection>=0 && GetRowByIndex(dat,dat->selection,&selcontact,NULL) != -1)
+ if (dat->selection >= 0 && GetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
hSelItem = (MCONTACT)pcli->pfnContactToHItem(selcontact);
AddContactToTree(hwnd, dat, wParam, 0, 0);
needsResort = 1;
@@ -179,14 +179,14 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
}
else {
//item in list already
- DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE);
+ DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
if (contact->iImage == (WORD)lParam) break;
if (sortByStatus) dat->needsResort = 1;
- if ( !shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
- if (dat->selection>=0 && GetRowByIndex(dat,dat->selection,&selcontact,NULL) != -1)
+ if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
+ if (dat->selection >= 0 && GetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
hSelItem = (MCONTACT)pcli->pfnContactToHItem(selcontact);
- RemoveItemFromGroup(hwnd,group,contact,0);
+ RemoveItemFromGroup(hwnd, group, contact, 0);
recalcScrollBar = 1;
dat->needsResort = 1;
}
@@ -194,34 +194,35 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
int oldflags;
contact->iImage = (WORD)lParam;
oldflags = contact->flags;
- if ( !pcli->pfnIsHiddenMode(dat,status)||cacheEntry->noHiddenOffline) contact->flags |= CONTACTF_ONLINE;
+ if (!pcli->pfnIsHiddenMode(dat, status) || cacheEntry->noHiddenOffline) contact->flags |= CONTACTF_ONLINE;
else contact->flags &= ~CONTACTF_ONLINE;
if (oldflags != contact->flags)
dat->needsResort = 1;
- } }
+ }
+ }
if (hSelItem) {
ClcGroup *selgroup;
- if ( FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL))
- dat->selection = GetRowsPriorTo(&dat->list,selgroup,List_IndexOf((SortedList*)&selgroup->cl, selcontact));
+ if (FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL))
+ dat->selection = GetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact));
else
dat->selection = -1;
}
SortClcByTimer(hwnd);
- if (recalcScrollBar) RecalcScrollBar(hwnd,dat);
+ if (recalcScrollBar) RecalcScrollBar(hwnd, dat);
goto LBL_Exit;
}
case INTM_STATUSMSGCHANGED:
{
DBVARIANT dbv;
- if ( !(dat->style & CLS_SHOWSTATUSMESSAGES))
+ if (!(dat->style & CLS_SHOWSTATUSMESSAGES))
break;
ClcContact *contact;
ClcGroup *group;
if (FindItem(hwnd, dat, wParam, &contact, &group, NULL) && contact != NULL) {
- contact->flags &= ~CONTACTF_STATUSMSG;
+ contact->flags &= ~CONTACTF_STATUSMSG;
if (!db_get_ts(wParam, "CList", "StatusMsg", &dbv)) {
int j;
if (dbv.ptszVal == NULL || _tcslen(dbv.ptszVal) == 0) break;
@@ -239,30 +240,30 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
}
}
- InvalidateRect(hwnd,NULL,TRUE);
+ InvalidateRect(hwnd, NULL, TRUE);
SortClcByTimer(hwnd);
- RecalcScrollBar(hwnd,dat);
+ RecalcScrollBar(hwnd, dat);
goto LBL_Exit;
}
case WM_TIMER:
if (wParam == TIMERID_DELAYEDREPAINT) {
- KillTimer(hwnd,TIMERID_DELAYEDREPAINT);
- InvalidateRect(hwnd,NULL,FALSE);
+ KillTimer(hwnd, TIMERID_DELAYEDREPAINT);
+ InvalidateRect(hwnd, NULL, FALSE);
break;
}
- if ( wParam == TIMERID_SUBEXPAND) {
- KillTimer(hwnd,TIMERID_SUBEXPAND);
+ if (wParam == TIMERID_SUBEXPAND) {
+ KillTimer(hwnd, TIMERID_SUBEXPAND);
if (hitcontact) {
if (hitcontact->SubExpanded) hitcontact->SubExpanded = 0; else hitcontact->SubExpanded = 1;
- db_set_b(hitcontact->hContact,"CList","Expanded",hitcontact->SubExpanded);
+ db_set_b(hitcontact->hContact, "CList", "Expanded", hitcontact->SubExpanded);
}
hitcontact = NULL;
dat->needsResort = 1;
- SortCLC(hwnd,dat,1);
- RecalcScrollBar(hwnd,dat);
+ SortCLC(hwnd, dat, 1);
+ RecalcScrollBar(hwnd, dat);
break;
}
break;
@@ -276,7 +277,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
LRESULT res = saveContactListControlWndProc(hwnd, msg, wParam, lParam);
switch (msg) {
case WM_CREATE:
- mir_forkthread(StatusUpdaterThread,0);
+ mir_forkthread(StatusUpdaterThread, 0);
break;
}
return res;
@@ -289,12 +290,12 @@ int LoadCLCModule(void)
{
LoadCLUIFramesModule();
- himlCListClc = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST,0,0);
+ himlCListClc = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0);
- HookEvent(ME_SYSTEM_MODULESLOADED,ClcModulesLoaded);
+ HookEvent(ME_SYSTEM_MODULESLOADED, ClcModulesLoaded);
hSettingChanged1 = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ClcSettingChanged);
- HookEvent(ME_OPT_INITIALISE,ClcOptInit);
- HookEvent(ME_SYSTEM_SHUTDOWN,ClcShutdown);
+ HookEvent(ME_OPT_INITIALISE, ClcOptInit);
+ HookEvent(ME_SYSTEM_SHUTDOWN, ClcShutdown);
return 0;
}
@@ -306,7 +307,7 @@ static INT_PTR CLUIGetCapsService(WPARAM wParam, LPARAM lParam)
case CLUICAPS_FLAGS1:
return CLUIF_HIDEEMPTYGROUPS | CLUIF_DISABLEGROUPS | CLUIF_HASONTOPOPTION | CLUIF_HASAUTOHIDEOPTION;
case CLUICAPS_FLAGS2:
- return MAKELONG(EXTRA_ICON_COUNT,1);
+ return MAKELONG(EXTRA_ICON_COUNT, 1);
}
return 0;
}
diff --git a/plugins/Clist_mw/src/clcitems.cpp b/plugins/Clist_mw/src/clcitems.cpp
index 2965d4fa7b..0e67a18318 100644
--- a/plugins/Clist_mw/src/clcitems.cpp
+++ b/plugins/Clist_mw/src/clcitems.cpp
@@ -247,10 +247,11 @@ void AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTota
return;
}
}
- ClcContact *cont = AddContactToGroup(dat,group,cacheEntry);
+
+ ClcContact *cont = AddContactToGroup(dat, group, cacheEntry);
if (cont && cont->proto) {
cont->SubAllocated = 0;
- if (strcmp(cont->proto,"MetaContacts") == 0)
+ if (strcmp(cont->proto, META_PROTO) == 0)
AddSubcontacts(cont);
}
if (updateTotalCount)
@@ -380,7 +381,7 @@ void RebuildEntireList(HWND hwnd,struct ClcData *dat)
}
if (cont && cont->proto) {
cont->SubAllocated = 0;
- if (strcmp(cont->proto,"MetaContacts") == 0)
+ if (strcmp(cont->proto, META_PROTO) == 0)
AddSubcontacts(cont);
}
}
diff --git a/plugins/Clist_mw/src/clistmod.cpp b/plugins/Clist_mw/src/clistmod.cpp
index ce81fee4bc..7c998de4db 100644
--- a/plugins/Clist_mw/src/clistmod.cpp
+++ b/plugins/Clist_mw/src/clistmod.cpp
@@ -41,7 +41,6 @@ extern BYTE nameOrder[];
static HANDLE hSettingChanged, hProtoAckHook;
-/////////// End by FYR ////////
int cli_IconFromStatusMode(const char *szProto,int nStatus, MCONTACT hContact)
{
int result = -1;
@@ -49,7 +48,7 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, MCONTACT hContact)
char * szActProto = (char*)szProto;
int nActStatus = nStatus;
MCONTACT hActContact = hContact;
- if ( !db_get_b(NULL,"CLC","Meta",0) && !strcmp(szActProto,"MetaContacts")) {
+ 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);
if (hMostOnlineContact && hMostOnlineContact != (MCONTACT)CALLSERVICE_NOTFOUND) {
@@ -67,14 +66,12 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, MCONTACT hContact)
// result == -1 means no Advanced icon. LOWORD(result) == 0 happens when Advanced icon returned by ICQ (i.e. no transpot)
if (result == -1 || !(LOWORD(result)))
- result = saveIconFromStatusMode(szActProto,nActStatus,NULL);
+ result = saveIconFromStatusMode(szActProto, nActStatus, NULL);
}
- else result = saveIconFromStatusMode(szProto,nStatus,NULL);
+ else result = saveIconFromStatusMode(szProto, nStatus, NULL);
return result;
}
-
-////////// By FYR/////////////
int ExtIconFromStatusMode(MCONTACT hContact, const char *szProto,int status)
{
/* if ( db_get_b( NULL, "CLC", "Meta", 0 ) == 1 )
diff --git a/plugins/Clist_mw/src/clistsettings.cpp b/plugins/Clist_mw/src/clistsettings.cpp
index 0fab2e10bd..01b42ebf6f 100644
--- a/plugins/Clist_mw/src/clistsettings.cpp
+++ b/plugins/Clist_mw/src/clistsettings.cpp
@@ -294,7 +294,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
else ChangeContactIcon(hContact, ExtIconFromStatusMode(hContact,cws->szModule, cws->value.wVal), 0); //by FYR
}
}
- else if ( !strcmp(cws->szModule,"MetaContacts")) {
+ else if (!strcmp(cws->szModule, META_PROTO)) {
pcli->pfnInitAutoRebuild(pcli->hwndContactTree);
return 0;
}