summaryrefslogtreecommitdiff
path: root/protocols/MSN/src/msn_lists.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-01-30 14:25:01 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-01-30 14:25:01 +0000
commiteb8ce4835cfe80601daaf64b6f842e63b85e62af (patch)
tree0a6efec04fb4330daea0a48ed2456048bacbe53e /protocols/MSN/src/msn_lists.cpp
parent8e1b69f9327909134a9646d3f182155125623b70 (diff)
copyright update
fixes #204 git-svn-id: http://svn.miranda-ng.org/main/trunk@3367 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MSN/src/msn_lists.cpp')
-rw-r--r--protocols/MSN/src/msn_lists.cpp56
1 files changed, 29 insertions, 27 deletions
diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp
index c0db8ca166..97f632a870 100644
--- a/protocols/MSN/src/msn_lists.cpp
+++ b/protocols/MSN/src/msn_lists.cpp
@@ -1,5 +1,7 @@
/*
Plugin of Miranda IM for communicating with users of the MSN Messenger protocol.
+
+Copyright (c) 2012-2013 Miranda NG Team
Copyright (c) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -43,7 +45,7 @@ void CMsnProto::Lists_Wipe(void)
bool CMsnProto::Lists_IsInList(int list, const char* email)
{
EnterCriticalSection(&csLists);
-
+
MsnContact* p = contList.find((MsnContact*)&email);
bool res = p != NULL;
if (res && list != -1)
@@ -168,9 +170,9 @@ unsigned CMsnProto::p2p_getMsgId(const char* wlid, int inc)
EnterCriticalSection(&csLists);
MsnPlace* p = Lists_GetPlace(wlid);
- unsigned res = p && p->p2pMsgId ? p->p2pMsgId : MSN_GenRandom();
+ unsigned res = p && p->p2pMsgId ? p->p2pMsgId : MSN_GenRandom();
if (p) p->p2pMsgId = res + inc;
-
+
LeaveCriticalSection(&csLists);
return res;
}
@@ -222,12 +224,12 @@ void CMsnProto::Lists_Remove(int list, const char* email)
{
EnterCriticalSection(&csLists);
int i = contList.getIndex((MsnContact*)&email);
- if (i != -1)
+ if (i != -1)
{
MsnContact& p = contList[i];
p.list &= ~list;
if (list & LIST_PL) { mir_free(p.invite); p.invite = NULL; }
- if (p.list == 0 && p.hContact == NULL)
+ if (p.list == 0 && p.hContact == NULL)
contList.remove(i);
}
LeaveCriticalSection(&csLists);
@@ -240,7 +242,7 @@ void CMsnProto::Lists_Populate(void)
while (hContact != NULL)
{
HANDLE hContactN = db_find_next(hContact);
- if (MSN_IsMyContact(hContact))
+ if (MSN_IsMyContact(hContact))
{
char szEmail[MSN_MAX_EMAIL_LEN] = "";;
if (getStaticString(hContact, "wlid", szEmail, sizeof(szEmail)))
@@ -249,7 +251,7 @@ void CMsnProto::Lists_Populate(void)
if (szEmail[0])
{
bool localList = getByte(hContact, "LocalList", 0) != 0;
- if (localList)
+ if (localList)
Lists_Add(LIST_LL, NETID_MSN, szEmail, hContact);
else
Lists_Add(0, NETID_UNKNOWN, szEmail, hContact);
@@ -284,17 +286,17 @@ void CMsnProto::MSN_CleanupLists(void)
if (p.hContact && !(p.list & (LIST_LL | LIST_FL | LIST_PL)) && p.list != LIST_RL)
{
int count = CallService(MS_DB_EVENT_GETCOUNT, (WPARAM)p.hContact, 0);
- if (count)
+ if (count)
{
TCHAR text[256];
TCHAR* sze = mir_a2t(p.email);
mir_sntprintf(text, SIZEOF(text), TranslateT("Contact %s has been removed from the server.\nWould you like to keep it as \"Local Only\" contact to preserve history?"), sze);
mir_free(sze);
-
+
TCHAR title[128];
mir_sntprintf(title, SIZEOF(title), TranslateT("%s protocol"), m_tszUserName);
- if (MessageBox(NULL, text, title, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDYES)
+ if (MessageBox(NULL, text, title, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDYES)
{
MSN_AddUser(p.hContact, p.email, 0, LIST_LL);
setByte(p.hContact, "LocalList", 1);
@@ -309,7 +311,7 @@ void CMsnProto::MSN_CleanupLists(void)
}
}
-
+
if (p.list & (LIST_LL | LIST_FL) && p.hContact)
{
TCHAR path[MAX_PATH];
@@ -333,11 +335,11 @@ void CMsnProto::MSN_CreateContList(void)
{
bool *used = (bool*)mir_calloc(contList.getCount()*sizeof(bool));
- char cxml[8192];
+ char cxml[8192];
size_t sz;
sz = mir_snprintf(cxml , sizeof(cxml), "<ml l=\"1\">");
-
+
EnterCriticalSection(&csLists);
for (int i=0; i < contList.getCount(); i++)
@@ -350,9 +352,9 @@ void CMsnProto::MSN_CreateContList(void)
for (int j=0; j < contList.getCount(); j++)
{
if (used[j]) continue;
-
+
const MsnContact& C = contList[j];
-
+
if (C.list == LIST_RL || C.list == LIST_PL || C.list == LIST_LL)
{
used[j] = true;
@@ -388,7 +390,7 @@ void CMsnProto::MSN_CreateContList(void)
}
if (used[j] && sz > 7400)
- {
+ {
sz += mir_snprintf(cxml+sz, sizeof(cxml)-sz, "</%c></ml>", lastds ? 'd' : 't');
msnNsThread->sendPacket("ADL", "%d\r\n%s", sz, cxml);
sz = 0;
@@ -399,7 +401,7 @@ void CMsnProto::MSN_CreateContList(void)
}
LeaveCriticalSection(&csLists);
- if (sz)
+ if (sz)
{
sz += mir_snprintf(cxml+sz, sizeof(cxml)-sz, "</ml>");
msnNsThread->sendPacket("ADL", "%d\r\n%s", sz, cxml);
@@ -419,11 +421,11 @@ static void AddPrivacyListEntries(HWND hwndList, CMsnProto *proto)
// Delete old info
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
- while (hItem)
+ while (hItem)
{
HANDLE hItemNext = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
- if (IsHContactInfo(hItem))
+ if (IsHContactInfo(hItem))
SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0);
hItem = hItemNext;
@@ -485,7 +487,7 @@ static void SetAllContactIcons(HANDLE hItem, HWND hwndList, CMsnProto* proto)
if (hItem == NULL)
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
- while (hItem)
+ while (hItem)
{
HANDLE hItemN = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
@@ -528,7 +530,7 @@ static void SaveSettings(HANDLE hItem, HWND hwndList, CMsnProto* proto)
if (hItem == NULL)
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
- while (hItem)
+ while (hItem)
{
if (IsHContactGroup(hItem))
{
@@ -573,7 +575,7 @@ static void SaveSettings(HANDLE hItem, HWND hwndList, CMsnProto* proto)
{
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hItem, 0);
MsnContact* msc = proto->Lists_Get(szEmail);
- if (msc) msc->hContact = NULL;
+ if (msc) msc->hContact = NULL;
}
}
}
@@ -583,7 +585,7 @@ static void SaveSettings(HANDLE hItem, HWND hwndList, CMsnProto* proto)
INT_PTR CALLBACK DlgProcMsnServLists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
+ switch(msg)
{
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
@@ -622,7 +624,7 @@ INT_PTR CALLBACK DlgProcMsnServLists(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
SendMessage(hwndList, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml);
SendMessage(hwndList, CLM_SETEXTRACOLUMNS, 5, 0);
-
+
ResetListOptions(hwndList);
EnableWindow(hwndList, ((CMsnProto*)lParam)->msnLoggedIn);
}
@@ -633,7 +635,7 @@ INT_PTR CALLBACK DlgProcMsnServLists(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
// break;
case WM_COMMAND:
- if (LOWORD(wParam) == IDC_LISTREFRESH)
+ if (LOWORD(wParam) == IDC_LISTREFRESH)
{
HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST);
SendMessage(hwndList, CLM_AUTOREBUILD, 0, 0);
@@ -657,10 +659,10 @@ INT_PTR CALLBACK DlgProcMsnServLists(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
}
else if (nmc->hdr.idFrom == IDC_LIST)
{
- switch (nmc->hdr.code)
+ switch (nmc->hdr.code)
{
case CLN_NEWCONTACT:
- if ((nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0)
+ if ((nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0)
SetContactIcons(nmc->hItem, nmc->hdr.hwndFrom, proto);
break;