summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Discord/src/guilds.cpp4
-rw-r--r--protocols/Discord/src/proto.cpp2
-rw-r--r--protocols/Discord/src/utils.cpp2
-rw-r--r--protocols/FacebookRM/src/contacts.cpp3
-rw-r--r--protocols/Gadu-Gadu/src/import.cpp2
-rw-r--r--protocols/ICQ-WIM/src/poll.cpp11
-rw-r--r--protocols/ICQ-WIM/src/proto.cpp7
-rw-r--r--protocols/JabberG/src/jabber_events.cpp2
-rw-r--r--protocols/NewsAggregator/Src/Options.cpp4
-rw-r--r--protocols/Non-IM Contact/src/contactinfo.cpp11
-rw-r--r--protocols/SkypeWeb/src/skype_contacts.cpp2
-rw-r--r--protocols/Steam/src/steam_contacts.cpp3
-rw-r--r--protocols/Tox/src/tox_contacts.cpp3
-rw-r--r--protocols/Twitter/src/contacts.cpp5
-rw-r--r--protocols/VKontakte/src/misc.cpp2
15 files changed, 29 insertions, 34 deletions
diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp
index 7b48b87e90..b2d6e85b11 100644
--- a/protocols/Discord/src/guilds.cpp
+++ b/protocols/Discord/src/guilds.cpp
@@ -75,14 +75,14 @@ void CDiscordProto::ProcessRole(CDiscordGuild *guild, const JSONNode &role)
static void sttSetGroupName(MCONTACT hContact, const wchar_t *pwszGroupName)
{
- ptrW wszOldName(db_get_wsa(hContact, "CList", "Group"));
+ ptrW wszOldName(Clist_GetGroup(hContact));
if (wszOldName != nullptr) {
ptrW wszChatGroup(Chat_GetGroup());
if (mir_wstrcmpi(wszOldName, wszChatGroup))
return; // custom group, don't touch it
}
- db_set_ws(hContact, "CList", "Group", pwszGroupName);
+ Clist_SetGroup(hContact, pwszGroupName);
}
void CDiscordProto::BatchChatCreate(void *param)
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp
index 0526883730..b3388a3268 100644
--- a/protocols/Discord/src/proto.cpp
+++ b/protocols/Discord/src/proto.cpp
@@ -355,7 +355,7 @@ MCONTACT CDiscordProto::AddToList(int flags, PROTOSEARCHRESULT *psr)
setId(hContact, DB_KEY_ID, pUser->id);
}
- db_set_ws(hContact, "CList", "Group", m_wszDefaultGroup);
+ Clist_SetGroup(hContact, m_wszDefaultGroup);
setWString(hContact, DB_KEY_NICK, pUser->wszUsername);
setDword(hContact, DB_KEY_DISCR, pUser->iDiscriminator);
arUsers.insert(pUser);
diff --git a/protocols/Discord/src/utils.cpp b/protocols/Discord/src/utils.cpp
index 8735b2bffe..95a7b098c3 100644
--- a/protocols/Discord/src/utils.cpp
+++ b/protocols/Discord/src/utils.cpp
@@ -165,7 +165,7 @@ CDiscordUser* CDiscordProto::PrepareUser(const JSONNode &user)
MCONTACT hContact = db_add_contact();
Proto_AddToContact(hContact, m_szModuleName);
- db_set_ws(hContact, "CList", "Group", m_wszDefaultGroup);
+ Clist_SetGroup(hContact, m_wszDefaultGroup);
setId(hContact, DB_KEY_ID, id);
setWString(hContact, DB_KEY_NICK, username);
setDword(hContact, DB_KEY_DISCR, iDiscriminator);
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp
index 30271d8bb0..74f73fae43 100644
--- a/protocols/FacebookRM/src/contacts.cpp
+++ b/protocols/FacebookRM/src/contacts.cpp
@@ -246,8 +246,7 @@ MCONTACT FacebookProto::AddToContactList(facebook_user* fbu, bool force_add, boo
db_unset(hContact, "CList", "MyHandle");
- if (m_tszDefaultGroup)
- db_set_ws(hContact, "CList", "Group", m_tszDefaultGroup);
+ Clist_SetGroup(hContact, m_tszDefaultGroup);
setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, fbu->type);
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp
index 8c8a73128f..f8e93fd33f 100644
--- a/protocols/Gadu-Gadu/src/import.cpp
+++ b/protocols/Gadu-Gadu/src/import.cpp
@@ -228,7 +228,7 @@ void GaduProto::parsecontacts(char *contacts)
if (hContact && strGroup) {
ptrW tszGrpName(mir_a2u(strGroup));
Clist_GroupCreate(0, tszGrpName);
- db_set_ws(hContact, "CList", "Group", tszGrpName);
+ Clist_SetGroup(hContact, tszGrpName);
}
// Write misc data
diff --git a/protocols/ICQ-WIM/src/poll.cpp b/protocols/ICQ-WIM/src/poll.cpp
index 0f53a249fd..2c8fead4ea 100644
--- a/protocols/ICQ-WIM/src/poll.cpp
+++ b/protocols/ICQ-WIM/src/poll.cpp
@@ -37,17 +37,17 @@ void CIcqProto::ProcessBuddyList(const JSONNode &ev)
setWString(hContact, "IcqGroup", szGroup);
- CMStringW mirGroup(db_get_sm(hContact, "CList", "Group"));
+ ptrW mirGroup(Clist_GetGroup(hContact));
if (mirGroup != szGroup)
bEnableMenu = true;
- if (mirGroup.IsEmpty()) {
+ if (mirGroup) {
if (!bCreated) {
Clist_GroupCreate(0, szGroup);
bCreated = true;
}
- db_set_ws(hContact, "CList", "Group", szGroup);
+ Clist_SetGroup(hContact, szGroup);
}
}
}
@@ -81,13 +81,14 @@ void CIcqProto::ProcessDiff(const JSONNode &ev)
setWString(hContact, "IcqGroup", szGroup);
- if (db_get_sm(hContact, "CList", "Group").IsEmpty()) {
+ ptrW wszGroup(Clist_GetGroup(hContact));
+ if (!wszGroup) {
if (!bCreated) {
Clist_GroupCreate(0, szGroup);
bCreated = true;
}
- db_set_ws(hContact, "CList", "Group", szGroup);
+ Clist_SetGroup(hContact, szGroup);
}
}
}
diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp
index 49e5c4fb93..87dd35189a 100644
--- a/protocols/ICQ-WIM/src/proto.cpp
+++ b/protocols/ICQ-WIM/src/proto.cpp
@@ -169,9 +169,10 @@ INT_PTR CIcqProto::UploadGroups(WPARAM, LPARAM)
if (isChatRoom(it))
continue;
- CMStringW wszIcqGroup(getMStringW(it, "IcqGroup")), wszMirGroup(db_get_wsm(it, "CList", "Group"));
- if (wszMirGroup.IsEmpty())
- wszMirGroup = L"General";
+ CMStringW wszIcqGroup(getMStringW(it, "IcqGroup"));
+ ptrW wszMirGroup(Clist_GetGroup(it));
+ if (!wszMirGroup)
+ wszMirGroup = mir_wstrdup(L"General");
if (wszIcqGroup != wszMirGroup)
MoveContactToGroup(it, wszIcqGroup, wszMirGroup);
}
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp
index 325de81a36..5e0751fb10 100644
--- a/protocols/JabberG/src/jabber_events.cpp
+++ b/protocols/JabberG/src/jabber_events.cpp
@@ -141,7 +141,7 @@ void __cdecl CJabberProto::OnAddContactForever(MCONTACT hContact)
if (nick == nullptr)
return;
- AddContactToRoster(jid, nick, ptrA(db_get_utfa(hContact, "CList", "Group")));
+ AddContactToRoster(jid, nick, T2Utf(ptrW(Clist_GetGroup(hContact))));
XmlNode xPresence("presence"); xPresence << XATTR("to", jid) << XATTR("type", "subscribe");
ptrA myNick(getUStringA(0, "Nick"));
diff --git a/protocols/NewsAggregator/Src/Options.cpp b/protocols/NewsAggregator/Src/Options.cpp
index 6239ce15c1..986051a6bf 100644
--- a/protocols/NewsAggregator/Src/Options.cpp
+++ b/protocols/NewsAggregator/Src/Options.cpp
@@ -229,7 +229,7 @@ void CExportFeed::OnOk(CCtrlBase*)
*title = g_plugin.getWStringA(hContact, "Nick"),
*url = g_plugin.getWStringA(hContact, "URL"),
*siteurl = g_plugin.getWStringA(hContact, "Homepage"),
- *group = db_get_wsa(hContact, "CList", "Group");
+ *group = Clist_GetGroup(hContact);
TiXmlElement *elem = xmlBody;
if (group) {
@@ -579,8 +579,8 @@ void CImportFeed::OnOk(CCtrlBase*)
}
if (!wszGroup.IsEmpty()) {
- db_set_ws(hContact, "CList", "Group", wszGroup);
Clist_GroupCreate(0, wszGroup);
+ Clist_SetGroup(hContact, wszGroup);
}
}
mir_free(text);
diff --git a/protocols/Non-IM Contact/src/contactinfo.cpp b/protocols/Non-IM Contact/src/contactinfo.cpp
index 00c718fad2..38a6312728 100644
--- a/protocols/Non-IM Contact/src/contactinfo.cpp
+++ b/protocols/Non-IM Contact/src/contactinfo.cpp
@@ -135,10 +135,9 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
for (int i = 1; (szGroup = Clist_GroupGetName(i, nullptr)) != nullptr; i++)
SendDlgItemMessage(hwnd, IDC_GROUP, CB_INSERTSTRING, 0, LPARAM(szGroup));
- if (!db_get_ws(hContact, "CList", "Group", &dbv)) {
- SetDlgItemText(hwnd, IDC_GROUP, dbv.pwszVal);
- db_free(&dbv);
- }
+ ptrW wszGroup(Clist_GetGroup(hContact));
+ if (wszGroup)
+ SetDlgItemTextW(hwnd, IDC_GROUP, wszGroup);
/* icons */
CheckRadioButton(hwnd, 40072, 40077, g_plugin.getWord(hContact, "Icon", ID_STATUS_ONLINE));
@@ -237,9 +236,9 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
wchar_t text[512];
GetDlgItemText(hwnd, IDC_GROUP, text, _countof(text));
Clist_GroupCreate(NULL, text);
- db_set_ws(hContact, "CList", "Group", text);
+ Clist_SetGroup(hContact, text);
}
- else db_unset(hContact, "CList", "Group");
+ else Clist_SetGroup(hContact, nullptr);
for (int i = ID_STATUS_ONLINE; i <= ID_STATUS_MAX; i++)
if (IsDlgButtonChecked(hwnd, i))
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp
index 7ed1b5991d..93b938e1e6 100644
--- a/protocols/SkypeWeb/src/skype_contacts.cpp
+++ b/protocols/SkypeWeb/src/skype_contacts.cpp
@@ -78,7 +78,7 @@ MCONTACT CSkypeProto::AddContact(const char *skypename, bool isTemporary)
if (m_opts.wstrCListGroup) {
Clist_GroupCreate(0, m_opts.wstrCListGroup);
- db_set_ws(hContact, "CList", "Group", m_opts.wstrCListGroup);
+ Clist_SetGroup(hContact, m_opts.wstrCListGroup);
}
setByte(hContact, "Auth", 1);
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp
index f9264b7b7b..9552ee3485 100644
--- a/protocols/Steam/src/steam_contacts.cpp
+++ b/protocols/Steam/src/steam_contacts.cpp
@@ -362,8 +362,7 @@ MCONTACT CSteamProto::AddContact(const char *steamId, const wchar_t *nick, bool
//setByte(hContact, "Grant", 1);
// move to default group
- if (m_defaultGroup)
- db_set_ws(hContact, "CList", "Group", m_defaultGroup);
+ Clist_SetGroup(hContact, m_defaultGroup);
return hContact;
}
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp
index 082c6c9019..ea388e0748 100644
--- a/protocols/Tox/src/tox_contacts.cpp
+++ b/protocols/Tox/src/tox_contacts.cpp
@@ -92,8 +92,7 @@ MCONTACT CToxProto::AddContact(const char *address, const wchar_t *nick, const w
setWString(hContact, TOX_SETTINGS_DNS, dnsId);
if (!isTemporary) {
- if (m_defaultGroup)
- db_set_ws(hContact, "CList", "Group", m_defaultGroup);
+ Clist_SetGroup(hContact, m_defaultGroup);
setByte(hContact, "Auth", 1);
setByte(hContact, "Grant", 1);
diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp
index 7f22e8e700..caed5ebeb9 100644
--- a/protocols/Twitter/src/contacts.cpp
+++ b/protocols/Twitter/src/contacts.cpp
@@ -245,10 +245,7 @@ MCONTACT TwitterProto::AddToClientList(const char *name, const char *status)
db_set_utf(hContact, "CList", "StatusMsg", status);
Skin_PlaySound("TwitterNewContact");
- ptrW wszGroup(getWStringA(TWITTER_KEY_GROUP));
- if (wszGroup)
- db_set_ws(hContact, "CList", "Group", wszGroup);
-
+ Clist_SetGroup(hContact, getMStringW(TWITTER_KEY_GROUP));
return hContact;
}
db_delete_contact(hContact);
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index 4765e129a3..18b19121df 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -183,7 +183,7 @@ MCONTACT CVkProto::FindUser(LONG dwUserid, bool bCreate)
MCONTACT hNewContact = db_add_contact();
Proto_AddToContact(hNewContact, m_szModuleName);
setDword(hNewContact, "ID", dwUserid);
- db_set_ws(hNewContact, "CList", "Group", m_vkOptions.pwszDefaultGroup);
+ Clist_SetGroup(hNewContact, m_vkOptions.pwszDefaultGroup);
if (dwUserid < 0)
setByte(hNewContact, "IsGroup", 1);
return hNewContact;