From 92b173c3a8553b59077aa2757c9627cb4c73d29e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 20 Jan 2017 00:11:36 +0300 Subject: Chat_NewSession to return a pointer to a newly created session, not to dig it anymore --- protocols/Gadu-Gadu/src/groupchat.cpp | 3 ++- protocols/JabberG/src/jabber_chat.cpp | 4 +--- protocols/JabberG/src/jabber_proto.cpp | 2 +- protocols/MRA/src/Mra_functions.cpp | 13 +++---------- protocols/MRA/src/stdafx.h | 2 +- 5 files changed, 8 insertions(+), 16 deletions(-) (limited to 'protocols') diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 7137639aed..2463ef22ca 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -344,7 +344,8 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou int i; for(i = 0; i < recipients_count; i++) chat->recipients[i] = recipients[i]; - if (sender) chat->recipients[i] = sender; + if (sender) + chat->recipients[i] = sender; // Add contacts for(i = 0; i < chat->recipients_count; i++) { diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 426fcd98fc..bc5d850268 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -127,9 +127,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) sttRoleItems[i].translate(); ptrW szNick(JabberNickFromJID(item->jid)); - Chat_NewSession(GCW_CHATROOM, m_szModuleName, item->jid, szNick); - - GCSessionInfoBase *si = pci->SM_FindSession(item->jid, m_szModuleName); + GCSessionInfoBase *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, item->jid, szNick); if (si != NULL) { item->hContact = si->hContact; diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index be0bbb6e50..6d46ddb8a1 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -219,7 +219,7 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) GCREGISTER gcr = {}; gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR; - gcr.nColors = 16; + gcr.nColors = _countof(crCols); gcr.pColors = &crCols[0]; gcr.ptszDispName = m_tszUserName; gcr.pszModule = m_szModuleName; diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index da0f03fd69..d894a0299f 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -526,16 +526,9 @@ MCONTACT CMraProto::MraHContactFromEmail(const CMStringA &szEmail, BOOL bAddIfNe //not already there: add if (IsEMailChatAgent(szEmail)) { CMStringW wszEMail = szEmail; - if (Chat_NewSession(GCW_CHATROOM, m_szModuleName, wszEMail, wszEMail) == 0) { - BOOL bChatAdded = FALSE; - for (hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { - if (mraGetStringA(hContact, "ChatRoomID", szEMailLocal)) { - if (szEMailLocal == szEmail) { - bChatAdded = TRUE; - break; - } - } - } + GCSessionInfoBase *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, wszEMail, wszEMail); + if (si != 0) { + bool bChatAdded = (si->hContact != NULL); if (bChatAdded == FALSE) hContact = NULL; } diff --git a/protocols/MRA/src/stdafx.h b/protocols/MRA/src/stdafx.h index 29dfaa5fe9..6d61cdcc49 100644 --- a/protocols/MRA/src/stdafx.h +++ b/protocols/MRA/src/stdafx.h @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include -- cgit v1.2.3