diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/AimOscar/src/chat.cpp | 8 | ||||
-rw-r--r-- | protocols/FacebookRM/src/chat.cpp | 18 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/groupchat.cpp | 27 | ||||
-rw-r--r-- | protocols/IRCG/src/commandmonitor.cpp | 10 | ||||
-rw-r--r-- | protocols/IRCG/src/ircproto.cpp | 7 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_chat.cpp | 8 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_iqid.cpp | 14 | ||||
-rw-r--r-- | protocols/MRA/src/MraChat.cpp | 46 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_functions.cpp | 9 | ||||
-rw-r--r-- | protocols/MSN/src/msn_chat.cpp | 11 | ||||
-rw-r--r-- | protocols/MinecraftDynmap/src/chat.cpp | 7 | ||||
-rw-r--r-- | protocols/Omegle/src/chat.cpp | 7 | ||||
-rw-r--r-- | protocols/Sametime/src/conference.cpp | 7 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 7 | ||||
-rw-r--r-- | protocols/Twitter/src/chat.cpp | 7 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_chats.cpp | 8 | ||||
-rw-r--r-- | protocols/WhatsApp/src/chat.cpp | 7 | ||||
-rw-r--r-- | protocols/Yahoo/src/chat.cpp | 8 |
18 files changed, 49 insertions, 167 deletions
diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp index be48243644..bd7a371619 100644 --- a/protocols/AimOscar/src/chat.cpp +++ b/protocols/AimOscar/src/chat.cpp @@ -37,13 +37,7 @@ void CAimProto::chat_register(void) void CAimProto::chat_start(const char *id, unsigned short exchange)
{
wchar_t *idt = mir_a2u(id);
-
- GCSESSION gcw = {};
- gcw.iType = GCW_CHATROOM;
- gcw.pszModule = m_szModuleName;
- gcw.ptszName = idt;
- gcw.ptszID = idt;
- Chat_NewSession(&gcw);
+ Chat_NewSession(GCW_CHATROOM, m_szModuleName, idt, idt);
Chat_AddGroup(m_szModuleName, idt, TranslateT("Me"));
Chat_AddGroup(m_szModuleName, idt, TranslateT("Others"));
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp index 5f46bfd42a..2d288ac103 100644 --- a/protocols/FacebookRM/src/chat.cpp +++ b/protocols/FacebookRM/src/chat.cpp @@ -245,12 +245,7 @@ void FacebookProto::AddChat(const char *id, const wchar_t *tname) ptrW tid(mir_a2u(id)); // Create the group chat session - GCSESSION gcw = {}; - gcw.iType = GCW_PRIVMESS; - gcw.ptszID = tid; - gcw.pszModule = m_szModuleName; - gcw.ptszName = tname; - Chat_NewSession(&gcw); + Chat_NewSession(GCW_PRIVMESS, m_szModuleName, tid, tname); // Send setting events Chat_AddGroup(m_szModuleName, tid, TranslateT("Myself")); @@ -411,16 +406,11 @@ void FacebookProto::PrepareNotificationsChatRoom() { mir_snwprintf(nameT, L"%s: %s", m_tszUserName, TranslateT("Notifications")); // Create the group chat session - GCSESSION gcw = {}; - gcw.iType = GCW_PRIVMESS; - gcw.ptszID = _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM); - gcw.pszModule = m_szModuleName; - gcw.ptszName = nameT; - Chat_NewSession(&gcw); + Chat_NewSession(GCW_PRIVMESS, m_szModuleName, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM), nameT); // Send setting events - Chat_Control(m_szModuleName, gcw.ptszID, WINDOW_HIDDEN); - Chat_Control(m_szModuleName, gcw.ptszID, SESSION_ONLINE); + Chat_Control(m_szModuleName, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM), WINDOW_HIDDEN); + Chat_Control(m_szModuleName, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM), SESSION_ONLINE); } } diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 8e36822a05..7137639aed 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -308,27 +308,10 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou mir_snwprintf(status, TranslateT("This is my own conference."));
}
- GCSESSION gcwindow = {};
- gcwindow.iType = GCW_CHATROOM;
- gcwindow.pszModule = m_szModuleName;
- gcwindow.ptszName = sender ? senderName : TranslateT("Conference");
- gcwindow.ptszID = chat->id;
- gcwindow.pItemData = chat;
- gcwindow.ptszStatusbarText = status;
-
- // Here we put nice new hash sign
- wchar_t *name = (wchar_t*)calloc(mir_wstrlen(gcwindow.ptszName) + 2, sizeof(wchar_t));
- *name = '#'; mir_wstrcpy(name + 1, gcwindow.ptszName);
- gcwindow.ptszName = name;
-
// Create new room
- if (Chat_NewSession( &gcwindow)) {
- debugLogW(L"gc_getchat(): Cannot create new chat window %s.", chat->id);
- free(name);
- free(chat);
- return NULL;
- }
- free(name);
+ CMStringW wszTitle(L"#"); wszTitle.Append(sender ? senderName : TranslateT("Conference"));
+ Chat_NewSession(GCW_CHATROOM, m_szModuleName, chat->id, wszTitle, chat);
+ Chat_SetStatusbarText(m_szModuleName, chat->id, status);
// Add normal group
Chat_AddGroup(m_szModuleName, chat->id, TranslateT("Participants"));
@@ -367,8 +350,8 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou for(i = 0; i < chat->recipients_count; i++) {
MCONTACT hContact = getcontact(chat->recipients[i], 1, 0, NULL);
UIN2IDT(chat->recipients[i], id);
- if (hContact && (name = pcli->pfnGetContactDisplayName(hContact, 0)) != NULL)
- gce.ptszNick = name;
+ if (hContact)
+ gce.ptszNick = pcli->pfnGetContactDisplayName(hContact, 0);
else
gce.ptszNick = TranslateT("'Unknown'");
gce.bIsMe = 0;
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 72788f322b..f47067ee3d 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -1266,14 +1266,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) CMStringW sID = MakeWndID(sChanName);
BYTE btOwnMode = 0;
- GCSESSION gcw = {};
- gcw.iType = GCW_CHATROOM;
- gcw.ptszID = sID;
- gcw.pszModule = m_szModuleName;
- gcw.ptszName = sChanName;
- if (!Chat_NewSession(&gcw)) {
- DBVARIANT dbv;
-
+ if (!Chat_NewSession(GCW_CHATROOM, m_szModuleName, sID, sChanName)) {
PostIrcMessage(L"/MODE %s", sChanName);
// register the statuses
@@ -1359,6 +1352,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) }
}
+ DBVARIANT dbv;
if (!getWString("JTemp", &dbv)) {
CMStringW command = L"a";
CMStringW save = L"";
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index f80950ae5f..b0faf81af6 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -204,12 +204,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) HookProtoEvent(ME_GC_EVENT, &CIrcProto::GCEventHook);
HookProtoEvent(ME_GC_BUILDMENU, &CIrcProto::GCMenuHook);
- GCSESSION gcw = {};
- gcw.iType = GCW_SERVER;
- gcw.ptszID = SERVERWINDOW;
- gcw.pszModule = m_szModuleName;
- gcw.ptszName = NEWWSTR_ALLOCA((wchar_t*)_A2T(m_network));
- Chat_NewSession(&gcw);
+ Chat_NewSession(GCW_SERVER, m_szModuleName, SERVERWINDOW, _A2T(m_network));
if (m_useServer && !m_hideServerWindow)
Chat_Control(m_szModuleName, SERVERWINDOW, WINDOW_VISIBLE);
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 0f405da76c..5838b6e2e1 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -127,13 +127,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) sttRoleItems[i].translate();
ptrW szNick(JabberNickFromJID(item->jid));
-
- GCSESSION gcw = {};
- gcw.iType = GCW_CHATROOM;
- gcw.pszModule = m_szModuleName;
- gcw.ptszName = szNick;
- gcw.ptszID = item->jid;
- Chat_NewSession(&gcw);
+ Chat_NewSession(GCW_CHATROOM, m_szModuleName, item->jid, szNick);
GCSessionInfoBase *si = pci->SM_FindSession(item->jid, m_szModuleName);
if (si != NULL) {
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index bbf2407010..b0be15fb1d 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -440,17 +440,9 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) else db_unset(hContact, "CList", "MyHandle");
if (isChatRoom(hContact)) {
- GCSESSION gcw = {};
- gcw.iType = GCW_CHATROOM;
- gcw.pszModule = m_szModuleName;
- gcw.ptszID = jid;
- gcw.ptszName = NEWWSTR_ALLOCA(jid);
-
- wchar_t *p = (wchar_t*)wcschr(gcw.ptszName, '@');
- if (p)
- *p = 0;
-
- Chat_NewSession(&gcw);
+ wchar_t *wszTitle = NEWWSTR_ALLOCA(jid);
+ if (wchar_t *p = wcschr(wszTitle, '@')) *p = 0;
+ Chat_NewSession(GCW_CHATROOM, m_szModuleName, jid, wszTitle);
db_unset(hContact, "CList", "Hidden");
chatRooms.insert((HANDLE)hContact);
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)) {
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index a2a62abeea..6c1a63978f 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -54,16 +54,11 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p wchar_t szName[512];
InterlockedIncrement(&m_chatID);
- if (*pszTopic) wcsncpy(szName, _A2T(pszTopic), _countof(szName));
+ if (*pszTopic)
+ wcsncpy(szName, _A2T(pszTopic), _countof(szName));
else mir_snwprintf(szName, L"%s %s%d",
m_tszUserName, TranslateT("Chat #"), m_chatID);
-
- GCSESSION gcw = {};
- gcw.iType = GCW_CHATROOM;
- gcw.pszModule = m_szModuleName;
- gcw.ptszName = szName;
- gcw.ptszID = info->mChatID;
- Chat_NewSession(&gcw);
+ Chat_NewSession(GCW_CHATROOM, m_szModuleName, info->mChatID, szName);
for (int j = 0; j < _countof(m_ptszRoles); j++)
Chat_AddGroup(m_szModuleName, info->mChatID, m_ptszRoles[j]);
diff --git a/protocols/MinecraftDynmap/src/chat.cpp b/protocols/MinecraftDynmap/src/chat.cpp index 2261c4e867..2990d65933 100644 --- a/protocols/MinecraftDynmap/src/chat.cpp +++ b/protocols/MinecraftDynmap/src/chat.cpp @@ -126,12 +126,7 @@ INT_PTR MinecraftDynmapProto::OnJoinChat(WPARAM,LPARAM suppress) ptrW tszTitle(mir_a2u_cp(m_title.c_str(), CP_UTF8)); // Create the group chat session - GCSESSION gcw = {}; - gcw.iType = GCW_PRIVMESS; - gcw.ptszID = m_tszUserName; - gcw.ptszName = tszTitle; - gcw.pszModule = m_szModuleName; - Chat_NewSession(&gcw); + Chat_NewSession(GCW_PRIVMESS, m_szModuleName, m_tszUserName, tszTitle); if (m_iStatus == ID_STATUS_OFFLINE) return 0; diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp index bab1fee7e9..bbfce622b8 100644 --- a/protocols/Omegle/src/chat.cpp +++ b/protocols/Omegle/src/chat.cpp @@ -267,12 +267,7 @@ void OmegleProto::DeleteChatContact(const wchar_t *name) INT_PTR OmegleProto::OnJoinChat(WPARAM, LPARAM suppress)
{
// Create the group chat session
- GCSESSION gcw = {};
- gcw.iType = GCW_PRIVMESS;
- gcw.ptszID = m_tszUserName;
- gcw.ptszName = m_tszUserName;
- gcw.pszModule = m_szModuleName;
- Chat_NewSession(&gcw);
+ Chat_NewSession(GCW_PRIVMESS, m_szModuleName, m_tszUserName, m_tszUserName);
if (m_iStatus == ID_STATUS_OFFLINE)
return 0;
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp index 9c2fac9b59..04af2e7372 100644 --- a/protocols/Sametime/src/conference.cpp +++ b/protocols/Sametime/src/conference.cpp @@ -112,12 +112,7 @@ void mwServiceConf_conf_opened(mwConference* conf, GList* members) ptrW tszConfTitle(mir_utf8decodeW(mwConference_getTitle(conf)));
// create new chat session
- GCSESSION gcs = {};
- gcs.iType = GCW_CHATROOM;
- gcs.pszModule = proto->m_szModuleName;
- gcs.ptszID = tszConfId;
- gcs.ptszName = tszConfTitle;
- Chat_NewSession(&gcs);
+ Chat_NewSession(GCW_CHATROOM, proto->m_szModuleName, tszConfId, tszConfTitle);
// add a group
Chat_AddGroup(proto->m_szModuleName, tszConfId, TranslateT("Normal"));
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index bcdbdc1db1..d86c029374 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -59,12 +59,7 @@ MCONTACT CSkypeProto::FindChatRoom(const char *chatname) void CSkypeProto::StartChatRoom(const wchar_t *tid, const wchar_t *tname)
{
// Create the group chat session
- GCSESSION gcw = {};
- gcw.iType = GCW_CHATROOM;
- gcw.ptszID = tid;
- gcw.pszModule = m_szModuleName;
- gcw.ptszName = tname;
- Chat_NewSession(&gcw);
+ Chat_NewSession(GCW_CHATROOM, m_szModuleName, tid, tname);
// Create a user statuses
Chat_AddGroup(m_szModuleName, tid, TranslateT("Admin"));
diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp index 59e41b9d0c..ed7c69e3c3 100644 --- a/protocols/Twitter/src/chat.cpp +++ b/protocols/Twitter/src/chat.cpp @@ -117,12 +117,7 @@ void TwitterProto::DeleteChatContact(const char *name) INT_PTR TwitterProto::OnJoinChat(WPARAM, LPARAM suppress)
{
// ***** Create the group chat session
- GCSESSION gcw = {};
- gcw.iType = GCW_CHATROOM;
- gcw.pszModule = m_szModuleName;
- gcw.ptszName = m_tszUserName;
- gcw.ptszID = m_tszUserName;
- Chat_NewSession(&gcw);
+ Chat_NewSession(GCW_CHATROOM, m_szModuleName, m_tszUserName, m_tszUserName);
if (m_iStatus != ID_STATUS_ONLINE)
return 0;
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index a8b95dbc1e..2d3fdeb13c 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -59,13 +59,7 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) CMStringW sid;
sid.Format(L"%S_%d", m_szModuleName, id);
c->m_wszId = mir_wstrdup(sid);
-
- GCSESSION gcw = {};
- gcw.iType = GCW_CHATROOM;
- gcw.pszModule = m_szModuleName;
- gcw.ptszName = wszTitle;
- gcw.ptszID = sid;
- Chat_NewSession(&gcw);
+ Chat_NewSession(GCW_CHATROOM, m_szModuleName, sid, wszTitle);
GC_INFO gci = {};
gci.pszModule = m_szModuleName;
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index 07de0eca79..a87be6a24f 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -302,12 +302,7 @@ WAChatInfo* WhatsAppProto::InitChat(const std::string &jid, const std::string &n setString(hOldContact, "ChatRoomID", jid.c_str());
}
- GCSESSION gcw = {};
- gcw.iType = GCW_CHATROOM;
- gcw.pszModule = m_szModuleName;
- gcw.ptszName = ptszNick;
- gcw.ptszID = ptszJid;
- Chat_NewSession(&gcw);
+ Chat_NewSession(GCW_CHATROOM, m_szModuleName, ptszJid, ptszNick);
pInfo->hContact = (hOldContact != NULL) ? hOldContact : ContactIDToHContact(jid);
diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp index b11bcaba0c..afb1fafd94 100644 --- a/protocols/Yahoo/src/chat.cpp +++ b/protocols/Yahoo/src/chat.cpp @@ -151,13 +151,7 @@ void CYahooProto::ChatRegister(void) void CYahooProto::ChatStart(const char* room)
{
ptrW idt(mir_a2u(room));
-
- GCSESSION gcw = {};
- gcw.iType = GCW_CHATROOM;
- gcw.pszModule = m_szModuleName;
- gcw.ptszName = idt;
- gcw.ptszID = idt;
- Chat_NewSession(&gcw);
+ Chat_NewSession(GCW_CHATROOM, m_szModuleName, idt, idt);
Chat_AddGroup(m_szModuleName, idt, TranslateT("Me"));
Chat_AddGroup(m_szModuleName, idt, TranslateT("Others"));
|