diff options
author | George Hazan <george.hazan@gmail.com> | 2016-09-19 14:17:59 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-09-19 14:17:59 +0000 |
commit | 9f974ab8617b6b7c19bac9e71d06de89d7e7bd03 (patch) | |
tree | adfbe951d1c291fe0904a083d332889aa043f3ac /protocols/MRA | |
parent | 0f37fbfbfe24563a6be07f9abd245374e66cb173 (diff) |
- struct GCSESSION died;
- Chat_NewSession simply gets 5 parameters;
- minor chat code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@17318 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA')
-rw-r--r-- | protocols/MRA/src/MraChat.cpp | 46 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_functions.cpp | 9 |
2 files changed, 21 insertions, 34 deletions
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp index 046093d84c..454d44a2e9 100644 --- a/protocols/MRA/src/MraChat.cpp +++ b/protocols/MRA/src/MraChat.cpp @@ -27,32 +27,26 @@ bool CMraProto::MraChatRegister() INT_PTR CMraProto::MraChatSessionNew(MCONTACT hContact)
{
if (bChatExists)
- if (hContact) {
- CMStringW wszEMail;
- mraGetStringW(hContact, "e-mail", wszEMail);
-
- GCSESSION gcw = {};
- gcw.iType = GCW_CHATROOM;
- gcw.pszModule = m_szModuleName;
- gcw.ptszName = pcli->pfnGetContactDisplayName(hContact, 0);
- gcw.ptszID = wszEMail;
- gcw.ptszStatusbarText = L"status bar";
- gcw.pItemData = (void*)hContact;
- if (!Chat_NewSession(&gcw)) {
- for (int i = 0; i < _countof(lpwszStatuses); i++)
- Chat_AddGroup(m_szModuleName, wszEMail, TranslateW(lpwszStatuses[i]));
-
- Chat_Control(m_szModuleName, wszEMail, SESSION_INITDONE);
- Chat_Control(m_szModuleName, wszEMail, SESSION_ONLINE);
-
- DWORD opcode = MULTICHAT_GET_MEMBERS;
- CMStringA szEmail;
- if (mraGetStringA(hContact, "e-mail", szEmail))
- MraMessage(FALSE, NULL, 0, MESSAGE_FLAG_MULTICHAT, szEmail, L"", (LPBYTE)&opcode, sizeof(opcode));
- return 0;
- }
- }
- return 1;
+ if (!hContact)
+ return 1;
+
+ CMStringW wszEMail;
+ mraGetStringW(hContact, "e-mail", wszEMail);
+
+ if (Chat_NewSession(GCW_CHATROOM, m_szModuleName, wszEMail, pcli->pfnGetContactDisplayName(hContact, 0), (void*)hContact))
+ return 1;
+
+ for (int i = 0; i < _countof(lpwszStatuses); i++)
+ Chat_AddGroup(m_szModuleName, wszEMail, TranslateW(lpwszStatuses[i]));
+
+ Chat_Control(m_szModuleName, wszEMail, SESSION_INITDONE);
+ Chat_Control(m_szModuleName, wszEMail, SESSION_ONLINE);
+
+ DWORD opcode = MULTICHAT_GET_MEMBERS;
+ CMStringA szEmail;
+ if (mraGetStringA(hContact, "e-mail", szEmail))
+ MraMessage(FALSE, NULL, 0, MESSAGE_FLAG_MULTICHAT, szEmail, L"", (LPBYTE)&opcode, sizeof(opcode));
+ return 0;
}
void CMraProto::MraChatSessionDestroy(MCONTACT hContact)
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 34c002235d..844d654245 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -525,14 +525,7 @@ MCONTACT CMraProto::MraHContactFromEmail(const CMStringA &szEmail, BOOL bAddIfNe //not already there: add
if (IsEMailChatAgent(szEmail)) {
CMStringW wszEMail = szEmail;
-
- GCSESSION gcw = {};
- gcw.iType = GCW_CHATROOM;
- gcw.pszModule = m_szModuleName;
- gcw.ptszName = wszEMail;
- gcw.ptszID = (LPWSTR)wszEMail.c_str();
-
- if (Chat_NewSession(&gcw) == 0) {
+ 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)) {
|