summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-08 19:39:48 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-08 19:39:48 +0000
commit05cd7934d4bdb097e112efdda356946868f3f5d6 (patch)
tree0fa678b494af8b994abf7319298a1af06fc9218a /protocols/JabberG
parent50a2ba5bf6827b8f010288021c1797c11bd1531e (diff)
- end of ANSI support in chats;
- manual crit section control removed from chat engine; - bunch of memory-related clutches either removed or replaced with smart pointers git-svn-id: http://svn.miranda-ng.org/main/trunk@7549 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG')
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp39
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp18
-rw-r--r--protocols/JabberG/src/jabber_iqid.cpp4
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp8
-rw-r--r--protocols/JabberG/src/jabber_thread.cpp4
5 files changed, 20 insertions, 53 deletions
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index 16764bc529..32e77d3c0b 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -133,7 +133,6 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item)
gcw.pszModule = m_szModuleName;
gcw.ptszName = szNick;
gcw.ptszID = item->jid;
- gcw.dwFlags = GC_TCHAR;
CallServiceSync(MS_GC_NEWSESSION, NULL, (LPARAM)&gcw);
HANDLE hContact = HContactFromJID(item->jid);
@@ -166,19 +165,13 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item)
item->bChatActive = TRUE;
- GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_ADDGROUP };
- gcd.ptszID = item->jid;
-
- GCEVENT gce = { sizeof(GCEVENT) };
- gce.pDest = &gcd;
- gce.dwFlags = GC_TCHAR;
+ GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_ADDGROUP };
+ GCEVENT gce = { sizeof(gce), &gcd };
for (i = SIZEOF(sttStatuses)-1; i >= 0; i--) {
gce.ptszStatus = TranslateTS(sttStatuses[i]);
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
}
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
gcd.iType = GC_EVENT_CONTROL;
CallServiceSync(MS_GC_EVENT, (item->bAutoJoin && m_options.AutoJoinHidden) ? WINDOW_HIDDEN : SESSION_INITDONE, (LPARAM)&gce);
CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
@@ -253,17 +246,13 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus
}
if (*buf) {
- GCDEST gcd = { m_szModuleName, 0, 0 };
- gcd.ptszID = item->jid;
- GCEVENT gce = {0};
- gce.cbSize = sizeof(GCEVENT);
+ GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_INFORMATION };
+ GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszNick = user->m_tszResourceName;
gce.ptszUID = user->m_tszResourceName;
gce.ptszText = EscapeChatTags(buf);
- gce.dwFlags = GC_TCHAR | GCEF_ADDTOLOG;
- gce.pDest = &gcd;
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.time = time(0);
- gcd.iType = GC_EVENT_INFORMATION;
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
mir_free((void*)gce.ptszText); // Since we processed msgText and created a new string
@@ -286,17 +275,13 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const TCHAR *
if (myNick == NULL)
myNick = JabberNickFromJID(m_szJabberJID);
- GCDEST gcd = { m_szModuleName, 0, 0 };
- gcd.ptszID = item->jid;
- GCEVENT gce = {0};
- gce.cbSize = sizeof(GCEVENT);
+ GCDEST gcd = { m_szModuleName, item->jid };
+ GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszNick = nick;
gce.ptszUID = resource;
if (jid != NULL)
gce.ptszUserInfo = jid;
gce.ptszText = szReason;
- gce.dwFlags = GC_TCHAR;
- gce.pDest = &gcd;
if (item->bChatActive == 2) {
gce.dwFlags |= GCEF_ADDTOLOG;
gce.time = time(0);
@@ -351,14 +336,10 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason)
{
TCHAR *szMessage = NULL;
- GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL };
- gcd.ptszID = item->jid;
- GCEVENT gce = {0};
- gce.cbSize = sizeof(GCEVENT);
+ GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_CONTROL };
+ GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszUID = item->jid;
gce.ptszText = xmlGetText(reason);
- gce.dwFlags = GC_TCHAR;
- gce.pDest = &gcd;
if (code != 307 && code != 301) {
CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
@@ -1453,7 +1434,7 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam)
switch (gch->pDest->iType) {
case GC_USER_MESSAGE:
- if (gch->pszText && lstrlen(gch->ptszText) > 0) {
+ if (gch->ptszText && lstrlen(gch->ptszText) > 0) {
rtrimt(gch->ptszText);
if (m_bJabberOnline) {
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index fc27e29e78..3a1c740926 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -820,18 +820,13 @@ void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const TCHAR *ol
setTString(hContact, "MyNick", newNick);
}
- GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CHUID };
- gcd.ptszID = item->jid;
-
- GCEVENT gce = {0};
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
+ GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_CHUID };
+ GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszNick = oldNick;
gce.ptszText = newNick;
if (jid != NULL)
gce.ptszUserInfo = jid;
gce.time = time(0);
- gce.dwFlags = GC_TCHAR;
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
gcd.iType = GC_EVENT_NICK;
@@ -1072,8 +1067,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
if ( !lstrcmp(type, _T("error")))
return;
- GCDEST gcd = { m_szModuleName, NULL, 0 };
- gcd.ptszID = item->jid;
+ GCDEST gcd = { m_szModuleName, item->jid, 0 };
const TCHAR *msgText = NULL;
@@ -1141,14 +1135,12 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
}
else nick = NULL;
- GCEVENT gce = { sizeof(GCEVENT) };
- gce.pDest = &gcd;
+ GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszUID = resource;
gce.ptszNick = nick;
gce.time = msgTime;
gce.ptszText = EscapeChatTags((TCHAR*)msgText);
gce.bIsMe = nick == NULL ? FALSE : (lstrcmp(resource, item->nick) == 0);
- gce.dwFlags = GC_TCHAR;
if (!isHistory)
gce.dwFlags |= GCEF_ADDTOLOG;
@@ -1166,7 +1158,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
}
- mir_free((void*)gce.pszText); // Since we processed msgText and created a new string
+ mir_free((void*)gce.ptszText); // Since we processed msgText and created a new string
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index 93469fe0a4..27ec3fcfbd 100644
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -445,11 +445,9 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo)
else db_unset(hContact, "CList", "MyHandle");
if ( isChatRoom(hContact)) {
- GCSESSION gcw = {0};
- gcw.cbSize = sizeof(GCSESSION);
+ GCSESSION gcw = { sizeof(gcw) };
gcw.iType = GCW_CHATROOM;
gcw.pszModule = m_szModuleName;
- gcw.dwFlags = GC_TCHAR;
gcw.ptszID = jid;
gcw.ptszName = NEWTSTR_ALLOCA(jid);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 174ebdb262..276777df2e 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -218,13 +218,11 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM)
m_pInfoFrame = new CJabberInfoFrame(this);
- GCREGISTER gcr = {0};
- gcr.cbSize = sizeof(GCREGISTER);
- gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR | GC_TCHAR;
- gcr.iMaxText = 0;
+ GCREGISTER gcr = { sizeof(gcr) };
+ gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR;
gcr.nColors = 16;
gcr.pColors = &crCols[0];
- gcr.ptszModuleDispName = m_tszUserName;
+ gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
CallServiceSync(MS_GC_REGISTER, NULL, (LPARAM)&gcr);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index 05217363e7..1d344ad783 100644
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -125,9 +125,7 @@ static VOID CALLBACK JabberOfflineChatWindows(void* param)
{
CJabberProto *ppro = (CJabberProto*)param;
GCDEST gcd = { ppro->m_szModuleName, NULL, GC_EVENT_CONTROL };
- GCEVENT gce = { 0 };
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
+ GCEVENT gce = { sizeof(gce), &gcd };
CallService(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
}