summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-04-15 13:40:58 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-04-15 13:40:58 +0000
commit18f7e9261c885e953f220ba6836e8bca43a6fc88 (patch)
tree67cb94186914b97f1c0e8e815afffea7666b2510 /protocols
parentd2dd1c6dddd3e690ad13d2b355de60d3724e8ec6 (diff)
contact list groups:
- finally database is not used anymore (only as a settings' storage); - MGROUP type introduced to replace HANDLE for group ids; - MS_CLIST_GROUP* services became Clist_Group* functions; - CLIST_INTERFACE members pfnGetGroupName & pfnRenameGroup also transformed into static Clist_Group* functions git-svn-id: http://svn.miranda-ng.org/main/trunk@16659 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rwxr-xr-xprotocols/AimOscar/src/utility.cpp2
-rw-r--r--protocols/FacebookRM/src/connection.cpp2
-rw-r--r--protocols/FacebookRM/src/dialogs.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/import.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_servlist.cpp10
-rw-r--r--protocols/JabberG/src/jabber_iq_handlers.cpp2
-rw-r--r--protocols/JabberG/src/jabber_iqid.cpp2
-rw-r--r--protocols/JabberG/src/jabber_privacy.cpp10
-rw-r--r--protocols/MRA/src/Mra_proto.cpp2
-rw-r--r--protocols/MSN/src/msn_srv.cpp2
-rw-r--r--protocols/Sametime/src/userlist.cpp18
-rw-r--r--protocols/SkypeWeb/src/skype_options.cpp2
-rw-r--r--protocols/Steam/src/steam_options.cpp2
-rw-r--r--protocols/Tlen/src/tlen_iqid.cpp4
-rw-r--r--protocols/Tlen/src/tlen_thread.cpp2
-rw-r--r--protocols/Tox/src/tox_options.cpp4
-rw-r--r--protocols/Twitter/src/connection.cpp4
-rw-r--r--protocols/VKontakte/src/vk_options.cpp2
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp2
-rw-r--r--protocols/WhatsApp/src/proto.cpp2
20 files changed, 34 insertions, 44 deletions
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp
index 0c2b28e1a1..c535797fd4 100755
--- a/protocols/AimOscar/src/utility.cpp
+++ b/protocols/AimOscar/src/utility.cpp
@@ -364,7 +364,7 @@ void create_group(const char *group)
if (mir_strcmp(group, AIM_DEFAULT_GROUP) == 0) return;
TCHAR* szGroupName = mir_utf8decodeT(group);
- Clist_CreateGroup(0, szGroupName);
+ Clist_GroupCreate(0, szGroupName);
mir_free(szGroupName);
}
diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp
index 1924d94923..4a34435549 100644
--- a/protocols/FacebookRM/src/connection.cpp
+++ b/protocols/FacebookRM/src/connection.cpp
@@ -203,7 +203,7 @@ bool FacebookProto::NegotiateConnection()
// Create default group for new contacts
if (m_tszDefaultGroup)
- Clist_CreateGroup(0, m_tszDefaultGroup);
+ Clist_GroupCreate(0, m_tszDefaultGroup);
return facy.login(username, password);
}
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp
index 9eb3a946a0..2b8ec51728 100644
--- a/protocols/FacebookRM/src/dialogs.cpp
+++ b/protocols/FacebookRM/src/dialogs.cpp
@@ -407,7 +407,7 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
{
proto->m_tszDefaultGroup = mir_tstrdup(tstr);
proto->setTString(FACEBOOK_KEY_DEF_GROUP, tstr);
- Clist_CreateGroup(0, tstr);
+ Clist_GroupCreate(0, tstr);
}
else {
proto->delSetting(FACEBOOK_KEY_DEF_GROUP);
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp
index 0eda9f87f7..9db2f2e3a9 100644
--- a/protocols/Gadu-Gadu/src/import.cpp
+++ b/protocols/Gadu-Gadu/src/import.cpp
@@ -217,7 +217,7 @@ void GGPROTO::parsecontacts(char *contacts)
// Write group
if (hContact && strGroup) {
ptrT tszGrpName( mir_a2t(strGroup));
- Clist_CreateGroup(0, tszGrpName);
+ Clist_GroupCreate(0, tszGrpName);
db_set_ts(hContact, "CList", "Group", tszGrpName);
}
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp
index 5229455a4c..1c1ea58350 100644
--- a/protocols/IcqOscarJ/src/icq_servlist.cpp
+++ b/protocols/IcqOscarJ/src/icq_servlist.cpp
@@ -1380,7 +1380,7 @@ int CIcqProto::getCListGroupExists(const char *szGroup)
if (utf8_to_tchar_static(szGroup, tszGroup, size))
for (int i = 1; TRUE; i++) {
- TCHAR *tszGroupName = (TCHAR*)pcli->pfnGetGroupName(i, NULL);
+ TCHAR *tszGroupName = (TCHAR*)Clist_GroupGetName(i, NULL);
if (!tszGroupName)
break;
@@ -1395,12 +1395,8 @@ int CIcqProto::getCListGroupExists(const char *szGroup)
int CIcqProto::moveContactToCListGroup(MCONTACT hContact, const char *szGroup)
{
- HANDLE hGroup = Clist_CreateGroup(0, ptrT(mir_utf8decodeT(szGroup)));
-
- if (ServiceExists(MS_CLIST_CONTACTCHANGEGROUP))
- return CallService(MS_CLIST_CONTACTCHANGEGROUP, hContact, (LPARAM)hGroup);
- else /// TODO: is this neccessary ?
- return db_set_utf(hContact, "CList", "Group", szGroup);
+ MGROUP hGroup = Clist_GroupCreate(0, ptrT(mir_utf8decodeT(szGroup)));
+ return CallService(MS_CLIST_CONTACTCHANGEGROUP, hContact, hGroup);
}
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp
index 9d0bfde672..13e3cc5cca 100644
--- a/protocols/JabberG/src/jabber_iq_handlers.cpp
+++ b/protocols/JabberG/src/jabber_iq_handlers.cpp
@@ -278,7 +278,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo)
if (!m_options.IgnoreRosterGroups) {
if (item->group != NULL) {
- Clist_CreateGroup(0, item->group);
+ Clist_GroupCreate(0, item->group);
db_set_ts(hContact, "CList", "Group", item->group);
}
else db_unset(hContact, "CList", "Group");
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index 8b1aba4adb..a227f52819 100644
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -451,7 +451,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo)
if (!m_options.IgnoreRosterGroups) {
if (item->group != NULL) {
- Clist_CreateGroup(0, item->group);
+ Clist_GroupCreate(0, item->group);
// Don't set group again if already correct, or Miranda may show wrong group count in some case
ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp
index 4b2c0c1d80..0f56b27c7a 100644
--- a/protocols/JabberG/src/jabber_privacy.cpp
+++ b/protocols/JabberG/src/jabber_privacy.cpp
@@ -453,7 +453,7 @@ public:
SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_RESETCONTENT, 0, 0);
{
TCHAR *grpName;
- for (int i=1; (grpName = pcli->pfnGetGroupName(i, NULL)) != NULL; i++)
+ for (int i=1; (grpName = Clist_GroupGetName(i, NULL)) != NULL; i++)
SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_ADDSTRING, 0, (LPARAM)grpName);
}
@@ -1355,8 +1355,8 @@ void CJabberDlgPrivacyLists::CListApplyList(HWND hwndList, CPrivacyList *pList)
CListResetIcons(hwndList, clc_info.hItemSubTo, bHideIcons);
// group handles start with 1 (0 is "root")
- for (int iGroup = 1; pcli->pfnGetGroupName(iGroup, NULL) != NULL; iGroup++) {
- HANDLE hItem = m_clcClist.FindGroup((HANDLE)iGroup);
+ for (MGROUP iGroup = 1; Clist_GroupGetName(iGroup, NULL) != NULL; iGroup++) {
+ HANDLE hItem = m_clcClist.FindGroup(iGroup);
if (hItem)
CListResetIcons(hwndList, hItem, bHideIcons);
}
@@ -1475,8 +1475,8 @@ void CJabberDlgPrivacyLists::CListBuildList(HWND hwndList, CPrivacyList *pList)
// group handles start with 1 (0 is "root")
TCHAR *grpName;
- for (int iGroup = 1; (grpName = pcli->pfnGetGroupName(iGroup, NULL)) != NULL; iGroup++) {
- hItem = m_clcClist.FindGroup((HANDLE)iGroup);
+ for (MGROUP iGroup = 1; (grpName = Clist_GroupGetName(iGroup, NULL)) != NULL; iGroup++) {
+ hItem = m_clcClist.FindGroup(iGroup);
if (dwPackets = CListGetPackets(hwndList, hItem, true))
pList->AddRule(Group, grpName, TRUE, dwOrder++, dwPackets);
if (dwPackets = CListGetPackets(hwndList, hItem, false))
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp
index 83c0d89f49..7026623302 100644
--- a/protocols/MRA/src/Mra_proto.cpp
+++ b/protocols/MRA/src/Mra_proto.cpp
@@ -1089,7 +1089,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf)
if (dwControlParam > 1) { // все параметры правильно инициализированны!
if (!(dwGroupFlags & CONTACT_FLAG_REMOVED)) {
m_groups.insert(new MraGroupItem(dwID, dwGroupFlags, wszGroupName));
- Clist_CreateGroup(0, wszGroupName);
+ Clist_GroupCreate(0, wszGroupName);
}
debugLogW(L"'%s', flags: %lu (", wszGroupName, dwGroupFlags);
diff --git a/protocols/MSN/src/msn_srv.cpp b/protocols/MSN/src/msn_srv.cpp
index 73f69e8e39..33f1a10da5 100644
--- a/protocols/MSN/src/msn_srv.cpp
+++ b/protocols/MSN/src/msn_srv.cpp
@@ -38,7 +38,7 @@ void CMsnProto::MSN_AddGroup(const char* grpName, const char *grpId, bool init)
m_arGroups.insert(p);
if (init)
- Clist_CreateGroup(0, ptrT(mir_utf8decodeT(grpName)));
+ Clist_GroupCreate(0, ptrT(mir_utf8decodeT(grpName)));
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp
index 2b85a75c0e..d9ea2ea318 100644
--- a/protocols/Sametime/src/userlist.cpp
+++ b/protocols/Sametime/src/userlist.cpp
@@ -48,15 +48,9 @@ void CSametimeProto::AddGroup(const char* name, bool expanded)
if (name && mir_strcmp(name, Translate("None")) == 0)
return;
- ptrT ptszGroup(mir_utf8decodeT(name));
- HANDLE hGroup = Clist_GroupExists(ptszGroup);
- if (hGroup == NULL) {
- hGroup = Clist_CreateGroup(NULL, ptszGroup);
- if (hGroup) {
- CallService(MS_CLUI_GROUPADDED, (WPARAM)hGroup, 0);
- CallService(MS_CLIST_GROUPSETEXPANDED, (WPARAM)hGroup, expanded ? 1 : 0);
- }
- }
+ MGROUP hGroup = Clist_GroupCreate(NULL, ptrT(mir_utf8decodeT(name)));
+ CallService(MS_CLUI_GROUPADDED, hGroup, 0);
+ Clist_GroupSetExpanded(hGroup, expanded);
}
MCONTACT CSametimeProto::AddContact(mwSametimeUser* user, bool temporary)
@@ -245,10 +239,10 @@ void CSametimeProto::ExportContactsToList(mwSametimeList* user_list)
//group_open = (db_get_b(0, szProtoGroups, buff, 0) == 1);
ptrT ptszGroup(mir_utf8decodeT(group_alias));
- HANDLE hGroup = Clist_GroupExists(ptszGroup);
+ MGROUP hGroup = Clist_GroupExists(ptszGroup);
if (hGroup) {
- int expanded;
- CallService(MS_CLIST_GROUPGETNAME, (WPARAM)hGroup, (LPARAM)&expanded);
+ DWORD expanded;
+ Clist_GroupGetName(hGroup, &expanded);
group_open = (expanded != 0);
}
else {
diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp
index fe161f1d5d..fc6136012c 100644
--- a/protocols/SkypeWeb/src/skype_options.cpp
+++ b/protocols/SkypeWeb/src/skype_options.cpp
@@ -63,7 +63,7 @@ void CSkypeOptionsMain::OnApply()
m_proto->setString("Password", szNewPassword);
ptrT group(m_group.GetText());
if (mir_tstrlen(group) > 0 && !Clist_GroupExists(group))
- Clist_CreateGroup(0, group);
+ Clist_GroupCreate(0, group);
}
/////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Steam/src/steam_options.cpp b/protocols/Steam/src/steam_options.cpp
index 7dc841451a..666e206978 100644
--- a/protocols/Steam/src/steam_options.cpp
+++ b/protocols/Steam/src/steam_options.cpp
@@ -27,7 +27,7 @@ void CSteamOptionsMain::OnApply()
{
TCHAR *group = m_group.GetText();
if (mir_tstrlen(group) > 0 && !Clist_GroupExists(group))
- Clist_CreateGroup(0, group);
+ Clist_GroupCreate(0, group);
if (m_proto->IsOnline())
{
diff --git a/protocols/Tlen/src/tlen_iqid.cpp b/protocols/Tlen/src/tlen_iqid.cpp
index aa27bb4e04..810c3b9f66 100644
--- a/protocols/Tlen/src/tlen_iqid.cpp
+++ b/protocols/Tlen/src/tlen_iqid.cpp
@@ -112,7 +112,7 @@ void TlenResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) {
if (item->group) mir_free(item->group);
if ((groupNode = TlenXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
item->group = TlenGroupDecode(groupNode->text);
- Clist_CreateGroup(0, _A2T(item->group));
+ Clist_GroupCreate(0, _A2T(item->group));
// Don't set group again if already correct, or Miranda may show wrong group count in some case
if (!db_get(hContact, "CList", "Group", &dbv)) {
if (mir_strcmp(dbv.pszVal, item->group))
@@ -184,7 +184,7 @@ void TlenIqResultRoster(TlenProtocol *proto, XmlNode *iqNode)
if (item->group) mir_free(item->group);
if ((groupNode = TlenXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
item->group = TlenGroupDecode(groupNode->text);
- Clist_CreateGroup(0, _A2T(item->group));
+ Clist_GroupCreate(0, _A2T(item->group));
// Don't set group again if already correct, or Miranda may show wrong group count in some case
if (!db_get(hContact, "CList", "Group", &dbv)) {
if (mir_strcmp(dbv.pszVal, item->group))
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp
index 99a27ba533..77dac550d6 100644
--- a/protocols/Tlen/src/tlen_thread.cpp
+++ b/protocols/Tlen/src/tlen_thread.cpp
@@ -807,7 +807,7 @@ static void TlenProcessIq(XmlNode *node, ThreadData *info)
if (item->group) mir_free(item->group);
if ((groupNode=TlenXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
item->group = TlenGroupDecode(groupNode->text);
- Clist_CreateGroup(0, _A2T(item->group));
+ Clist_GroupCreate(0, _A2T(item->group));
db_set_s(hContact, "CList", "Group", item->group);
}
else {
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp
index a5f63da6ee..f28009ade5 100644
--- a/protocols/Tox/src/tox_options.cpp
+++ b/protocols/Tox/src/tox_options.cpp
@@ -80,7 +80,7 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*)
{
ptrT group(m_group.GetText());
if (mir_tstrlen(group) > 0 && Clist_GroupExists(group))
- Clist_CreateGroup(0, group);
+ Clist_GroupCreate(0, group);
m_proto->UninitToxCore(&toxThread);
@@ -158,7 +158,7 @@ void CToxOptionsMain::OnApply()
{
ptrT group(m_group.GetText());
if (mir_tstrlen(group) > 0 && Clist_GroupExists(group))
- Clist_CreateGroup(0, group);
+ Clist_GroupCreate(0, group);
if (m_proto->IsOnline())
{
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp
index 1fda6d3cb1..80bdf2b14d 100644
--- a/protocols/Twitter/src/connection.cpp
+++ b/protocols/Twitter/src/connection.cpp
@@ -176,7 +176,7 @@ bool TwitterProto::NegotiateConnection()
}
if (!getTString(TWITTER_KEY_GROUP, &dbv)) {
- CallService(MS_CLIST_GROUPCREATE, 0, (LPARAM)dbv.ptszVal);
+ Clist_GroupCreate(0, dbv.ptszVal);
db_free(&dbv);
}
@@ -193,7 +193,7 @@ bool TwitterProto::NegotiateConnection()
realAccessTok = true;
//debugLogW("**NegotiateConnection - we have an oauthAccessToken already in the db - %s", oauthAccessToken);
}
- else { debugLogA("**NegotiateConnection - oauthAccesToken too small? this is.. weird."); }
+ else debugLogA("**NegotiateConnection - oauthAccesToken too small? this is.. weird.");
}
dbTOKSec = getWString(TWITTER_KEY_OAUTH_ACCESS_TOK_SECRET, &dbv);
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp
index dcf0bfb609..feb6800aa5 100644
--- a/protocols/VKontakte/src/vk_options.cpp
+++ b/protocols/VKontakte/src/vk_options.cpp
@@ -196,7 +196,7 @@ void CVkOptionAccountForm::OnApply()
ptrT ptszGroupName(m_edtGroupName.GetText());
if (mir_tstrcmp(m_ptszOldGroup, ptszGroupName)) {
- Clist_CreateGroup(NULL, ptszGroupName);
+ Clist_GroupCreate(NULL, ptszGroupName);
m_ptszOldGroup = ptszGroupName;
}
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index 5f015cde7b..7012ebde4a 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -70,7 +70,7 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) :
nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
- Clist_CreateGroup(NULL, m_vkOptions.ptszDefaultGroup);
+ Clist_GroupCreate(NULL, m_vkOptions.ptszDefaultGroup);
CMStringA szListeningTo(FORMAT, "%sEnabled", m_szModuleName);
db_set_b(NULL, "ListeningTo", szListeningTo, m_vkOptions.iMusicSendMetod == 0 ? 0 : 1);
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp
index 3d63355f19..c4fa89948d 100644
--- a/protocols/WhatsApp/src/proto.cpp
+++ b/protocols/WhatsApp/src/proto.cpp
@@ -55,7 +55,7 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const TCHAR *username)
if (m_tszDefaultGroup == NULL)
m_tszDefaultGroup = mir_tstrdup(_T("WhatsApp"));
- Clist_CreateGroup(0, m_tszDefaultGroup);
+ Clist_GroupCreate(0, m_tszDefaultGroup);
SetAllContactStatuses(ID_STATUS_OFFLINE, true);
}