summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-10 14:42:51 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-10 14:42:51 +0000
commit33953cc6a0fab6a91af293c6838f8a46dd7922da (patch)
tree2dbbe718ad42545bde6c9f7672387827c530550a /plugins/Clist_modern
parente190a7fde521bd6af9ea485cc730f854aaf38e11 (diff)
HCONTACT, part 3
git-svn-id: http://svn.miranda-ng.org/main/trunk@8081 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r--plugins/Clist_modern/src/hdr/modern_commonprototypes.h2
-rw-r--r--plugins/Clist_modern/src/modern_awaymsg.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_clc.cpp58
-rw-r--r--plugins/Clist_modern/src/modern_clcidents.cpp30
-rw-r--r--plugins/Clist_modern/src/modern_clcitems.cpp12
-rw-r--r--plugins/Clist_modern/src/modern_clcmsgs.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_clistmod.cpp2
7 files changed, 54 insertions, 60 deletions
diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
index 64409abab3..838686b5d7 100644
--- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
+++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
@@ -216,7 +216,7 @@ HICON cliGetIconFromStatusMode(HCONTACT hContact, const char *szProto,int stat
HICON GetMainStatusOverlay(int STATUS); //clc.c
int __fastcall CLVM_GetContactHiddenStatus(HCONTACT hContact, char *szStatus, ClcData *dat); //clcitems.c
int BgStatusBarChange(WPARAM wParam,LPARAM lParam); //clcopts.c
-int ClcDoProtoAck(HANDLE wParam,ACKDATA * ack); //clc.c
+int ClcDoProtoAck(HCONTACT wParam, ACKDATA *ack); //clc.c
int ModernSkinButtonDeleteAll(); //modernbutton.c
int GetContactCachedStatus(HCONTACT hContact); //clistsettings.c
int GetContactIconC(ClcCacheEntry *cacheEntry); //clistmod.c
diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp
index b9b66caab0..d38758b403 100644
--- a/plugins/Clist_modern/src/modern_awaymsg.cpp
+++ b/plugins/Clist_modern/src/modern_awaymsg.cpp
@@ -48,10 +48,10 @@ static DWORD amRequestTick = 0;
static int amAddHandleToChain(HCONTACT hContact)
{
mir_cslockfull lck(amCS);
- if (amItems.find(hContact) != NULL)
+ if (amItems.find((HANDLE)hContact) != NULL)
return 0;
- amItems.insert(hContact);
+ amItems.insert((HANDLE)hContact);
lck.unlock();
SetEvent(hamProcessEvent);
return 1;
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp
index 8aaad5eddf..9fb0abf495 100644
--- a/plugins/Clist_modern/src/modern_clc.cpp
+++ b/plugins/Clist_modern/src/modern_clc.cpp
@@ -160,10 +160,11 @@ static int clcHookSmileyAddOptionsChanged(WPARAM wParam,LPARAM lParam)
return 0;
}
-static int clcHookProtoAck(WPARAM wParam,LPARAM lParam)
+static int clcHookProtoAck(WPARAM wParam, LPARAM lParam)
{
- return ClcDoProtoAck((HANDLE) wParam,(ACKDATA*) lParam);
+ return ClcDoProtoAck((HCONTACT)wParam, (ACKDATA*)lParam);
}
+
static int clcHookIconsChanged(WPARAM wParam, LPARAM lParam)
{
int i;
@@ -1256,7 +1257,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
if ( ServiceExists(MS_MC_ADDTOMETA)) {
ClcContact *contDest, *contSour;
int res;
- HANDLE handle,hcontact;
+ HCONTACT handle, hcontact;
cliGetRowByIndex(dat,dat->iDragItem,&contSour,NULL);
cliGetRowByIndex(dat,dat->selection,&contDest,NULL);
@@ -1264,23 +1265,23 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
if (contSour->type == CLCIT_CONTACT) {
if (g_szMetaModuleName && mir_strcmp(contSour->proto,g_szMetaModuleName)) {
if (!contSour->isSubcontact) {
- HANDLE hDest = contDest->hContact;
+ HCONTACT hDest = contDest->hContact;
mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be converted to MetaContact and '%s' be added to it?"),contDest->szText, contSour->szText);
res = MessageBox(hwnd,Wording,TranslateT("Converting to MetaContact"),MB_OKCANCEL|MB_ICONQUESTION);
if (res == 1) {
- handle = (HANDLE)CallService(MS_MC_CONVERTTOMETA,(WPARAM)hDest,0);
+ handle = (HCONTACT)CallService(MS_MC_CONVERTTOMETA,(WPARAM)hDest,0);
if (!handle) return 0;
CallService(MS_MC_ADDTOMETA,(WPARAM)hcontact,(LPARAM)handle);
}
}
else {
- HANDLE hcontact = contSour->hContact;
- HANDLE hfrom = contSour->subcontacts->hContact;
- HANDLE hdest = contDest->hContact;
+ hcontact = contSour->hContact;
+ HCONTACT hfrom = contSour->subcontacts->hContact;
+ HCONTACT hdest = contDest->hContact;
mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be converted to MetaContact and '%s' be added to it (remove it from '%s')?"), contDest->szText,contSour->szText,contSour->subcontacts->szText);
res = MessageBox(hwnd,Wording,TranslateT("Converting to MetaContact (Moving)"),MB_OKCANCEL|MB_ICONQUESTION);
if (res == 1) {
- HANDLE handle = (HANDLE)CallService(MS_MC_CONVERTTOMETA,(WPARAM)hdest,0);
+ HCONTACT handle = (HCONTACT)CallService(MS_MC_CONVERTTOMETA,(WPARAM)hdest,0);
if (!handle)
return 0;
@@ -1302,9 +1303,8 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
if (contSour->type == CLCIT_CONTACT) {
if (g_szMetaModuleName && strcmp(contSour->proto,g_szMetaModuleName)) {
if (!contSour->isSubcontact) {
- HANDLE handle,hcontact;
- hcontact = contSour->hContact;
- handle = contDest->hContact;
+ HCONTACT hcontact = contSour->hContact;
+ HCONTACT handle = contDest->hContact;
mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"),contSour->szText, contDest->szText);
res = MessageBox(hwnd,Wording,TranslateT("Adding contact to MetaContact"),MB_OKCANCEL|MB_ICONQUESTION);
if (res == 1) {
@@ -1314,17 +1314,16 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
}
else {
if (contSour->subcontacts == contDest) {
- HANDLE hsour;
- hsour = contSour->hContact;
+ HCONTACT hsour = contSour->hContact;
mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be default?"),contSour->szText);
res = MessageBox(hwnd,Wording,TranslateT("Set default contact"),MB_OKCANCEL|MB_ICONQUESTION);
if (res == 1)
CallService(MS_MC_SETDEFAULTCONTACT,(WPARAM)contDest->hContact,(LPARAM)hsour);
}
else {
- HANDLE hcontact = contSour->hContact;
- HANDLE hfrom = contSour->subcontacts->hContact;
- HANDLE handle = contDest->hContact;
+ HCONTACT hcontact = contSour->hContact;
+ HCONTACT hfrom = contSour->subcontacts->hContact;
+ HCONTACT handle = contDest->hContact;
mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be removed from MetaContact '%s' and added to '%s'?"), contSour->szText,contSour->subcontacts->szText,contDest->szText);
res = MessageBox(hwnd,Wording,TranslateT("Changing MetaContacts (Moving)"),MB_OKCANCEL|MB_ICONQUESTION);
if (res == 1) {
@@ -1348,8 +1347,8 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
if (contSour->type == CLCIT_CONTACT) {
if (g_szMetaModuleName && strcmp(contSour->proto,g_szMetaModuleName)) {
if (!contSour->isSubcontact) {
- HANDLE hcontact = contSour->hContact;
- HANDLE handle = contDest->subcontacts->hContact;
+ HCONTACT hcontact = contSour->hContact;
+ HCONTACT handle = contDest->subcontacts->hContact;
mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be added to MetaContact '%s'?"), contSour->szText,contDest->subcontacts->szText);
int res = MessageBox(hwnd,Wording,TranslateT("Changing MetaContacts (Moving)"),MB_OKCANCEL|MB_ICONQUESTION);
if (res == 1) {
@@ -1358,10 +1357,9 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
}
}
else if (contSour->subcontacts != contDest->subcontacts) {
- HANDLE handle,hcontact,hfrom;
- hcontact = contSour->hContact;
- hfrom = contSour->subcontacts->hContact;
- handle = contDest->subcontacts->hContact;
+ HCONTACT hcontact = contSour->hContact;
+ HCONTACT hfrom = contSour->subcontacts->hContact;
+ HCONTACT handle = contDest->subcontacts->hContact;
mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be removed from MetaContact '%s' and added to '%s'?"), contSour->szText,contSour->subcontacts->szText,contDest->subcontacts->szText);
int res = MessageBox(hwnd,Wording,TranslateT("Changing MetaContacts (Moving)"),MB_OKCANCEL|MB_ICONQUESTION);
if (res == 1) {
@@ -1472,7 +1470,7 @@ static LRESULT clcOnIntmGroupChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM w
BYTE flags = 0;
ClcContact *contact;
- if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL))
+ if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
memset(iExtraImage, 0xFF, sizeof(iExtraImage));
else {
memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage));
@@ -1482,7 +1480,7 @@ static LRESULT clcOnIntmGroupChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM w
if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !db_get_b((HCONTACT)wParam, "CList", "Hidden", 0)) {
NMCLISTCONTROL nm;
pcli->pfnAddContactToTree(hwnd, dat, (HCONTACT)wParam, 1, 1);
- if (pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) {
+ if (pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) {
memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage));
if (flags & CONTACTF_CHECKED)
contact->flags |= CONTACTF_CHECKED;
@@ -1491,7 +1489,7 @@ static LRESULT clcOnIntmGroupChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM w
nm.hdr.hwndFrom = hwnd;
nm.hdr.idFrom = GetDlgCtrlID(hwnd);
nm.flags = 0;
- nm.hItem = (HANDLE) wParam;
+ nm.hItem = (HANDLE)wParam;
SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
dat->needsResort = 1;
}
@@ -1530,14 +1528,14 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP
// XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown
- if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, &group, NULL)) {
+ if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) {
if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) {
if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
hSelItem = (HCONTACT)pcli->pfnContactToHItem(selcontact);
pcli->pfnAddContactToTree(hwnd, dat, (HCONTACT)wParam, (style & CLS_CONTACTLIST) == 0, 0);
recalcScrollBar = 1;
needRepaint = TRUE;
- pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL);
+ pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL);
if (contact) {
contact->iImage = lParam;
contact->image_is_special = image_is_special;
@@ -1579,7 +1577,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP
if (hSelItem) {
ClcGroup *selgroup;
- if (pcli->pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL))
+ if (pcli->pfnFindItem(hwnd, dat, (HANDLE)hSelItem, &selcontact, &selgroup, NULL))
dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf(( SortedList* )&selgroup->cl, selcontact));
else
dat->selection = -1;
@@ -1766,7 +1764,7 @@ int ClcUnloadModule()
return 0;
}
-int ClcDoProtoAck(HANDLE wParam,ACKDATA * ack)
+int ClcDoProtoAck(HCONTACT wParam, ACKDATA * ack)
{
if (MirandaExiting()) return 0;
if (ack->type == ACKTYPE_STATUS) {
diff --git a/plugins/Clist_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp
index 2bd079760f..26260fd015 100644
--- a/plugins/Clist_modern/src/modern_clcidents.cpp
+++ b/plugins/Clist_modern/src/modern_clcidents.cpp
@@ -140,7 +140,7 @@ int FindItem(HWND hwnd, ClcData *dat, HCONTACT hItem, ClcContact **contact, ClcG
if (nowVisible) index++;
if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ((UINT_PTR)hItem&~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) ||
(IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == hItem) ||
- (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == (HANDLE)((UINT_PTR)hItem&~HCONTACT_ISINFO)))
+ (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == (HCONTACT)((UINT_PTR)hItem&~HCONTACT_ISINFO)))
{
if (isVisible) {
if (!nowVisible) *isVisible = 0;
@@ -277,12 +277,12 @@ int cliGetRowByIndex(ClcData *dat,int testindex,ClcContact **contact,ClcGroup **
HANDLE ContactToHItem(ClcContact *contact)
{
switch(contact->type) {
-case CLCIT_CONTACT:
- return contact->hContact;
-case CLCIT_GROUP:
- return (HANDLE)(contact->groupId|HCONTACT_ISGROUP);
-case CLCIT_INFO:
- return (HANDLE)((DWORD_PTR)contact->hContact|HCONTACT_ISINFO);
+ case CLCIT_CONTACT:
+ return (HANDLE)contact->hContact;
+ case CLCIT_GROUP:
+ return (HANDLE)(contact->groupId|HCONTACT_ISGROUP);
+ case CLCIT_INFO:
+ return (HANDLE)((DWORD_PTR)contact->hContact|HCONTACT_ISINFO);
}
return NULL;
}
@@ -290,14 +290,14 @@ case CLCIT_INFO:
HANDLE ContactToItemHandle(ClcContact *contact,DWORD *nmFlags)
{
switch(contact->type) {
-case CLCIT_CONTACT:
- return contact->hContact;
-case CLCIT_GROUP:
- if (nmFlags) *nmFlags |= CLNF_ISGROUP;
- return (HANDLE)contact->groupId;
-case CLCIT_INFO:
- if (nmFlags) *nmFlags |= CLNF_ISINFO;
- return (HANDLE)((DWORD_PTR)contact->hContact|HCONTACT_ISINFO);
+ case CLCIT_CONTACT:
+ return (HANDLE)contact->hContact;
+ case CLCIT_GROUP:
+ if (nmFlags) *nmFlags |= CLNF_ISGROUP;
+ return (HANDLE)contact->groupId;
+ case CLCIT_INFO:
+ if (nmFlags) *nmFlags |= CLNF_ISINFO;
+ return (HANDLE)((DWORD_PTR)contact->hContact|HCONTACT_ISINFO);
}
return NULL;
} \ No newline at end of file
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp
index b01e397d01..dcb0d89b10 100644
--- a/plugins/Clist_modern/src/modern_clcitems.cpp
+++ b/plugins/Clist_modern/src/modern_clcitems.cpp
@@ -314,18 +314,14 @@ int RestoreSelection(ClcData *dat, HCONTACT hSelected)
ClcContact *selcontact = NULL;
ClcGroup *selgroup = NULL;
- if (!hSelected || !pcli->pfnFindItem( dat->hWnd, dat, hSelected, &selcontact, &selgroup, NULL))
- {
+ if (!hSelected || !pcli->pfnFindItem(dat->hWnd, dat, (HANDLE)hSelected, &selcontact, &selgroup, NULL)) {
dat->selection = -1;
return dat->selection;
}
if (!selcontact->isSubcontact )
- {
dat->selection = pcli->pfnGetRowsPriorTo( &dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact ));
- }
- else
- {
+ else {
dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact->subcontacts ));
if (dat->selection != -1 )
@@ -583,7 +579,7 @@ void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat)
if (savedInfo[i].parentId == -1)
group = &dat->list;
else {
- if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)(savedInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL))
+ if (!pcli->pfnFindItem(hwnd, dat, HANDLE(savedInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL))
continue;
group = contact->group;
}
@@ -640,7 +636,7 @@ ClcCacheEntry* cliCreateCacheItem(HCONTACT hContact )
void cliInvalidateDisplayNameCacheEntry(HCONTACT hContact)
{
- if (hContact == INVALID_HANDLE_VALUE)
+ if (hContact == (HCONTACT)INVALID_HANDLE_VALUE)
corecli.pfnInvalidateDisplayNameCacheEntry((HCONTACT)INVALID_HANDLE_VALUE);
else {
ClcCacheEntry *p = pcli->pfnGetCacheEntry(hContact);
diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp
index 047b671172..652564c0ba 100644
--- a/plugins/Clist_modern/src/modern_clcmsgs.cpp
+++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp
@@ -108,7 +108,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara
{
int i;
if (wParam != CLGN_ROOT) {
- if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)lParam, &contact, &group, NULL))
+ if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)lParam, &contact, &group, NULL))
return NULL;
i = List_IndexOf((SortedList*)&group->cl,contact);
if (i < 0) return 0;
@@ -183,7 +183,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara
ClcGroup *tgroup;
int index = -1;
int mainindex = -1;
- if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, &group, NULL))
+ if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL))
break;
for (tgroup = group; tgroup; tgroup = tgroup->parent)
pcli->pfnSetGroupExpand(hwnd, dat, tgroup, 1);
@@ -217,7 +217,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara
if (LOWORD(lParam) >= dat->extraColumnsCount)
return 0;
- if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL))
+ if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
return 0;
contact->iExtraImage[LOWORD(lParam)] = HIWORD(lParam);
diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp
index c8b4523352..d7da7a01a5 100644
--- a/plugins/Clist_modern/src/modern_clistmod.cpp
+++ b/plugins/Clist_modern/src/modern_clistmod.cpp
@@ -86,7 +86,7 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HCONTACT hContact)
if (hContact && szProto) {
char *szActProto = (char*)szProto;
int nActStatus = nStatus;
- HANDLE hActContact = hContact;
+ HCONTACT hActContact = hContact;
if (!db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) && g_szMetaModuleName && !mir_strcmp(szActProto,g_szMetaModuleName)) {
// substitute params by mostonline contact datas
HCONTACT hMostOnlineContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hActContact, 0);