From e5d58fc3bbbce2773b7c6c3f8b7da6faa66b672e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 17 Sep 2016 16:37:24 +0000 Subject: chats: more functions, less structures git-svn-id: http://svn.miranda-ng.org/main/trunk@17309 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/MRA/src/MraChat.cpp | 27 +++++++++++---------------- protocols/MRA/src/Mra_functions.cpp | 2 +- 2 files changed, 12 insertions(+), 17 deletions(-) (limited to 'protocols/MRA') diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp index 7deb944d20..e09a76c374 100644 --- a/protocols/MRA/src/MraChat.cpp +++ b/protocols/MRA/src/MraChat.cpp @@ -13,7 +13,7 @@ void CMraProto::MraChatDllError() bool CMraProto::MraChatRegister() { - GCREGISTER gcr = { sizeof(gcr) }; + GCREGISTER gcr = {}; gcr.iMaxText = MRA_MAXLENOFMESSAGE; gcr.nColors = 0; gcr.ptszDispName = m_tszUserName; @@ -31,24 +31,23 @@ INT_PTR CMraProto::MraChatSessionNew(MCONTACT hContact) CMStringW wszEMail; mraGetStringW(hContact, "e-mail", wszEMail); - GCSESSION gcw = { sizeof(gcw) }; + 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.dwItemData = (DWORD)hContact; + gcw.pItemData = (void*)hContact; if (!Chat_NewSession(&gcw)) { GCDEST gcd = { m_szModuleName, wszEMail.c_str(), GC_EVENT_ADDGROUP }; - GCEVENT gce = { sizeof(gce), &gcd }; + GCEVENT gce = { &gcd }; for (int i = 0; i < _countof(lpwszStatuses); i++) { gce.ptszStatus = TranslateW(lpwszStatuses[i]); - Chat_Event(0, &gce); + Chat_Event(&gce); } - gcd.iType = GC_EVENT_CONTROL; - Chat_Event(SESSION_INITDONE, &gce); - Chat_Event(SESSION_ONLINE, &gce); + Chat_Control(m_szModuleName, wszEMail, SESSION_INITDONE); + Chat_Control(m_szModuleName, wszEMail, SESSION_ONLINE); DWORD opcode = MULTICHAT_GET_MEMBERS; CMStringA szEmail; @@ -65,15 +64,11 @@ void CMraProto::MraChatSessionDestroy(MCONTACT hContact) if (!bChatExists || hContact == NULL) return; - GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL }; - GCEVENT gce = { sizeof(gce), &gcd }; - CMStringW wszEMail; mraGetStringW(hContact, "e-mail", wszEMail); - gcd.ptszID = (LPWSTR)wszEMail.c_str(); - Chat_Event(SESSION_TERMINATE, &gce); - Chat_Event(WINDOW_CLEARLOG, &gce); + Chat_Terminate(m_szModuleName, wszEMail); + Chat_Control(m_szModuleName, wszEMail, WINDOW_CLEARLOG); } INT_PTR CMraProto::MraChatSessionEventSendByHandle(MCONTACT hContactChatSession, int iType, DWORD dwFlags, const CMStringA &lpszUID, LPCWSTR lpwszStatus, LPCWSTR lpwszMessage, DWORD_PTR dwItemData, DWORD dwTime) @@ -89,7 +84,7 @@ INT_PTR CMraProto::MraChatSessionEventSendByHandle(MCONTACT hContactChatSession, gcd.ptszID = (LPWSTR)wszID.c_str(); } - GCEVENT gce = { sizeof(gce), &gcd }; + GCEVENT gce = { &gcd }; gce.dwFlags = dwFlags; gce.ptszUID = wszUID; gce.ptszStatus = lpwszStatus; @@ -116,7 +111,7 @@ INT_PTR CMraProto::MraChatSessionEventSendByHandle(MCONTACT hContactChatSession, gce.ptszNick = wszUID; } - return Chat_Event(0, &gce); + return Chat_Event(&gce); } INT_PTR CMraProto::MraChatSessionInvite(MCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime) diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index f7e8a33f39..34c002235d 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -526,7 +526,7 @@ MCONTACT CMraProto::MraHContactFromEmail(const CMStringA &szEmail, BOOL bAddIfNe if (IsEMailChatAgent(szEmail)) { CMStringW wszEMail = szEmail; - GCSESSION gcw = { sizeof(gcw) }; + GCSESSION gcw = {}; gcw.iType = GCW_CHATROOM; gcw.pszModule = m_szModuleName; gcw.ptszName = wszEMail; -- cgit v1.2.3