diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-08 19:39:48 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-08 19:39:48 +0000 |
commit | 05cd7934d4bdb097e112efdda356946868f3f5d6 (patch) | |
tree | 0fa678b494af8b994abf7319298a1af06fc9218a /protocols/MSN/src | |
parent | 50a2ba5bf6827b8f010288021c1797c11bd1531e (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/MSN/src')
-rw-r--r-- | protocols/MSN/src/msn_chat.cpp | 43 | ||||
-rw-r--r-- | protocols/MSN/src/msn_commands.cpp | 44 | ||||
-rw-r--r-- | protocols/MSN/src/msn_proto.cpp | 4 |
3 files changed, 29 insertions, 62 deletions
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index d7e2bc3f90..d5718bb34e 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -47,21 +47,15 @@ int CMsnProto::MSN_ChatInit(ThreadData *info) mir_sntprintf(szName, SIZEOF(szName), _T("%s %s%s"),
m_tszUserName, TranslateT("Chat #"), info->mChatID);
- GCSESSION gcw = {0};
- gcw.cbSize = sizeof(GCSESSION);
- gcw.dwFlags = GC_TCHAR;
+ GCSESSION gcw = { sizeof(gcw) };
gcw.iType = GCW_CHATROOM;
gcw.pszModule = m_szModuleName;
gcw.ptszName = szName;
gcw.ptszID = info->mChatID;
CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
- GCDEST gcd = { m_szModuleName, { NULL }, GC_EVENT_ADDGROUP };
- gcd.ptszID = info->mChatID;
- GCEVENT gce = {0};
- gce.cbSize = sizeof(GCEVENT);
- gce.dwFlags = GC_TCHAR;
- gce.pDest = &gcd;
+ GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_ADDGROUP };
+ GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszStatus = TranslateT("Me");
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
@@ -95,13 +89,9 @@ void CMsnProto::MSN_ChatStart(ThreadData* info) MSN_ChatInit(info);
// add all participants onto the list
- GCDEST gcd = { m_szModuleName, { NULL }, GC_EVENT_JOIN };
- gcd.ptszID = info->mChatID;
-
- GCEVENT gce = {0};
- gce.cbSize = sizeof(GCEVENT);
- gce.dwFlags = GC_TCHAR | GCEF_ADDTOLOG;
- gce.pDest = &gcd;
+ GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_JOIN };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszStatus = TranslateT("Others");
gce.time = time(NULL);
gce.bIsMe = FALSE;
@@ -121,12 +111,9 @@ void CMsnProto::MSN_ChatStart(ThreadData* info) void CMsnProto::MSN_KillChatSession(TCHAR* id)
{
- GCDEST gcd = { m_szModuleName, { NULL }, GC_EVENT_CONTROL };
- gcd.ptszID = id;
- GCEVENT gce = {0};
- gce.cbSize = sizeof(GCEVENT);
- gce.dwFlags = GC_TCHAR | GCEF_REMOVECONTACT;
- gce.pDest = &gcd;
+ GCDEST gcd = { m_szModuleName, id, GC_EVENT_CONTROL };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_REMOVECONTACT;
CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
}
@@ -320,7 +307,7 @@ INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
{
- GCHOOK *gch = (GCHOOK*) lParam;
+ GCHOOK *gch = (GCHOOK*)lParam;
if (!gch)
return 1;
@@ -349,13 +336,9 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) DBVARIANT dbv;
int bError = getTString("Nick", &dbv);
- GCDEST gcd = { m_szModuleName, { NULL }, GC_EVENT_MESSAGE };
- gcd.ptszID = gch->pDest->ptszID;
-
- GCEVENT gce = {0};
- gce.cbSize = sizeof(GCEVENT);
- gce.dwFlags = GC_TCHAR | GCEF_ADDTOLOG;
- gce.pDest = &gcd;
+ GCDEST gcd = { m_szModuleName, gch->pDest->ptszID, GC_EVENT_MESSAGE };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = bError ? _T("") : dbv.ptszVal;
gce.ptszUID = mir_a2t(MyOptions.szEmail);
gce.time = time(NULL);
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index aa8fe39c21..63836bea6a 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -470,13 +470,9 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para if (info->mChatID[0])
{
- GCDEST gcd = { m_szModuleName, { NULL }, GC_EVENT_MESSAGE };
- gcd.ptszID = info->mChatID;
-
- GCEVENT gce = {0};
- gce.cbSize = sizeof(GCEVENT);
- gce.dwFlags = GC_TCHAR | GCEF_ADDTOLOG;
- gce.pDest = &gcd;
+ GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_MESSAGE };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszUID = mir_a2t(email);
gce.ptszNick = GetContactNameT(hContact);
gce.time = time(NULL);
@@ -487,7 +483,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para mir_free(p);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
- mir_free((void*)gce.pszText);
+ mir_free((void*)gce.ptszText);
mir_free((void*)gce.ptszUID);
}
else if (hContact)
@@ -1181,19 +1177,15 @@ LBL_InvalidCommand: // modified for chat
if (msnHaveChatDll)
{
- GCDEST gcd = { m_szModuleName, { NULL }, GC_EVENT_QUIT };
- gcd.ptszID = info->mChatID;
-
- GCEVENT gce = {0};
- gce.cbSize = sizeof(GCEVENT);
- gce.dwFlags = GC_TCHAR | GCEF_ADDTOLOG;
- gce.pDest = &gcd;
+ GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_QUIT };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = GetContactNameT(hContact);
gce.ptszUID = mir_a2t(data.userEmail);
gce.time = time(NULL);
gce.bIsMe = FALSE;
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
- mir_free((void*)gce.pszUID);
+ mir_free((void*)gce.ptszUID);
}
int personleft = info->contactLeft(data.userEmail);
@@ -1207,13 +1199,9 @@ LBL_InvalidCommand: {
if (!strcmp(data.isIdle, "1"))
{
- GCDEST gcd = { m_szModuleName, { NULL }, GC_EVENT_INFORMATION };
- gcd.ptszID = info->mChatID;
-
- GCEVENT gce = {0};
- gce.cbSize = sizeof(GCEVENT);
- gce.dwFlags = GC_TCHAR | GCEF_ADDTOLOG;
- gce.pDest = &gcd;
+ GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_INFORMATION };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.bIsMe = FALSE;
gce.time = time(NULL);
gce.ptszText = TranslateT("This conversation has been inactive, participants will be removed.");
@@ -1565,13 +1553,9 @@ remove: {
if (chatCreated)
{
- GCDEST gcd = { m_szModuleName, { NULL }, GC_EVENT_JOIN };
- gcd.ptszID = info->mChatID;
-
- GCEVENT gce = {0};
- gce.cbSize = sizeof(GCEVENT);
- gce.dwFlags = GC_TCHAR | GCEF_ADDTOLOG;
- gce.pDest = &gcd;
+ GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_JOIN };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = GetContactNameT(hContact);
gce.ptszUID = mir_a2t(data.userEmail);
gce.ptszStatus = TranslateT("Others");
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 0c492a34ae..63191ab22f 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -184,11 +184,11 @@ int CMsnProto::OnModulesLoaded(WPARAM, LPARAM) if (msnHaveChatDll) {
GCREGISTER gcr = {0};
gcr.cbSize = sizeof(GCREGISTER);
- gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR | GC_TCHAR;
+ gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR;
gcr.iMaxText = 0;
gcr.nColors = 16;
gcr.pColors = (COLORREF*)crCols;
- gcr.ptszModuleDispName = m_tszUserName;
+ gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr);
|