summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-14 19:40:31 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-14 19:40:31 +0000
commitdab02845fea8031dd3d7864dc1efc211a434f969 (patch)
tree5106120c4f64fbf518f57a963f5c7aec6eb19363
parent60df08c2f6194702ec180c2d2adf20d3675edae1 (diff)
- code cleaning
- sync git-svn-id: http://svn.miranda-ng.org/main/trunk@975 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--include/m_clistint.h46
-rw-r--r--plugins/Clist_modern/src/modern_clistmod.cpp2
-rw-r--r--protocols/JabberG/jabber_form2.cpp11
-rw-r--r--protocols/MSN/msn_chat.cpp2
-rw-r--r--protocols/MSN/msn_commands.cpp32
-rw-r--r--protocols/MSN/msn_p2p.cpp52
-rw-r--r--protocols/MSN/msn_p2ps.cpp20
-rw-r--r--protocols/MSN/msn_proto.h1
-rw-r--r--src/core/stdfile/filerecvdlg.cpp3
-rw-r--r--src/modules/clist/clc.cpp64
-rw-r--r--src/modules/clist/clc.h36
-rw-r--r--src/modules/clist/clcfiledrop.cpp2
-rw-r--r--src/modules/clist/clcidents.cpp18
-rw-r--r--src/modules/clist/clcitems.cpp40
-rw-r--r--src/modules/clist/clcutils.cpp131
-rw-r--r--src/modules/clist/clistcore.cpp4
-rw-r--r--src/modules/clist/contact.cpp2
17 files changed, 245 insertions, 221 deletions
diff --git a/include/m_clistint.h b/include/m_clistint.h
index c57cedc47e..d678ba5cf3 100644
--- a/include/m_clistint.h
+++ b/include/m_clistint.h
@@ -84,7 +84,7 @@ struct ClcGroup
{
ContactList cl;
int expanded, hideOffline, groupId;
- struct ClcGroup *parent;
+ ClcGroup *parent;
int scanIndex;
int totalMembers;
};
@@ -107,17 +107,17 @@ struct ClcContactBase
};
struct {
WORD groupId;
- struct ClcGroup *group;
+ ClcGroup *group;
};
};
BYTE iExtraImage[MAXEXTRACOLUMNS];
TCHAR szText[120-MAXEXTRACOLUMNS];
- char * proto; // MS_PROTO_GETBASEPROTO
+ char *proto; // MS_PROTO_GETBASEPROTO
};
struct ClcDataBase
{
- struct ClcGroup list;
+ ClcGroup list;
int rowHeight;
int yScroll;
int selection;
@@ -274,27 +274,27 @@ typedef struct
void (*pfnUnregisterFileDropping)(HWND hwnd);
/* clcidents.c */
- int (*pfnGetRowsPriorTo)(struct ClcGroup *group, struct ClcGroup *subgroup, int contactIndex);
- int (*pfnFindItem)(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **contact, struct ClcGroup **subgroup, int *isVisible);
- int (*pfnGetRowByIndex)(struct ClcData *dat, int testindex, struct ClcContact **contact, struct ClcGroup **subgroup);
- HANDLE (*pfnContactToHItem)(struct ClcContact* contact);
- HANDLE (*pfnContactToItemHandle)(struct ClcContact * contact, DWORD * nmFlags);
+ int (*pfnGetRowsPriorTo)(ClcGroup *group, ClcGroup *subgroup, int contactIndex);
+ int (*pfnFindItem)(HWND hwnd, struct ClcData *dat, HANDLE hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible);
+ int (*pfnGetRowByIndex)(struct ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup);
+ HANDLE (*pfnContactToHItem)(ClcContact* contact);
+ HANDLE (*pfnContactToItemHandle)(ClcContact * contact, DWORD * nmFlags);
/* clcitems.c */
- struct ClcContact* (*pfnCreateClcContact)(void);
+ ClcContact* (*pfnCreateClcContact)(void);
struct ClcGroup* (*pfnAddGroup)(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers);
- struct ClcGroup* (*pfnRemoveItemFromGroup)(HWND hwnd, struct ClcGroup *group, struct ClcContact *contact, int updateTotalCount);
+ struct ClcGroup* (*pfnRemoveItemFromGroup)(HWND hwnd, ClcGroup *group, ClcContact *contact, int updateTotalCount);
- void (*pfnFreeContact)(struct ClcContact *contact);
- void (*pfnFreeGroup)(struct ClcGroup *group);
+ void (*pfnFreeContact)(ClcContact *contact);
+ void (*pfnFreeGroup)(ClcGroup *group);
- int (*pfnAddInfoItemToGroup)(struct ClcGroup *group, int flags, const TCHAR *pszText);
- int (*pfnAddItemToGroup)(struct ClcGroup *group, int iAboveItem);
- int (*pfnAddContactToGroup)(struct ClcData *dat, struct ClcGroup *group, HANDLE hContact);
+ int (*pfnAddInfoItemToGroup)(ClcGroup *group, int flags, const TCHAR *pszText);
+ int (*pfnAddItemToGroup)(ClcGroup *group, int iAboveItem);
+ int (*pfnAddContactToGroup)(struct ClcData *dat, ClcGroup *group, HANDLE hContact);
void (*pfnAddContactToTree)(HWND hwnd, struct ClcData *dat, HANDLE hContact, int updateTotalCount, int checkHideOffline);
void (*pfnDeleteItemFromTree)(HWND hwnd, HANDLE hItem);
void (*pfnRebuildEntireList)(HWND hwnd, struct ClcData *dat);
- int (*pfnGetGroupContentsCount)(struct ClcGroup *group, int visibleOnly);
+ int (*pfnGetGroupContentsCount)(ClcGroup *group, int visibleOnly);
void (*pfnSortCLC)(HWND hwnd, struct ClcData *dat, int useInsertionSort);
void (*pfnSaveStateAndRebuildList)(HWND hwnd, struct ClcData *dat);
@@ -305,18 +305,18 @@ typedef struct
void (*pfnPaintClc)(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint);
/* clcutils.c */
- char* (*pfnGetGroupCountsText)(struct ClcData *dat, struct ClcContact *contact);
- int (*pfnHitTest)(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcContact **contact, struct ClcGroup **group, DWORD * flags);
+ char* (*pfnGetGroupCountsText)(struct ClcData *dat, ClcContact *contact);
+ int (*pfnHitTest)(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **contact, ClcGroup **group, DWORD * flags);
void (*pfnScrollTo)(HWND hwnd, struct ClcData *dat, int desty, int noSmooth);
void (*pfnEnsureVisible)(HWND hwnd, struct ClcData *dat, int iItem, int partialOk);
void (*pfnRecalcScrollBar)(HWND hwnd, struct ClcData *dat);
- void (*pfnSetGroupExpand)(HWND hwnd, struct ClcData *dat, struct ClcGroup *group, int newState);
+ void (*pfnSetGroupExpand)(HWND hwnd, struct ClcData *dat, ClcGroup *group, int newState);
void (*pfnDoSelectionDefaultAction)(HWND hwnd, struct ClcData *dat);
int (*pfnFindRowByText)(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk);
void (*pfnEndRename)(HWND hwnd, struct ClcData *dat, int save);
void (*pfnDeleteFromContactList)(HWND hwnd, struct ClcData *dat);
void (*pfnBeginRenameSelection)(HWND hwnd, struct ClcData *dat);
- void (*pfnCalcEipPosition)(struct ClcData *dat, struct ClcContact *contact, struct ClcGroup *group, POINT *result);
+ void (*pfnCalcEipPosition)(struct ClcData *dat, ClcContact *contact, ClcGroup *group, POINT *result);
int (*pfnGetDropTargetInformation)(HWND hwnd, struct ClcData *dat, POINT pt);
int (*pfnClcStatusToPf2)(int status);
int (*pfnIsHiddenMode)(struct ClcData *dat, int status);
@@ -327,7 +327,7 @@ typedef struct
void (*pfnGetFontSetting)(int i, LOGFONT* lf, COLORREF* colour);
void (*pfnLoadClcOptions)(HWND hwnd, struct ClcData *dat);
void (*pfnRecalculateGroupCheckboxes)(HWND hwnd, struct ClcData *dat);
- void (*pfnSetGroupChildCheckboxes)(struct ClcGroup *group, int checked);
+ void (*pfnSetGroupChildCheckboxes)(ClcGroup *group, int checked);
void (*pfnInvalidateItem)(HWND hwnd, struct ClcData *dat, int iItem);
int (*pfnGetRowBottomY)(struct ClcData *dat, int item);
@@ -375,7 +375,7 @@ typedef struct
/* contact.c */
void (*pfnChangeContactIcon)(HANDLE hContact, int iIcon, int add);
void (*pfnLoadContactTree)(void);
- int (*pfnCompareContacts)(const struct ClcContact *contact1, const struct ClcContact *contact2);
+ int (*pfnCompareContacts)(const ClcContact *contact1, const ClcContact *contact2);
void (*pfnSortContacts)(void);
int (*pfnSetHideOffline)(WPARAM wParam, LPARAM lParam);
diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp
index fb182af5ec..d60a7a64ee 100644
--- a/plugins/Clist_modern/src/modern_clistmod.cpp
+++ b/plugins/Clist_modern/src/modern_clistmod.cpp
@@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "hdr/modern_sync.h"
#include "hdr/modern_clui.h"
#include <m_modernopt.h>
+
pfnMyMonitorFromPoint MyMonitorFromPoint = NULL;
pfnMyMonitorFromWindow MyMonitorFromWindow = NULL;
pfnMyGetMonitorInfo MyGetMonitorInfo = NULL;
@@ -38,7 +39,6 @@ HANDLE hookOptInitialise_CList = NULL,
hookOptInitialise_Skin = NULL,
hookContactAdded_CListSettings = NULL;
-
int CListMod_HideWindow(HWND hwndContactList, int mode);
void GroupMenus_Init(void);
diff --git a/protocols/JabberG/jabber_form2.cpp b/protocols/JabberG/jabber_form2.cpp
index 5a97ab6827..f1936c9e73 100644
--- a/protocols/JabberG/jabber_form2.cpp
+++ b/protocols/JabberG/jabber_form2.cpp
@@ -1178,7 +1178,7 @@ private:
CCtrlJabberForm m_frm;
};
-static VOID CALLBACK CreateDialogApcProc(DWORD param)
+static VOID CALLBACK CreateDialogApcProc(void* param)
{
XmlNode *node = (XmlNode *)param;
@@ -1194,12 +1194,5 @@ static VOID CALLBACK CreateDialogApcProc(DWORD param)
void LaunchForm(XmlNode *node)
{
node = JabberXmlCopyNode(node);
-
- if (GetCurrentThreadId() != jabberMainThreadId)
- {
- QueueUserAPC(CreateDialogApcProc, hMainThread, (DWORD)node);
- } else
- {
- CreateDialogApcProc((DWORD)node);
- }
+ CallFunctionAsync(CreateDialogApcProc, node);
}
diff --git a/protocols/MSN/msn_chat.cpp b/protocols/MSN/msn_chat.cpp
index eb3411d4ce..58bfcbf866 100644
--- a/protocols/MSN/msn_chat.cpp
+++ b/protocols/MSN/msn_chat.cpp
@@ -128,7 +128,7 @@ void CMsnProto::MSN_KillChatSession(TCHAR* id)
gcd.ptszID = id;
GCEVENT gce = {0};
gce.cbSize = sizeof(GCEVENT);
- gce.dwFlags = GC_TCHAR;
+ gce.dwFlags = GC_TCHAR | GCEF_REMOVECONTACT;
gce.pDest = &gcd;
CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
diff --git a/protocols/MSN/msn_commands.cpp b/protocols/MSN/msn_commands.cpp
index 3902f29a25..b83def22d2 100644
--- a/protocols/MSN/msn_commands.cpp
+++ b/protocols/MSN/msn_commands.cpp
@@ -67,7 +67,9 @@ void CMsnProto::sttSetMirVer(HANDLE hContact, DWORD dwValue, bool always)
"WLM Unknown",
};
- if (dwValue & 0x1)
+ if (dwValue == 0)
+ setString(hContact, "MirVer", "Windows Phone");
+ else if (dwValue & 0x1)
setString(hContact, "MirVer", "MSN Mobile");
else if (dwValue & 0x200)
setString(hContact, "MirVer", "Webmessenger");
@@ -827,18 +829,18 @@ void CMsnProto::sttProcessStatusMessage(char* buf, unsigned len, const char* wli
}
// Process status message info
- char* szStatMsg = ezxml_txt(ezxml_child(xmli, "PSM"));
- if (*szStatMsg) {
- stripBBCode(szStatMsg);
- stripColorCode(szStatMsg);
- mir_ptr<TCHAR> tszStatMsg( mir_utf8decodeT(szStatMsg));
- DBWriteContactSettingTString(hContact, "CList", "StatusMsg", tszStatMsg);
- SendBroadcast(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)tszStatMsg);
+ const char* szStatMsg = ezxml_txt(ezxml_child(xmli, "PSM"));
+ if (*szStatMsg)
+ {
+ stripBBCode((char*)szStatMsg);
+ stripColorCode((char*)szStatMsg);
+ DBWriteContactSettingStringUtf(hContact, "CList", "StatusMsg", szStatMsg);
}
- else {
+ else
DBDeleteContactSetting(hContact, "CList", "StatusMsg");
- SendBroadcast(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, NULL);
- }
+
+ mir_utf8decode((char*)szStatMsg, NULL);
+ SendBroadcast(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)szStatMsg);
// Process current media info
const char* szCrntMda = ezxml_txt(ezxml_child(xmli, "CurrentMedia"));
@@ -1190,6 +1192,8 @@ LBL_InvalidCommand:
if (strchr(data.userEmail, ';'))
{
+ if (info->mJoinedContactsWLID.getCount() == 1)
+ p2p_clearThreadSessions(info->mJoinedContactsWLID[0], info->mType);
info->contactLeft(data.userEmail);
break;
}
@@ -1401,7 +1405,7 @@ LBL_InvalidCommand:
sttSetMirVer(hContact, cont->cap1, always);
}
- if ((cont->cap1 & 0xf0000000) && data.cmdstring[0] && strcmp(data.cmdstring, "0"))
+ if (/*(cont->cap1 & 0xf0000000) &&*/ data.cmdstring[0] && strcmp(data.cmdstring, "0"))
{
char* szAvatarHash = MSN_GetAvatarHash(data.cmdstring);
if (szAvatarHash == NULL) goto remove;
@@ -1468,7 +1472,8 @@ remove:
{
UrlDecode(data.userNick);
HANDLE hContact = MSN_HContactFromEmail(data.userEmail, data.userNick, true, true);
- if (tNumTokens == 5)
+
+ if (tNumTokens == 5 && strcmp(data.flags, "0:0"))
{
MsnContact *cont = Lists_Get(data.userEmail);
if (cont)
@@ -1780,6 +1785,7 @@ remove:
case 10:
// TURN setup
+ p2p_processSIP(info, msgBody, NULL, szEmail);
break;
}
break;
diff --git a/protocols/MSN/msn_p2p.cpp b/protocols/MSN/msn_p2p.cpp
index 9c805eb530..84d1ee8d2c 100644
--- a/protocols/MSN/msn_p2p.cpp
+++ b/protocols/MSN/msn_p2p.cpp
@@ -808,7 +808,7 @@ bool CMsnProto::p2p_connectTo(ThreadData* info, directconnection *dc)
bool CMsnProto::p2p_listen(ThreadData* info, directconnection *dc)
{
- switch(WaitForSingleObject(info->hWaitEvent, 6000))
+ switch(WaitForSingleObject(info->hWaitEvent, 10000))
{
case WAIT_TIMEOUT:
case WAIT_FAILED:
@@ -1433,6 +1433,7 @@ void CMsnProto::p2p_InitDirectTransfer(MimeHeaders& tFileInfo, MimeHeaders& tFil
if (MSN_GetThreadByContact(wlid, SERVER_P2P_DIRECT))
{
p2p_sendStatus(ft, 1603);
+ p2p_unregisterDC(dc);
return;
}
p2p_unregisterDC(dc);
@@ -1490,22 +1491,38 @@ void CMsnProto::p2p_startConnect(const char* wlid, const char* szCallID, const c
{
if (port == NULL) return;
- while (addr != NULL)
+ char *pPortTokBeg = (char*)port;
+ for (;;)
{
- char* pSpace = (char*)strchr(addr, ' ');
- if (pSpace != NULL) *(pSpace++) = 0;
+ char *pPortTokEnd = strchr(pPortTokBeg, ' ');
+ if (pPortTokEnd != NULL) *pPortTokEnd = 0;
- ThreadData* newThread = new ThreadData;
+ char *pAddrTokBeg = (char*)addr;
+ for (;;)
+ {
+ char *pAddrTokEnd = strchr(pAddrTokBeg, ' ');
+ if (pAddrTokEnd != NULL) *pAddrTokEnd = 0;
+
+ ThreadData* newThread = new ThreadData;
+
+ newThread->mType = SERVER_P2P_DIRECT;
+ newThread->mInitialContactWLID = mir_strdup(wlid);
+ mir_snprintf(newThread->mCookie, sizeof(newThread->mCookie), "%s", szCallID);
+ mir_snprintf(newThread->mServer, sizeof(newThread->mServer),
+ ipv6 ? "[%s]:%s" : "%s:%s", pAddrTokBeg, pPortTokBeg);
- newThread->mType = SERVER_P2P_DIRECT;
- newThread->mInitialContactWLID = mir_strdup(wlid);
- mir_snprintf(newThread->mCookie, sizeof(newThread->mCookie), "%s", szCallID);
- mir_snprintf(newThread->mServer, sizeof(newThread->mServer),
- ipv6 ? "[%s]:%s" : "%s:%s", addr, port);
+ newThread->startThread(&CMsnProto::p2p_fileActiveThread, this);
- newThread->startThread(&CMsnProto::p2p_fileActiveThread, this);
+ if (pAddrTokEnd == NULL) break;
- addr = pSpace;
+ *pAddrTokEnd = ' ';
+ pAddrTokBeg = pAddrTokEnd + 1;
+ }
+
+ if (pPortTokEnd == NULL) break;
+
+ *pPortTokEnd = ' ';
+ pPortTokBeg = pPortTokEnd + 1;
}
}
@@ -1805,18 +1822,18 @@ void CMsnProto::p2p_processSIP(ThreadData* info, char* msgbody, P2PB_Header* hdr
case 4:
{
- const char* callID = tFileInfo["Call-ID"];
+ const char* szCallID = tFileInfo["Call-ID"];
// application/x-msnmsgr-session-failure-respbody
- directconnection *dc = p2p_getDCByCallID(callID, wlid);
+ directconnection *dc = p2p_getDCByCallID(szCallID, wlid);
if (dc != NULL)
{
p2p_unregisterDC(dc);
break;
}
- filetransfer* ft = p2p_getSessionByCallID(callID, wlid);
+ filetransfer* ft = p2p_getSessionByCallID(szCallID, wlid);
if (ft == NULL)
break;
@@ -2385,13 +2402,14 @@ void CMsnProto::p2p_sendSessionAck(filetransfer* ft)
*/
void CMsnProto::p2p_sessionComplete(filetransfer* ft)
{
- if (ft->std.flags & PFTS_SENDING)
+ if (ft->p2p_appID != MSN_APPID_FILE)
+ p2p_unregisterSession(ft);
+ else if (ft->std.flags & PFTS_SENDING)
{
if (ft->openNext() == -1)
{
bool success = ft->std.currentFileNumber >= ft->std.totalFiles && ft->bCompleted;
SendBroadcast(ft->std.hContact, ACKTYPE_FILE, success ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, ft, 0);
- p2p_unregisterSession(ft);
}
else
{
diff --git a/protocols/MSN/msn_p2ps.cpp b/protocols/MSN/msn_p2ps.cpp
index a274997524..a3b5965ac8 100644
--- a/protocols/MSN/msn_p2ps.cpp
+++ b/protocols/MSN/msn_p2ps.cpp
@@ -127,6 +127,24 @@ filetransfer* CMsnProto::p2p_getThreadSession(HANDLE hContact, TInfoType mType)
return result;
}
+void CMsnProto::p2p_clearThreadSessions(HANDLE hContact, TInfoType mType)
+{
+ EnterCriticalSection(&sessionLock);
+
+ for (int i=0; i < sessionList.getCount(); i++)
+ {
+ filetransfer* ft = &sessionList[i];
+ if (ft->std.hContact == hContact && ft->tType == mType)
+ {
+ ft->bCanceled = true;
+ ft->tType = SERVER_NOTIFICATION;
+ p2p_sendCancel(ft);
+ }
+ }
+
+ LeaveCriticalSection(&sessionLock);
+}
+
filetransfer* CMsnProto::p2p_getAvatarSession(HANDLE hContact)
{
EnterCriticalSection(&sessionLock);
@@ -172,7 +190,7 @@ void CMsnProto::p2p_clearDormantSessions(void)
filetransfer* FT = &sessionList[i];
if (!FT->p2p_sessionid && !MSN_GetUnconnectedThread(FT->p2p_dest, SERVER_P2P_DIRECT))
p2p_invite(FT->p2p_type, FT, NULL);
- else if (FT->p2p_waitack && (ts - FT->ts) > 60)
+ else if (FT->p2p_waitack && (ts - FT->ts) > 120)
{
FT->bCanceled = true;
p2p_sendCancel(FT);
diff --git a/protocols/MSN/msn_proto.h b/protocols/MSN/msn_proto.h
index 8f6ddfbfd4..d038850ba4 100644
--- a/protocols/MSN/msn_proto.h
+++ b/protocols/MSN/msn_proto.h
@@ -354,6 +354,7 @@ struct CMsnProto : public PROTO_INTERFACE
void p2p_cancelAllSessions(void);
void p2p_redirectSessions(const char* wlid);
void p2p_startSessions(const char* wlid);
+ void p2p_clearThreadSessions(HANDLE hContact, TInfoType mType);
void p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid);
void p2p_inviteDc(filetransfer* ft, const char *wlid);
diff --git a/src/core/stdfile/filerecvdlg.cpp b/src/core/stdfile/filerecvdlg.cpp
index 33a27d80ff..31d534e232 100644
--- a/src/core/stdfile/filerecvdlg.cpp
+++ b/src/core/stdfile/filerecvdlg.cpp
@@ -275,11 +275,10 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
{
char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0);
if (szProto) {
- CONTACTINFO ci;
int hasName = 0;
char buf[128];
- ZeroMemory(&ci, sizeof(ci));
+ CONTACTINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.hContact = dat->hContact;
ci.szProto = szProto;
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp
index f7d9ba1411..4097f5a0f3 100644
--- a/src/modules/clist/clc.cpp
+++ b/src/modules/clist/clc.cpp
@@ -393,8 +393,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *) lParam;
if (dbcws->value.type == DBVT_ASCIIZ || dbcws->value.type == DBVT_UTF8) {
int groupId = atoi(dbcws->szSetting) + 1;
- struct ClcContact *contact;
- struct ClcGroup *group;
+ ClcContact *contact;
+ ClcGroup *group;
TCHAR szFullName[512];
int i, nameLen, eq;
//check name of group and ignore message if just being expanded/collapsed
@@ -472,7 +472,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
case INTM_GROUPCHANGED:
{
- struct ClcContact *contact;
+ ClcContact *contact;
BYTE iExtraImage[MAXEXTRACOLUMNS];
BYTE flags = 0;
if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
@@ -503,13 +503,13 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
case INTM_ICONCHANGED:
{
- struct ClcContact *contact = NULL;
- struct ClcGroup *group = NULL;
+ ClcContact *contact = NULL;
+ ClcGroup *group = NULL;
int recalcScrollBar = 0, shouldShow;
WORD status;
char *szProto;
HANDLE hSelItem = NULL;
- struct ClcContact *selcontact = NULL;
+ ClcContact *selcontact = NULL;
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
if (szProto == NULL)
@@ -553,7 +553,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
dat->needsResort = 1;
}
if (hSelItem) {
- struct ClcGroup *selgroup;
+ ClcGroup *selgroup;
if (cli.pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL))
dat->selection = cli.pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact));
else
@@ -564,7 +564,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
case INTM_NAMECHANGED:
{
- struct ClcContact *contact;
+ ClcContact *contact;
if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
@@ -575,7 +575,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
case INTM_PROTOCHANGED:
{
- struct ClcContact *contact = NULL;
+ ClcContact *contact = NULL;
if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
contact->proto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
@@ -587,7 +587,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
case INTM_NOTONLISTCHANGED:
{
DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *) lParam;
- struct ClcContact *contact;
+ ClcContact *contact;
if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
if (contact->type != CLCIT_CONTACT)
@@ -607,7 +607,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
{
WORD apparentMode;
char *szProto;
- struct ClcContact *contact;
+ ClcContact *contact;
if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
@@ -631,7 +631,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
case INTM_IDLECHANGED:
{
char *szProto;
- struct ClcContact *contact;
+ ClcContact *contact;
if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
@@ -764,8 +764,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
if (changeGroupExpand) {
int hit;
- struct ClcContact *contact;
- struct ClcGroup *group;
+ ClcContact *contact;
+ ClcGroup *group;
if (dat->filterSearch) {
// this shouldn't clear filtering, but it should refresh highlighting somehow?
} else {
@@ -816,7 +816,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
else if (wParam < ' ')
break;
else if (wParam == ' ' && dat->szQuickSearch[0] == '\0' && GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_CHECKBOXES) {
- struct ClcContact *contact;
+ ClcContact *contact;
NMCLISTCONTROL nm;
if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, NULL) == -1)
break;
@@ -889,7 +889,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case TIMERID_INFOTIP:
{ CLCINFOTIP it;
- struct ClcContact *contact;
+ ClcContact *contact;
int hit;
RECT clRect;
POINT ptClientOffset = { 0 };
@@ -938,8 +938,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
case WM_MBUTTONDOWN:
case WM_LBUTTONDOWN:
{
- struct ClcContact *contact;
- struct ClcGroup *group;
+ ClcContact *contact;
+ ClcGroup *group;
int hit;
DWORD hitFlags;
@@ -968,8 +968,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
if (hit != -1 && contact->type == CLCIT_GROUP)
if (hitFlags & CLCHT_ONITEMICON) {
- struct ClcGroup *selgroup;
- struct ClcContact *selcontact;
+ ClcGroup *selgroup;
+ ClcContact *selcontact;
dat->selection = cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, &selgroup);
cli.pfnSetGroupExpand(hwnd, dat, contact->group, -1);
if (dat->selection != -1) {
@@ -1076,7 +1076,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
target = cli.pfnGetDropTargetInformation(hwnd, dat, pt);
if (dat->dragStage & DRAGSTAGEF_OUTSIDE && target != DROPTARGET_OUTSIDE) {
NMCLISTCONTROL nm;
- struct ClcContact *contact;
+ ClcContact *contact;
cli.pfnGetRowByIndex(dat, dat->iDragItem, &contact, NULL);
nm.hdr.code = CLN_DRAGSTOP;
nm.hdr.hwndFrom = hwnd;
@@ -1099,7 +1099,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
case DROPTARGET_OUTSIDE:
{
NMCLISTCONTROL nm;
- struct ClcContact *contact;
+ ClcContact *contact;
if (pt.x >= 0 && pt.x < clRect.right
&& ((pt.y < 0 && pt.y > -dat->dragAutoScrollHeight)
@@ -1128,7 +1128,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
default:
{
- struct ClcGroup *group;
+ ClcGroup *group;
cli.pfnGetRowByIndex(dat, dat->iDragItem, NULL, &group);
if (group->parent)
hNewCursor = LoadCursor(cli.hInst, MAKEINTRESOURCE(IDC_DROPUSER));
@@ -1166,7 +1166,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case DROPTARGET_ONGROUP:
{
- struct ClcContact *contactn, *contacto;
+ ClcContact *contactn, *contacto;
cli.pfnGetRowByIndex(dat, dat->selection, &contactn, NULL);
cli.pfnGetRowByIndex(dat, dat->iDragItem, &contacto, NULL);
if (contacto->type == CLCIT_CONTACT) //dropee is a contact
@@ -1181,8 +1181,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
case DROPTARGET_INSERTION:
{
- struct ClcContact *contact, *destcontact;
- struct ClcGroup *destgroup;
+ ClcContact *contact, *destcontact;
+ ClcGroup *destgroup;
cli.pfnGetRowByIndex(dat, dat->iDragItem, &contact, NULL);
if (cli.pfnGetRowByIndex(dat, dat->iInsertionMark, &destcontact, &destgroup) == -1 || destgroup != contact->group->parent)
CallService(MS_CLIST_GROUPMOVEBEFORE, contact->groupId, 0);
@@ -1198,7 +1198,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
case DROPTARGET_OUTSIDE:
{
NMCLISTCONTROL nm;
- struct ClcContact *contact;
+ ClcContact *contact;
cli.pfnGetRowByIndex(dat, dat->iDragItem, &contact, NULL);
nm.hdr.code = CLN_DROPPED;
nm.hdr.hwndFrom = hwnd;
@@ -1211,8 +1211,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
default:
{
- struct ClcGroup *group;
- struct ClcContact *contact;
+ ClcGroup *group;
+ ClcContact *contact;
cli.pfnGetRowByIndex(dat, dat->iDragItem, &contact, &group);
if (group->parent) { //move to root
if (contact->type == CLCIT_CONTACT) //dropee is a contact
@@ -1230,7 +1230,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
case WM_LBUTTONDBLCLK:
{
- struct ClcContact *contact;
+ ClcContact *contact;
DWORD hitFlags;
ReleaseCapture();
dat->iHotTrack = -1;
@@ -1254,7 +1254,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
case WM_CONTEXTMENU:
{
- struct ClcContact *contact;
+ ClcContact *contact;
HMENU hMenu = NULL;
POINT pt;
DWORD hitFlags;
@@ -1320,7 +1320,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
case WM_COMMAND:
{
- struct ClcContact *contact;
+ ClcContact *contact;
int hit = cli.pfnGetRowByIndex(dat, dat->selection, &contact, NULL);
if (hit == -1)
break;
diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h
index bbcdf85528..b8bb4d9035 100644
--- a/src/modules/clist/clc.h
+++ b/src/modules/clist/clc.h
@@ -39,25 +39,25 @@ HMENU fnBuildGroupPopupMenu(struct ClcGroup* group);
LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
/* clcidents.c */
-int fnGetRowsPriorTo(struct ClcGroup *group, struct ClcGroup *subgroup, int contactIndex);
-int fnFindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **contact, struct ClcGroup **subgroup, int *isVisible);
-int fnGetRowByIndex(struct ClcData *dat, int testindex, struct ClcContact **contact, struct ClcGroup **subgroup);
-HANDLE fnContactToHItem(struct ClcContact* contact);
-HANDLE fnContactToItemHandle(struct ClcContact * contact, DWORD * nmFlags);
+int fnGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex);
+int fnFindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible);
+int fnGetRowByIndex(struct ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup);
+HANDLE fnContactToHItem(ClcContact* contact);
+HANDLE fnContactToItemHandle(ClcContact * contact, DWORD * nmFlags);
/* clcitems.c */
struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers);
-struct ClcGroup* fnRemoveItemFromGroup(HWND hwnd, struct ClcGroup *group, struct ClcContact *contact, int updateTotalCount);
+struct ClcGroup* fnRemoveItemFromGroup(HWND hwnd, ClcGroup *group, ClcContact *contact, int updateTotalCount);
-void fnFreeContact(struct ClcContact *p);
-void fnFreeGroup(struct ClcGroup *group);
-int fnAddInfoItemToGroup(struct ClcGroup *group, int flags, const TCHAR *pszText);
-int fnAddItemToGroup(struct ClcGroup *group, int iAboveItem);
+void fnFreeContact(ClcContact *p);
+void fnFreeGroup(ClcGroup *group);
+int fnAddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText);
+int fnAddItemToGroup(ClcGroup *group, int iAboveItem);
void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int updateTotalCount, int checkHideOffline);
-int fnAddContactToGroup(struct ClcData *dat, struct ClcGroup *group, HANDLE hContact);
+int fnAddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact);
void fnDeleteItemFromTree(HWND hwnd, HANDLE hItem);
void fnRebuildEntireList(HWND hwnd, struct ClcData *dat);
-int fnGetGroupContentsCount(struct ClcGroup *group, int visibleOnly);
+int fnGetGroupContentsCount(ClcGroup *group, int visibleOnly);
void fnSortCLC(HWND hwnd, struct ClcData *dat, int useInsertionSort);
void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat);
@@ -65,18 +65,18 @@ void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat);
LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam);
/* clcutils.c */
-char* fnGetGroupCountsText(struct ClcData *dat, struct ClcContact *contact);
-int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcContact **contact, struct ClcGroup **group, DWORD * flags);
+char* fnGetGroupCountsText(struct ClcData *dat, ClcContact *contact);
+int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **contact, ClcGroup **group, DWORD * flags);
void fnScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth);
void fnEnsureVisible(HWND hwnd, struct ClcData *dat, int iItem, int partialOk);
void fnRecalcScrollBar(HWND hwnd, struct ClcData *dat);
-void fnSetGroupExpand(HWND hwnd, struct ClcData *dat, struct ClcGroup *group, int newState);
+void fnSetGroupExpand(HWND hwnd, struct ClcData *dat, ClcGroup *group, int newState);
void fnDoSelectionDefaultAction(HWND hwnd, struct ClcData *dat);
int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk);
void fnEndRename(HWND hwnd, struct ClcData *dat, int save);
void fnDeleteFromContactList(HWND hwnd, struct ClcData *dat);
void fnBeginRenameSelection(HWND hwnd, struct ClcData *dat);
-void fnCalcEipPosition(struct ClcData *dat, struct ClcContact *contact, struct ClcGroup *group, POINT *result);
+void fnCalcEipPosition(struct ClcData *dat, ClcContact *contact, ClcGroup *group, POINT *result);
int fnGetDropTargetInformation(HWND hwnd, struct ClcData *dat, POINT pt);
int fnClcStatusToPf2(int status);
int fnIsHiddenMode(struct ClcData *dat, int status);
@@ -88,7 +88,7 @@ void fnGetDefaultFontSetting(int i, LOGFONT* lf, COLORREF* colour);
void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour);
void fnLoadClcOptions(HWND hwnd, struct ClcData *dat);
void fnRecalculateGroupCheckboxes(HWND hwnd, struct ClcData *dat);
-void fnSetGroupChildCheckboxes(struct ClcGroup *group, int checked);
+void fnSetGroupChildCheckboxes(ClcGroup *group, int checked);
void fnInvalidateItem(HWND hwnd, struct ClcData *dat, int iItem);
int fnGetRowBottomY(struct ClcData *dat, int item);
@@ -180,7 +180,7 @@ void fnDrawMenuItem(DRAWITEMSTRUCT *dis, HICON hIcon, HICON eventIcon);
/* contact.c */
void fnChangeContactIcon (HANDLE hContact, int iIcon, int add);
void fnLoadContactTree (void);
-int fnCompareContacts (const struct ClcContact *contact1, const struct ClcContact *contact2);
+int fnCompareContacts (const ClcContact *contact1, const ClcContact *contact2);
void fnSortContacts (void);
int fnSetHideOffline (WPARAM wParam, LPARAM lParam);
diff --git a/src/modules/clist/clcfiledrop.cpp b/src/modules/clist/clcfiledrop.cpp
index 10d101e705..a190e714c5 100644
--- a/src/modules/clist/clcfiledrop.cpp
+++ b/src/modules/clist/clcfiledrop.cpp
@@ -71,7 +71,7 @@ ULONG CDropTarget::Release(void)
static HANDLE HContactFromPoint(HWND hwnd, struct ClcData *dat, int x, int y, int *hitLine)
{
int hit;
- struct ClcContact *contact;
+ ClcContact *contact;
DWORD hitFlags;
char *szProto;
DWORD protoCaps;
diff --git a/src/modules/clist/clcidents.cpp b/src/modules/clist/clcidents.cpp
index 60e8fb6c3b..ad144c04d3 100644
--- a/src/modules/clist/clcidents.cpp
+++ b/src/modules/clist/clcidents.cpp
@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/* the CLC uses 3 different ways to identify elements in its list, this file
contains routines to convert between them.
-1) struct ClcContact/struct ClcGroup pair. Only ever used within the duration
+1) ClcContact/ClcGroup pair. Only ever used within the duration
of a single operation, but used at some point in nearly everything
2) index integer. The 0-based number of the item from the top. Only visible
items are counted (ie not closed groups). Used for saving selection and drag
@@ -40,7 +40,7 @@ contains routines to convert between them.
2->1: GetRowByIndex()
*/
-int fnGetRowsPriorTo(struct ClcGroup *group, struct ClcGroup *subgroup, int contactIndex)
+int fnGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex)
{
int count = 0;
@@ -70,16 +70,16 @@ int fnGetRowsPriorTo(struct ClcGroup *group, struct ClcGroup *subgroup, int cont
return -1;
}
-int fnFindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **contact, struct ClcGroup **subgroup, int *isVisible)
+int fnFindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible)
{
int index = 0;
int nowVisible = 1;
- struct ClcGroup *group = &dat->list;
+ ClcGroup *group = &dat->list;
group->scanIndex = 0;
for (;;) {
if (group->scanIndex == group->cl.count) {
- struct ClcGroup *tgroup;
+ ClcGroup *tgroup;
group = group->parent;
if (group == NULL)
break;
@@ -135,10 +135,10 @@ int fnFindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact *
return 0;
}
-int fnGetRowByIndex(struct ClcData *dat, int testindex, struct ClcContact **contact, struct ClcGroup **subgroup)
+int fnGetRowByIndex(struct ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup)
{
int index = 0;
- struct ClcGroup *group = &dat->list;
+ ClcGroup *group = &dat->list;
if (testindex<0)
return (-1);
@@ -170,7 +170,7 @@ int fnGetRowByIndex(struct ClcData *dat, int testindex, struct ClcContact **cont
return -1;
}
-HANDLE fnContactToHItem(struct ClcContact * contact)
+HANDLE fnContactToHItem(ClcContact * contact)
{
switch (contact->type) {
case CLCIT_CONTACT:
@@ -183,7 +183,7 @@ HANDLE fnContactToHItem(struct ClcContact * contact)
return NULL;
}
-HANDLE fnContactToItemHandle(struct ClcContact * contact, DWORD * nmFlags)
+HANDLE fnContactToItemHandle(ClcContact * contact, DWORD * nmFlags)
{
switch (contact->type) {
case CLCIT_CONTACT:
diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp
index f52d0bc234..554cb80dcf 100644
--- a/src/modules/clist/clcitems.cpp
+++ b/src/modules/clist/clcitems.cpp
@@ -25,9 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//routines for managing adding/removal of items in the list, including sorting
-int fnAddItemToGroup(struct ClcGroup *group, int iAboveItem)
+int fnAddItemToGroup(ClcGroup *group, int iAboveItem)
{
- struct ClcContact* newItem = cli.pfnCreateClcContact();
+ ClcContact* newItem = cli.pfnCreateClcContact();
newItem->type = CLCIT_DIVIDER;
newItem->flags = 0;
newItem->szText[0] = '\0';
@@ -40,7 +40,7 @@ int fnAddItemToGroup(struct ClcGroup *group, int iAboveItem)
struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers)
{
TCHAR *pBackslash, *pNextField, szThisField[ SIZEOF(dat->list.cl.items[0]->szText) ];
- struct ClcGroup *group = &dat->list;
+ ClcGroup *group = &dat->list;
int i, compareResult;
dat->needsResort = 1;
@@ -89,7 +89,7 @@ struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName,
group->cl.items[i]->type = CLCIT_GROUP;
lstrcpyn(group->cl.items[i]->szText, szThisField, SIZEOF(group->cl.items[i]->szText));
group->cl.items[i]->groupId = (WORD) (pNextField ? 0 : groupId);
- group->cl.items[i]->group = (struct ClcGroup *) mir_alloc(sizeof(struct ClcGroup));
+ group->cl.items[i]->group = (ClcGroup *) mir_alloc(sizeof(struct ClcGroup));
group->cl.items[i]->group->parent = group;
group = group->cl.items[i]->group;
memset(&group->cl, 0, sizeof(group->cl));
@@ -120,14 +120,14 @@ struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName,
return group;
}
-void fnFreeContact(struct ClcContact* p)
+void fnFreeContact(ClcContact* p)
{
if (p->type == CLCIT_GROUP) {
cli.pfnFreeGroup(p->group);
mir_free(p->group);
} }
-void fnFreeGroup(struct ClcGroup *group)
+void fnFreeGroup(ClcGroup *group)
{
int i;
for (i=0; i < group->cl.count; i++) {
@@ -141,7 +141,7 @@ void fnFreeGroup(struct ClcGroup *group)
}
static int iInfoItemUniqueHandle = 0;
-int fnAddInfoItemToGroup(struct ClcGroup *group, int flags, const TCHAR *pszText)
+int fnAddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText)
{
int i=0;
@@ -167,7 +167,7 @@ int fnAddInfoItemToGroup(struct ClcGroup *group, int flags, const TCHAR *pszText
return i;
}
-int fnAddContactToGroup(struct ClcData *dat, struct ClcGroup *group, HANDLE hContact)
+int fnAddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact)
{
char *szProto;
WORD apparentMode;
@@ -218,7 +218,7 @@ int fnAddContactToGroup(struct ClcData *dat, struct ClcGroup *group, HANDLE hCon
void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int updateTotalCount, int checkHideOffline)
{
- struct ClcGroup *group;
+ ClcGroup *group;
DBVARIANT dbv;
DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
WORD status = ID_STATUS_OFFLINE;
@@ -286,7 +286,7 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int upd
group->totalMembers++;
}
-struct ClcGroup* fnRemoveItemFromGroup(HWND hwnd, struct ClcGroup *group, struct ClcContact *contact, int updateTotalCount)
+struct ClcGroup* fnRemoveItemFromGroup(HWND hwnd, ClcGroup *group, ClcContact *contact, int updateTotalCount)
{
int iContact;
if ((iContact = List_IndexOf((SortedList*)&group->cl, contact)) == -1)
@@ -321,8 +321,8 @@ struct ClcGroup* fnRemoveItemFromGroup(HWND hwnd, struct ClcGroup *group, struct
void fnDeleteItemFromTree(HWND hwnd, HANDLE hItem)
{
- struct ClcContact *contact;
- struct ClcGroup *group;
+ ClcContact *contact;
+ ClcGroup *group;
struct ClcData *dat = (struct ClcData *) GetWindowLongPtr(hwnd, 0);
dat->needsResort = 1;
@@ -361,7 +361,7 @@ void fnRebuildEntireList(HWND hwnd, struct ClcData *dat)
char *szProto;
DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
HANDLE hContact;
- struct ClcGroup *group;
+ ClcGroup *group;
DBVARIANT dbv;
dat->list.expanded = 1;
@@ -445,10 +445,10 @@ void fnRebuildEntireList(HWND hwnd, struct ClcData *dat)
cli.pfnSortCLC(hwnd, dat, 0);
}
-int fnGetGroupContentsCount(struct ClcGroup *group, int visibleOnly)
+int fnGetGroupContentsCount(ClcGroup *group, int visibleOnly)
{
int count = group->cl.count;
- struct ClcGroup *topgroup = group;
+ ClcGroup *topgroup = group;
group->scanIndex = 0;
for (;;) {
@@ -486,10 +486,10 @@ static int __cdecl ContactSortProc(const void* p1, const void* p2)
return (int)((INT_PTR) contact2[0]->hContact - (INT_PTR) contact1[0]->hContact);
}
-static void InsertionSort(struct ClcContact **pContactArray, int nArray, int (*CompareProc) (const void *, const void *))
+static void InsertionSort(ClcContact **pContactArray, int nArray, int (*CompareProc) (const void *, const void *))
{
int i, j;
- struct ClcContact* testElement;
+ ClcContact* testElement;
for (i = 1; i < nArray; i++) {
if (CompareProc(&pContactArray[i - 1], &pContactArray[i]) > 0) {
@@ -502,7 +502,7 @@ static void InsertionSort(struct ClcContact **pContactArray, int nArray, int (*C
pContactArray[j] = testElement;
} } }
-static void SortGroup(struct ClcData *dat, struct ClcGroup *group, int useInsertionSort)
+static void SortGroup(struct ClcData *dat, ClcGroup *group, int useInsertionSort)
{
int i, sortCount;
@@ -556,8 +556,8 @@ static void SortGroup(struct ClcData *dat, struct ClcGroup *group, int useInsert
void fnSortCLC(HWND hwnd, struct ClcData *dat, int useInsertionSort)
{
- struct ClcContact *selcontact;
- struct ClcGroup *group = &dat->list, *selgroup;
+ ClcContact *selcontact;
+ ClcGroup *group = &dat->list, *selgroup;
HANDLE hSelItem;
if (dat->needsResort) {
diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp
index 6c1b1e94e7..6323d4c863 100644
--- a/src/modules/clist/clcutils.cpp
+++ b/src/modules/clist/clcutils.cpp
@@ -27,18 +27,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern HANDLE hHideInfoTipEvent;
-char* fnGetGroupCountsText(struct ClcData *dat, struct ClcContact *contact)
+char* fnGetGroupCountsText(struct ClcData *dat, ClcContact *contact)
{
- static char szName[32];
- int onlineCount, totalCount;
- struct ClcGroup *group, *topgroup;
-
if (contact->type != CLCIT_GROUP || !(dat->exStyle & CLS_EX_SHOWGROUPCOUNTS))
return "";
- group = topgroup = contact->group;
- onlineCount = 0;
- totalCount = group->totalMembers;
+ ClcGroup *group = contact->group, *topgroup = group;
+ int onlineCount = 0;
+ int totalCount = group->totalMembers;
group->scanIndex = 0;
for (;;) {
if (group->scanIndex == group->cl.count) {
@@ -59,26 +55,26 @@ char* fnGetGroupCountsText(struct ClcData *dat, struct ClcContact *contact)
}
if (onlineCount == 0 && dat->exStyle & CLS_EX_HIDECOUNTSWHENEMPTY)
return "";
+
+ static char szName[32];
mir_snprintf(szName, SIZEOF(szName), "(%u/%u)", onlineCount, totalCount);
return szName;
}
-int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcContact **contact, struct ClcGroup **group, DWORD * flags)
+int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **contact, ClcGroup **group, DWORD * flags)
{
ClcContact *hitcontact = NULL;
ClcGroup *hitgroup = NULL;
int hit, indent, width, i;
int checkboxWidth;
SIZE textSize;
- HDC hdc;
- RECT clRect;
HFONT hFont;
DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
- POINT pt;
if (flags)
*flags = 0;
+ POINT pt;
pt.x = testx;
pt.y = testy;
ClientToScreen(hwnd, &pt);
@@ -99,8 +95,9 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcCo
return -1;
}
}
- while (hwndParent);
+ while (hwndParent);
+ RECT clRect;
GetClientRect(hwnd, &clRect);
if (testx < 0 || testy < 0 || testy >= clRect.bottom || testx >= clRect.right) {
if (flags) {
@@ -166,7 +163,7 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcCo
return hit;
}
}
- hdc = GetDC(hwnd);
+ HDC hdc = GetDC(hwnd);
if (hitcontact->type == CLCIT_GROUP)
hFont = (HFONT)SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont);
else
@@ -303,7 +300,7 @@ void fnRecalcScrollBar(HWND hwnd, struct ClcData *dat)
SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
}
-void fnSetGroupExpand(HWND hwnd, struct ClcData *dat, struct ClcGroup *group, int newState)
+void fnSetGroupExpand(HWND hwnd, struct ClcData *dat, ClcGroup *group, int newState)
{
int contentCount;
int groupy;
@@ -344,7 +341,7 @@ void fnSetGroupExpand(HWND hwnd, struct ClcData *dat, struct ClcGroup *group, in
void fnDoSelectionDefaultAction(HWND hwnd, struct ClcData *dat)
{
- struct ClcContact *contact;
+ ClcContact *contact;
if (dat->selection == -1)
return;
@@ -359,7 +356,7 @@ void fnDoSelectionDefaultAction(HWND hwnd, struct ClcData *dat)
int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk)
{
- struct ClcGroup *group = &dat->list;
+ ClcGroup *group = &dat->list;
int testlen = lstrlen(text);
group->scanIndex = 0;
@@ -374,7 +371,7 @@ int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefi
if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) {
if ((prefixOk && !_tcsnicmp(text, group->cl.items[group->scanIndex]->szText, testlen)) ||
( !prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText))) {
- struct ClcGroup *contactGroup = group;
+ ClcGroup *contactGroup = group;
int contactScanIndex = group->scanIndex;
for (; group; group = group->parent)
cli.pfnSetGroupExpand(hwnd, dat, group, 1);
@@ -434,7 +431,7 @@ void fnEndRename(HWND, struct ClcData *dat, int save)
void fnDeleteFromContactList(HWND hwnd, struct ClcData *dat)
{
- struct ClcContact *contact;
+ ClcContact *contact;
if (dat->selection == -1)
return;
dat->szQuickSearch[0] = 0;
@@ -481,11 +478,9 @@ static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
void fnBeginRenameSelection(HWND hwnd, struct ClcData *dat)
{
- struct ClcContact *contact;
- struct ClcGroup *group;
- RECT clRect;
+ ClcContact *contact;
+ ClcGroup *group;
POINT pt;
- int h;
KillTimer(hwnd, TIMERID_RENAME);
ReleaseCapture();
@@ -495,9 +490,11 @@ void fnBeginRenameSelection(HWND hwnd, struct ClcData *dat)
return;
if (contact->type != CLCIT_CONTACT && contact->type != CLCIT_GROUP)
return;
+
+ RECT clRect;
GetClientRect(hwnd, &clRect);
cli.pfnCalcEipPosition(dat, contact, group, &pt);
- h = cli.pfnGetRowHeight(dat, dat->selection);
+ int h = cli.pfnGetRowHeight(dat, dat->selection);
dat->hwndRenameEdit = CreateWindow(_T("EDIT"), contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, pt.x, pt.y, clRect.right - pt.x, h, hwnd, NULL, cli.hInst, NULL);
OldRenameEditWndProc = (WNDPROC) SetWindowLongPtr(dat->hwndRenameEdit, GWLP_WNDPROC, (LONG_PTR) RenameEditSubclassProc);
SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM) (contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0);
@@ -507,7 +504,7 @@ void fnBeginRenameSelection(HWND hwnd, struct ClcData *dat)
SetFocus(dat->hwndRenameEdit);
}
-void fnCalcEipPosition(struct ClcData *dat, struct ClcContact *, struct ClcGroup *group, POINT *result)
+void fnCalcEipPosition(struct ClcData *dat, ClcContact *, ClcGroup *group, POINT *result)
{
int indent;
for (indent = 0; group->parent; indent++, group = group->parent);
@@ -518,18 +515,16 @@ void fnCalcEipPosition(struct ClcData *dat, struct ClcContact *, struct ClcGroup
int fnGetDropTargetInformation(HWND hwnd, struct ClcData *dat, POINT pt)
{
RECT clRect;
- int hit;
- struct ClcContact *contact, *movecontact;
- struct ClcGroup *group, *movegroup;
- DWORD hitFlags;
-
GetClientRect(hwnd, &clRect);
dat->selection = dat->iDragItem;
dat->iInsertionMark = -1;
if ( !PtInRect(&clRect, pt))
return DROPTARGET_OUTSIDE;
- hit = cli.pfnHitTest(hwnd, dat, pt.x, pt.y, &contact, &group, &hitFlags);
+ ClcContact *contact, *movecontact;
+ ClcGroup *group, *movegroup;
+ DWORD hitFlags;
+ int hit = cli.pfnHitTest(hwnd, dat, pt.x, pt.y, &contact, &group, &hitFlags);
cli.pfnGetRowByIndex(dat, dat->iDragItem, &movecontact, &movegroup);
if (hit == dat->iDragItem)
return DROPTARGET_ONSELF;
@@ -537,8 +532,8 @@ int fnGetDropTargetInformation(HWND hwnd, struct ClcData *dat, POINT pt)
return DROPTARGET_ONNOTHING;
if (movecontact->type == CLCIT_GROUP) {
- struct ClcContact *bottomcontact = NULL, *topcontact = NULL;
- struct ClcGroup *topgroup = NULL;
+ ClcContact *bottomcontact = NULL, *topcontact = NULL;
+ ClcGroup *topgroup = NULL;
int topItem = -1, bottomItem = -1;
int ok = 0;
if (pt.y + dat->yScroll < cli.pfnGetRowTopY(dat, hit) + dat->insertionMarkHitHeight) {
@@ -623,10 +618,10 @@ int fnIsHiddenMode(struct ClcData *dat, int status)
void fnHideInfoTip(HWND, struct ClcData *dat)
{
- CLCINFOTIP it = { 0 };
-
if (dat->hInfoTipItem == NULL)
return;
+
+ CLCINFOTIP it = { 0 };
it.isGroup = IsHContactGroup(dat->hInfoTipItem);
it.hItem = (HANDLE) ((UINT_PTR) dat->hInfoTipItem & ~HCONTACT_ISGROUP);
it.cbSize = sizeof(it);
@@ -717,31 +712,29 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour)
void fnLoadClcOptions(HWND hwnd, struct ClcData *dat)
{
dat->rowHeight = DBGetContactSettingByte(NULL, "CLC", "RowHeight", CLCDEFAULT_ROWHEIGHT);
- {
- int i;
- LOGFONT lf;
- SIZE fontSize;
+
+ LOGFONT lf;
+ SIZE fontSize;
- HDC hdc = GetDC(hwnd);
- for (i=0; i <= FONTID_MAX; i++)
- {
- if ( !dat->fontInfo[i].changed)
- DeleteObject(dat->fontInfo[i].hFont);
+ HDC hdc = GetDC(hwnd);
+ for (int i=0; i <= FONTID_MAX; i++) {
+ if ( !dat->fontInfo[i].changed)
+ DeleteObject(dat->fontInfo[i].hFont);
- cli.pfnGetFontSetting(i, &lf, &dat->fontInfo[i].colour);
- lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
+ cli.pfnGetFontSetting(i, &lf, &dat->fontInfo[i].colour);
+ lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
- dat->fontInfo[i].hFont = CreateFontIndirect(&lf);
- dat->fontInfo[i].changed = 0;
+ dat->fontInfo[i].hFont = CreateFontIndirect(&lf);
+ dat->fontInfo[i].changed = 0;
- HFONT holdfont = (HFONT)SelectObject(hdc, dat->fontInfo[i].hFont);
- GetTextExtentPoint32(hdc, _T("x"), 1, &fontSize);
- SelectObject(hdc, holdfont);
+ HFONT holdfont = (HFONT)SelectObject(hdc, dat->fontInfo[i].hFont);
+ GetTextExtentPoint32(hdc, _T("x"), 1, &fontSize);
+ SelectObject(hdc, holdfont);
- dat->fontInfo[i].fontHeight = fontSize.cy;
- }
- ReleaseDC(hwnd, hdc);
+ dat->fontInfo[i].fontHeight = fontSize.cy;
}
+ ReleaseDC(hwnd, hdc);
+
dat->leftMargin = DBGetContactSettingByte(NULL, "CLC", "LeftMargin", CLCDEFAULT_LEFTMARGIN);
dat->exStyle = DBGetContactSettingDword(NULL, "CLC", "ExStyle", cli.pfnGetDefaultExStyle());
dat->scrollTime = DBGetContactSettingWord(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME);
@@ -773,29 +766,27 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat)
dat->hotTextColour = DBGetContactSettingDword(NULL, "CLC", "HotTextColour", CLCDEFAULT_HOTTEXTCOLOUR);
dat->quickSearchColour = DBGetContactSettingDword(NULL, "CLC", "QuickSearchColour", CLCDEFAULT_QUICKSEARCHCOLOUR);
dat->useWindowsColours = DBGetContactSettingByte(NULL, "CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
- {
- NMHDR hdr;
- hdr.code = CLN_OPTIONSCHANGED;
- hdr.hwndFrom = hwnd;
- hdr.idFrom = GetDlgCtrlID(hwnd);
- SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & hdr);
- }
+
+ NMHDR hdr;
+ hdr.code = CLN_OPTIONSCHANGED;
+ hdr.hwndFrom = hwnd;
+ hdr.idFrom = GetDlgCtrlID(hwnd);
+ SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & hdr);
+
SendMessage(hwnd, WM_SIZE, 0, 0);
}
#define GSIF_HASMEMBERS 0x80000000
#define GSIF_ALLCHECKED 0x40000000
#define GSIF_INDEXMASK 0x3FFFFFFF
+
void fnRecalculateGroupCheckboxes(HWND, struct ClcData *dat)
{
- struct ClcGroup *group;
- int check;
-
- group = &dat->list;
+ ClcGroup *group = &dat->list;
group->scanIndex = GSIF_ALLCHECKED;
for (;;) {
if ((group->scanIndex & GSIF_INDEXMASK) == group->cl.count) {
- check = (group->scanIndex & (GSIF_HASMEMBERS | GSIF_ALLCHECKED)) == (GSIF_HASMEMBERS | GSIF_ALLCHECKED);
+ int check = (group->scanIndex & (GSIF_HASMEMBERS | GSIF_ALLCHECKED)) == (GSIF_HASMEMBERS | GSIF_ALLCHECKED);
if (group->parent == NULL)
break;
group->parent->scanIndex |= group->scanIndex & GSIF_HASMEMBERS;
@@ -821,11 +812,9 @@ void fnRecalculateGroupCheckboxes(HWND, struct ClcData *dat)
}
}
-void fnSetGroupChildCheckboxes(struct ClcGroup *group, int checked)
+void fnSetGroupChildCheckboxes(ClcGroup *group, int checked)
{
- int i;
-
- for (i=0; i < group->cl.count; i++) {
+ for (int i=0; i < group->cl.count; i++) {
if (group->cl.items[i]->type == CLCIT_GROUP) {
cli.pfnSetGroupChildCheckboxes(group->cl.items[i]->group, checked);
if (checked)
@@ -844,10 +833,10 @@ void fnSetGroupChildCheckboxes(struct ClcGroup *group, int checked)
void fnInvalidateItem(HWND hwnd, struct ClcData *dat, int iItem)
{
- RECT rc;
if (iItem == -1)
return;
+ RECT rc;
GetClientRect(hwnd, &rc);
rc.top = cli.pfnGetRowTopY(dat, iItem) - dat->yScroll;
rc.bottom = rc.top + cli.pfnGetRowHeight(dat, iItem);
diff --git a/src/modules/clist/clistcore.cpp b/src/modules/clist/clistcore.cpp
index 924634ad06..0ac6bb9a7f 100644
--- a/src/modules/clist/clistcore.cpp
+++ b/src/modules/clist/clistcore.cpp
@@ -39,9 +39,9 @@ static void fnPaintClc(HWND, ClcData*, HDC, RECT*)
{
}
-static struct ClcContact* fnCreateClcContact(void)
+static ClcContact* fnCreateClcContact(void)
{
- return (struct ClcContact*)mir_calloc(sizeof(struct ClcContact));
+ return (ClcContact*)mir_calloc(sizeof(ClcContact));
}
static BOOL fnInvalidateRect(HWND hwnd, CONST RECT* lpRect, BOOL bErase)
diff --git a/src/modules/clist/contact.cpp b/src/modules/clist/contact.cpp
index 9404446db5..a523c3b262 100644
--- a/src/modules/clist/contact.cpp
+++ b/src/modules/clist/contact.cpp
@@ -92,7 +92,7 @@ void fnLoadContactTree(void)
CallService(MS_CLUI_LISTENDREBUILD, 0, 0);
}
-int fnCompareContacts(const struct ClcContact* c1, const struct ClcContact* c2)
+int fnCompareContacts(const ClcContact* c1, const ClcContact* c2)
{
HANDLE a = c1->hContact, b = c2->hContact;
TCHAR namea[128], *nameb;