diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/AimOscar/src/chat.cpp | 10 | ||||
-rw-r--r-- | protocols/FacebookRM/src/chat.cpp | 16 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/groupchat.cpp | 25 | ||||
-rw-r--r-- | protocols/IRCG/src/commandmonitor.cpp | 26 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_chat.cpp | 8 | ||||
-rw-r--r-- | protocols/MRA/src/MraChat.cpp | 8 | ||||
-rw-r--r-- | protocols/MSN/src/msn_chat.cpp | 10 | ||||
-rw-r--r-- | protocols/MinecraftDynmap/src/chat.cpp | 10 | ||||
-rw-r--r-- | protocols/Omegle/src/chat.cpp | 10 | ||||
-rw-r--r-- | protocols/Sametime/src/conference.cpp | 41 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 14 | ||||
-rw-r--r-- | protocols/Twitter/src/chat.cpp | 5 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_chats.cpp | 9 | ||||
-rw-r--r-- | protocols/WhatsApp/src/chat.cpp | 8 | ||||
-rw-r--r-- | protocols/Yahoo/src/chat.cpp | 10 |
15 files changed, 57 insertions, 153 deletions
diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp index c88354a8db..be48243644 100644 --- a/protocols/AimOscar/src/chat.cpp +++ b/protocols/AimOscar/src/chat.cpp @@ -45,14 +45,8 @@ void CAimProto::chat_start(const char *id, unsigned short exchange) gcw.ptszID = idt;
Chat_NewSession(&gcw);
- GCDEST gcd = { m_szModuleName, idt, GC_EVENT_ADDGROUP };
- GCEVENT gce = { &gcd };
- gce.ptszStatus = TranslateT("Me");
- Chat_Event(&gce);
-
- gcd.iType = GC_EVENT_ADDGROUP;
- gce.ptszStatus = TranslateT("Others");
- Chat_Event(&gce);
+ Chat_AddGroup(m_szModuleName, idt, TranslateT("Me"));
+ Chat_AddGroup(m_szModuleName, idt, TranslateT("Others"));
Chat_Control(m_szModuleName, idt, SESSION_INITDONE);
Chat_Control(m_szModuleName, idt, SESSION_ONLINE);
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp index ce9e7a4512..5f46bfd42a 100644 --- a/protocols/FacebookRM/src/chat.cpp +++ b/protocols/FacebookRM/src/chat.cpp @@ -253,18 +253,10 @@ void FacebookProto::AddChat(const char *id, const wchar_t *tname) Chat_NewSession(&gcw); // Send setting events - GCDEST gcd = { m_szModuleName, tid, GC_EVENT_ADDGROUP }; - GCEVENT gce = { &gcd }; - - // Create a user statuses - gce.ptszStatus = TranslateT("Myself"); - Chat_Event(&gce); - gce.ptszStatus = TranslateT("Friend"); - Chat_Event(&gce); - gce.ptszStatus = TranslateT("User"); - Chat_Event(&gce); - gce.ptszStatus = TranslateT("Former"); - Chat_Event(&gce); + Chat_AddGroup(m_szModuleName, tid, TranslateT("Myself")); + Chat_AddGroup(m_szModuleName, tid, TranslateT("Friend")); + Chat_AddGroup(m_szModuleName, tid, TranslateT("User")); + Chat_AddGroup(m_szModuleName, tid, TranslateT("Former")); // Finish initialization bool hideChats = getBool(FACEBOOK_KEY_HIDE_CHATS, DEFAULT_HIDE_CHATS); diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index b26c271602..8e36822a05 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -209,9 +209,6 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou GGGC *chat;
wchar_t id[32];
uin_t uin;
- DBVARIANT dbv;
- GCDEST gcd = { m_szModuleName, 0, GC_EVENT_ADDGROUP };
- GCEVENT gce = { &gcd };
debugLogA("gc_getchat(): Count %d.", recipients_count);
if (!recipients) return NULL;
@@ -333,30 +330,24 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou }
free(name);
- gcd.ptszID = chat->id;
+ // Add normal group
+ Chat_AddGroup(m_szModuleName, chat->id, TranslateT("Participants"));
+
+ GCDEST gcd = { m_szModuleName, chat->id, GC_EVENT_JOIN };
+ GCEVENT gce = { &gcd };
gce.ptszUID = id;
gce.dwFlags = GCEF_ADDTOLOG;
- gce.time = 0;
-
- // Add normal group
- gce.ptszStatus = TranslateT("Participants");
- Chat_Event(&gce);
- gcd.iType = GC_EVENT_JOIN;
// Add myself
if (uin = getDword(GG_KEY_UIN, 0))
{
UIN2IDT(uin, id);
- wchar_t* nickT;
- if (!getWString(GG_KEY_NICK, &dbv)) {
- nickT = mir_wstrdup(dbv.ptszVal);
- db_free(&dbv);
- } else {
+ ptrW nickT(getWStringA(GG_KEY_NICK));
+ if (nickT == NULL)
nickT = mir_wstrdup(TranslateT("Me"));
- }
- gce.ptszNick = nickT;
+ gce.ptszNick = nickT;
gce.bIsMe = 1;
Chat_Event(&gce);
mir_free(nickT);
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 9adb247adb..72788f322b 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -1277,20 +1277,12 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) PostIrcMessage(L"/MODE %s", sChanName);
// register the statuses
- GCDEST gcd = { m_szModuleName, sID, GC_EVENT_ADDGROUP };
- GCEVENT gce = { &gcd };
- gce.ptszStatus = L"Owner";
- Chat_Event(&gce);
- gce.ptszStatus = L"Admin";
- Chat_Event(&gce);
- gce.ptszStatus = L"Op";
- Chat_Event(&gce);
- gce.ptszStatus = L"Halfop";
- Chat_Event(&gce);
- gce.ptszStatus = L"Voice";
- Chat_Event(&gce);
- gce.ptszStatus = L"Normal";
- Chat_Event(&gce);
+ Chat_AddGroup(m_szModuleName, sID, L"Owner");
+ Chat_AddGroup(m_szModuleName, sID, L"Admin");
+ Chat_AddGroup(m_szModuleName, sID, L"Op");
+ Chat_AddGroup(m_szModuleName, sID, L"Halfop");
+ Chat_AddGroup(m_szModuleName, sID, L"Voice");
+ Chat_AddGroup(m_szModuleName, sID, L"Normal");
{
int k = 0;
CMStringW sTemp = GetWord(sNamesList, k);
@@ -1305,7 +1297,8 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) while (PrefixToStatus(sTemp[0]) != L"Normal")
sTemp.Delete(0, 1);
- gcd.iType = GC_EVENT_JOIN;
+ GCDEST gcd = { m_szModuleName, sID, GC_EVENT_JOIN };
+ GCEVENT gce = { &gcd };
gce.ptszUID = sTemp;
gce.ptszNick = sTemp;
gce.ptszStatus = sStat;
@@ -2336,8 +2329,7 @@ bool CIrcProto::DoOnConnect(const CIrcMessage*) }
}
- DoEvent(GC_EVENT_ADDGROUP, SERVERWINDOW, NULL, NULL, L"Normal", NULL, NULL, FALSE, TRUE);
-
+ Chat_AddGroup(m_szModuleName, SERVERWINDOW, L"Normal");
Chat_Control(m_szModuleName, SERVERWINDOW, SESSION_ONLINE);
CallFunctionAsync(sttMainThrdOnConnect, this);
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 61dff34c3d..0f405da76c 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -167,12 +167,8 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) item->bChatActive = true;
- GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_ADDGROUP };
- GCEVENT gce = { &gcd };
- for (int i = _countof(sttStatuses) - 1; i >= 0; i--) {
- gce.ptszStatus = TranslateW(sttStatuses[i]);
- Chat_Event(&gce);
- }
+ for (int i = _countof(sttStatuses) - 1; i >= 0; i--)
+ Chat_AddGroup(m_szModuleName, item->jid, TranslateW(sttStatuses[i]));
Chat_Control(m_szModuleName, item->jid, (item->bAutoJoin && m_options.AutoJoinHidden) ? WINDOW_HIDDEN : SESSION_INITDONE);
Chat_Control(m_szModuleName, item->jid, SESSION_ONLINE);
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp index e09a76c374..046093d84c 100644 --- a/protocols/MRA/src/MraChat.cpp +++ b/protocols/MRA/src/MraChat.cpp @@ -39,12 +39,8 @@ INT_PTR CMraProto::MraChatSessionNew(MCONTACT hContact) gcw.ptszStatusbarText = L"status bar";
gcw.pItemData = (void*)hContact;
if (!Chat_NewSession(&gcw)) {
- GCDEST gcd = { m_szModuleName, wszEMail.c_str(), GC_EVENT_ADDGROUP };
- GCEVENT gce = { &gcd };
- for (int i = 0; i < _countof(lpwszStatuses); i++) {
- gce.ptszStatus = TranslateW(lpwszStatuses[i]);
- Chat_Event(&gce);
- }
+ 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);
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 86a0967aaf..a2a62abeea 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -65,18 +65,12 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p gcw.ptszID = info->mChatID;
Chat_NewSession(&gcw);
- GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_ADDGROUP };
- GCEVENT gce = { &gcd };
- for (int j = 0; j < _countof(m_ptszRoles); j++) {
- gce.ptszStatus = m_ptszRoles[j];
- Chat_Event(&gce);
- }
+ for (int j = 0; j < _countof(m_ptszRoles); j++)
+ Chat_AddGroup(m_szModuleName, info->mChatID, m_ptszRoles[j]);
Chat_Control(m_szModuleName, info->mChatID, SESSION_INITDONE);
Chat_Control(m_szModuleName, info->mChatID, SESSION_ONLINE);
Chat_Control(m_szModuleName, info->mChatID, WINDOW_VISIBLE);
-
- mir_free((wchar_t*)gce.ptszUID);
return 0;
}
diff --git a/protocols/MinecraftDynmap/src/chat.cpp b/protocols/MinecraftDynmap/src/chat.cpp index a2aa6f0e6b..2261c4e867 100644 --- a/protocols/MinecraftDynmap/src/chat.cpp +++ b/protocols/MinecraftDynmap/src/chat.cpp @@ -137,14 +137,8 @@ INT_PTR MinecraftDynmapProto::OnJoinChat(WPARAM,LPARAM suppress) return 0; // Create a group - GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_ADDGROUP }; - GCEVENT gce = { &gcd }; - - gce.ptszStatus = L"Admin"; - Chat_Event(&gce); - - gce.ptszStatus = L"Normal"; - Chat_Event(&gce); + Chat_AddGroup(m_szModuleName, m_tszUserName, L"Admin"); + Chat_AddGroup(m_szModuleName, m_tszUserName, L"Normal"); // Note: Initialization will finish up in SetChatStatus, called separately if (!suppress) diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp index fb6bed05a2..bab1fee7e9 100644 --- a/protocols/Omegle/src/chat.cpp +++ b/protocols/Omegle/src/chat.cpp @@ -278,14 +278,8 @@ INT_PTR OmegleProto::OnJoinChat(WPARAM, LPARAM suppress) return 0;
// Create a group
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_ADDGROUP };
- GCEVENT gce = { &gcd };
-
- gce.ptszStatus = L"Admin";
- Chat_Event(&gce);
-
- gce.ptszStatus = L"Normal";
- Chat_Event(&gce);
+ Chat_AddGroup(m_szModuleName, m_tszUserName, L"Admin");
+ Chat_AddGroup(m_szModuleName, m_tszUserName, L"Normal");
SetTopic();
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp index 66444363b8..9c2fac9b59 100644 --- a/protocols/Sametime/src/conference.cpp +++ b/protocols/Sametime/src/conference.cpp @@ -109,47 +109,34 @@ void mwServiceConf_conf_opened(mwConference* conf, GList* members) proto->debugLogW(L"mwServiceConf_conf_opened() start");
ptrW tszConfId(mir_utf8decodeW(mwConference_getName(conf)));
+ ptrW tszConfTitle(mir_utf8decodeW(mwConference_getTitle(conf)));
// create new chat session
- {
- ptrW tszConfTitle(mir_utf8decodeW(mwConference_getTitle(conf)));
-
- GCSESSION gcs = {};
- gcs.iType = GCW_CHATROOM;
- gcs.pszModule = proto->m_szModuleName;
- gcs.ptszID = tszConfId;
- gcs.ptszName = tszConfTitle;
- Chat_NewSession(&gcs);
- }
-
- //add a group
- GCDEST gcd = { proto->m_szModuleName, 0 };
- gcd.iType = GC_EVENT_ADDGROUP;
- gcd.ptszID = tszConfId;
+ GCSESSION gcs = {};
+ gcs.iType = GCW_CHATROOM;
+ gcs.pszModule = proto->m_szModuleName;
+ gcs.ptszID = tszConfId;
+ gcs.ptszName = tszConfTitle;
+ Chat_NewSession(&gcs);
- GCEVENT gce = { &gcd };
- gce.dwFlags = GCEF_ADDTOLOG;
- gce.ptszStatus = TranslateT("Normal");
-
- Chat_Event(&gce);
+ // add a group
+ Chat_AddGroup(proto->m_szModuleName, tszConfId, TranslateT("Normal"));
// add users
- gcd.iType = GC_EVENT_JOIN;
+ GCDEST gcd = { proto->m_szModuleName, tszConfId, GC_EVENT_JOIN };
+ GCEVENT gce = { &gcd };
GList *user = members;
for (;user; user=user->next) {
proto->debugLogW(L"mwServiceConf_conf_opened() add user");
- wchar_t* tszUserName = mir_utf8decodeW(((mwLoginInfo*)user->data)->user_name);
- wchar_t* tszUserId = mir_utf8decodeW(((mwLoginInfo*)user->data)->login_id);
+ ptrW tszUserName(mir_utf8decodeW(((mwLoginInfo*)user->data)->user_name));
+ ptrW tszUserId(mir_utf8decodeW(((mwLoginInfo*)user->data)->login_id));
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tszUserName;
gce.ptszUID = tszUserId;
gce.bIsMe = (strcmp(((mwLoginInfo*)user->data)->login_id, proto->my_login_info->login_id) == 0);
-
Chat_Event( &gce);
-
- mir_free(tszUserName);
- mir_free(tszUserId);
}
// finalize setup (show window)
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 782b1501a3..bcdbdc1db1 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -66,20 +66,12 @@ void CSkypeProto::StartChatRoom(const wchar_t *tid, const wchar_t *tname) gcw.ptszName = tname;
Chat_NewSession(&gcw);
- // Send setting events
- GCDEST gcd = { m_szModuleName, tid, GC_EVENT_ADDGROUP };
- GCEVENT gce = { &gcd };
-
// Create a user statuses
- gce.ptszStatus = TranslateT("Admin");
- Chat_Event(&gce);
- gce.ptszStatus = TranslateT("User");
- Chat_Event(&gce);
+ Chat_AddGroup(m_szModuleName, tid, TranslateT("Admin"));
+ Chat_AddGroup(m_szModuleName, tid, TranslateT("User"));
// Finish initialization
- bool hideChats = getBool("HideChats", 1);
-
- Chat_Control(m_szModuleName, tid, (hideChats ? WINDOW_HIDDEN : SESSION_INITDONE));
+ Chat_Control(m_szModuleName, tid, (getBool("HideChats", 1) ? WINDOW_HIDDEN : SESSION_INITDONE));
Chat_Control(m_szModuleName, tid, SESSION_ONLINE);
}
diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp index fc4274835a..59e41b9d0c 100644 --- a/protocols/Twitter/src/chat.cpp +++ b/protocols/Twitter/src/chat.cpp @@ -128,10 +128,7 @@ INT_PTR TwitterProto::OnJoinChat(WPARAM, LPARAM suppress) return 0;
// ***** Create a group
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_ADDGROUP };
- GCEVENT gce = { &gcd };
- gce.ptszStatus = L"Normal";
- Chat_Event(&gce);
+ Chat_AddGroup(m_szModuleName, m_tszUserName, TranslateT("Normal"));
// ***** Hook events
HookProtoEvent(ME_GC_EVENT, &TwitterProto::OnChatOutgoing);
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index f09904cba2..a8b95dbc1e 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -77,12 +77,8 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) setWString(gci.hContact, "Nick", wszTitle);
m_chats.insert(c);
- GCDEST gcd = { m_szModuleName, sid, GC_EVENT_ADDGROUP };
- GCEVENT gce = { &gcd };
- for (int i = _countof(sttStatuses)-1; i >= 0; i--) {
- gce.ptszStatus = TranslateW(sttStatuses[i]);
- Chat_Event(&gce);
- }
+ for (int i = _countof(sttStatuses)-1; i >= 0; i--)
+ Chat_AddGroup(m_szModuleName, sid, TranslateW(sttStatuses[i]));
setDword(gci.hContact, "vk_chat_id", id);
@@ -97,7 +93,6 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) return NULL;
}
- gce.ptszStatus = 0;
Chat_Control(m_szModuleName, sid, (m_vkOptions.bHideChats) ? WINDOW_HIDDEN : SESSION_INITDONE);
Chat_Control(m_szModuleName, sid, SESSION_ONLINE);
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index 0987c6ea52..07de0eca79 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -311,12 +311,8 @@ WAChatInfo* WhatsAppProto::InitChat(const std::string &jid, const std::string &n pInfo->hContact = (hOldContact != NULL) ? hOldContact : ContactIDToHContact(jid);
- GCDEST gcd = { m_szModuleName, ptszJid, GC_EVENT_ADDGROUP };
- GCEVENT gce = { &gcd };
- for (int i = _countof(sttStatuses) - 1; i >= 0; i--) {
- gce.ptszStatus = TranslateW(sttStatuses[i]);
- Chat_Event(&gce);
- }
+ for (int i = _countof(sttStatuses) - 1; i >= 0; i--)
+ Chat_AddGroup(m_szModuleName, ptszJid, TranslateW(sttStatuses[i]));
Chat_Control(m_szModuleName, ptszJid, getBool(WHATSAPP_KEY_AUTORUNCHATS, true) ? SESSION_INITDONE : WINDOW_HIDDEN);
Chat_Control(m_szModuleName, ptszJid, SESSION_ONLINE);
diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp index 07955a94ee..b11bcaba0c 100644 --- a/protocols/Yahoo/src/chat.cpp +++ b/protocols/Yahoo/src/chat.cpp @@ -159,14 +159,8 @@ void CYahooProto::ChatStart(const char* room) gcw.ptszID = idt;
Chat_NewSession(&gcw);
- GCDEST gcd = { m_szModuleName, idt, GC_EVENT_ADDGROUP };
- GCEVENT gce = { &gcd };
- gce.ptszStatus = TranslateT("Me");
- Chat_Event(&gce);
-
- gcd.iType = GC_EVENT_ADDGROUP;
- gce.ptszStatus = TranslateT("Others");
- Chat_Event(&gce);
+ Chat_AddGroup(m_szModuleName, idt, TranslateT("Me"));
+ Chat_AddGroup(m_szModuleName, idt, TranslateT("Others"));
Chat_Control(m_szModuleName, idt, SESSION_INITDONE);
Chat_Control(m_szModuleName, idt, SESSION_ONLINE);
|