summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-11-15 14:16:51 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-11-15 14:16:51 +0300
commit7d053a2f4a6c6b8ba7400fce490bab6418672191 (patch)
treee20066a6e0c779157f7a4fb2d2e014191a7c5c50
parent7b52e97b1e21373454e52f8d8ce99442995a4c0b (diff)
let's assign a group name only if it's missing, don't touch manually assigned group names
-rw-r--r--src/mir_app/src/chat_clist.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp
index f9c1eb4597..7358635617 100644
--- a/src/mir_app/src/chat_clist.cpp
+++ b/src/mir_app/src/chat_clist.cpp
@@ -24,22 +24,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
MCONTACT AddRoom(const char *pszModule, const wchar_t *pszRoom, const wchar_t *pszDisplayName, int iType)
{
- ptrW wszGroup(Chat_GetGroup());
- if (mir_wstrlen(wszGroup)) {
- MGROUP hGroup = Clist_GroupExists(wszGroup);
+ ptrW pwszGroup(Chat_GetGroup());
+ if (mir_wstrlen(pwszGroup)) {
+ MGROUP hGroup = Clist_GroupExists(pwszGroup);
if (hGroup == 0) {
- hGroup = Clist_GroupCreate(0, wszGroup);
+ hGroup = Clist_GroupCreate(0, pwszGroup);
if (hGroup)
Clist_GroupSetExpanded(hGroup, 1);
}
}
MCONTACT hContact = g_chatApi.FindRoom(pszModule, pszRoom);
- if (hContact) { // contact exist, make sure it is in the right group
- if (mir_wstrlen(wszGroup)) {
- ptrW grpName(Clist_GetGroup(hContact));
- if (mir_wstrcmp(wszGroup, grpName))
- Clist_SetGroup(hContact, wszGroup);
+ if (hContact) {
+ // contact exists, let's assign the standard group name if it's missing
+ if (mir_wstrlen(pwszGroup)) {
+ ptrW pwszOldGroup(Clist_GetGroup(hContact));
+ if (!mir_wstrlen(pwszOldGroup))
+ Clist_SetGroup(hContact, pwszGroup);
}
db_set_w(hContact, pszModule, "Status", ID_STATUS_OFFLINE);
@@ -52,7 +53,7 @@ MCONTACT AddRoom(const char *pszModule, const wchar_t *pszRoom, const wchar_t *p
return 0;
Proto_AddToContact(hContact, pszModule);
- Clist_SetGroup(hContact, wszGroup);
+ Clist_SetGroup(hContact, pwszGroup);
db_set_ws(hContact, pszModule, "Nick", pszDisplayName);
db_set_ws(hContact, pszModule, "ChatRoomID", pszRoom);