summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_chat.h2
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp3
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.cpp2
-rw-r--r--protocols/MRA/src/Mra_functions.cpp13
-rw-r--r--protocols/MRA/src/stdafx.h2
-rw-r--r--src/mir_app/src/chat_svc.cpp8
7 files changed, 13 insertions, 21 deletions
diff --git a/include/m_chat.h b/include/m_chat.h
index 12917f70ac..7f1adaac8d 100644
--- a/include/m_chat.h
+++ b/include/m_chat.h
@@ -173,7 +173,7 @@ EXTERN_C MIR_APP_DLL(int) Chat_Register(const GCREGISTER*);
#define GCW_PRIVMESS 3 // NOT SUPPORTED YET! the session is a 1 to 1 session, but with additional
// support for adding more users etc. ex "MSN session".
-EXTERN_C MIR_APP_DLL(int) Chat_NewSession(
+EXTERN_C MIR_APP_DLL(struct GCSessionInfoBase*) Chat_NewSession(
int iType, // Use one of the GCW_* flags above to set the type of session
const char *pszModule, // The name of the protocol owning the session (the same as pszModule when you register)
const wchar_t *ptszID, // The unique identifier for the session.
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 <m_nudge.h>
#include <m_folders.h>
#include <m_avatars.h>
-#include <m_chat.h>
+#include <m_chat_int.h>
#include <m_extraicons.h>
#include <m_music.h>
#include <m_xstatus.h>
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 8d15f996d1..2a09052ef1 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -187,7 +187,7 @@ MIR_APP_DLL(int) Chat_Register(const GCREGISTER *gcr)
/////////////////////////////////////////////////////////////////////////////////////////
// starts new chat session
-EXTERN_C MIR_APP_DLL(int) Chat_NewSession(
+EXTERN_C MIR_APP_DLL(GCSessionInfoBase*) Chat_NewSession(
int iType, // Use one of the GCW_* flags above to set the type of session
const char *pszModule, // The name of the protocol owning the session (the same as pszModule when you register)
const wchar_t *ptszID, // The unique identifier for the session.
@@ -197,7 +197,7 @@ EXTERN_C MIR_APP_DLL(int) Chat_NewSession(
mir_cslockfull lck(csChat);
MODULEINFO *mi = chatApi.MM_FindModule(pszModule);
if (mi == NULL)
- return GC_ERROR;
+ return NULL;
// try to restart a session first
SESSION_INFO *si = chatApi.SM_FindSession(ptszID, pszModule);
@@ -212,7 +212,7 @@ EXTERN_C MIR_APP_DLL(int) Chat_NewSession(
if (chatApi.OnReplaceSession)
chatApi.OnReplaceSession(si);
- return 0;
+ return si;
}
// create a new session
@@ -265,7 +265,7 @@ EXTERN_C MIR_APP_DLL(int) Chat_NewSession(
if (chatApi.OnCreateSession)
chatApi.OnCreateSession(si, mi);
- return 0;
+ return si;
}
/////////////////////////////////////////////////////////////////////////////////////////