From dda548686c0f8b0d0bf03315120132013ffa1bb0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 18 Dec 2012 20:22:53 +0000 Subject: useless chat event removed git-svn-id: http://svn.miranda-ng.org/main/trunk@2765 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber_chat.cpp | 115 ++++++++++++++++----------------- protocols/JabberG/src/jabber_proto.cpp | 7 -- protocols/JabberG/src/jabber_proto.h | 3 +- protocols/MSN/src/msn.cpp | 1 - protocols/MSN/src/msn_chat.cpp | 6 +- protocols/MSN/src/msn_proto.cpp | 8 +-- protocols/MSN/src/msn_proto.h | 23 ++++--- 7 files changed, 69 insertions(+), 94 deletions(-) (limited to 'protocols') diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 78542e10f0..df395a6ab2 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -120,10 +120,9 @@ int JabberGcGetStatus(JABBER_RESOURCE_STATUS *r) return JabberGcGetStatus(r->affiliation, r->role); } -int CJabberProto::JabberGcInit(WPARAM wParam, LPARAM) +int CJabberProto::GcInit(JABBER_LIST_ITEM* item) { int i; - JABBER_LIST_ITEM* item = (JABBER_LIST_ITEM*)wParam; GCSESSION gcw = {0}; GCEVENT gce = {0}; @@ -196,7 +195,7 @@ void CJabberProto::GcLogCreate(JABBER_LIST_ITEM* item) if (item->bChatActive) return; - NotifyEventHooks(m_hInitChat, (WPARAM)item, 0); + GcInit(item); } void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, JABBER_RESOURCE_STATUS *user, TJabberGcLogInfoType type) @@ -205,70 +204,64 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, JABBER_RESOURCE_ TCHAR buf[512] = _T(""); - switch (type) - { - case INFO_BAN: - if (m_options.GcLogBans) - { - mir_sntprintf(buf, SIZEOF(buf), TranslateT("User %s in now banned."), user->resourceName); - } - break; - case INFO_STATUS: - if (m_options.GcLogStatuses) - { - if (user->statusMessage) - { - mir_sntprintf(buf, SIZEOF(buf), TranslateT("User %s changed status to %s with message: %s"), - user->resourceName, - CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, user->status, GSMDF_TCHAR), - user->statusMessage); - } else - { - mir_sntprintf(buf, SIZEOF(buf), TranslateT("User %s changed status to %s"), - user->resourceName, - CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, user->status, GSMDF_TCHAR)); - } + switch (type) { + case INFO_BAN: + if (m_options.GcLogBans) + mir_sntprintf(buf, SIZEOF(buf), TranslateT("User %s in now banned."), user->resourceName); + break; + + case INFO_STATUS: + if (m_options.GcLogStatuses) { + if (user->statusMessage) { + mir_sntprintf(buf, SIZEOF(buf), TranslateT("User %s changed status to %s with message: %s"), + user->resourceName, + CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, user->status, GSMDF_TCHAR), + user->statusMessage); } - break; - case INFO_CONFIG: - if (m_options.GcLogConfig) - { - mir_sntprintf(buf, SIZEOF(buf), TranslateT("Room configuration was changed.")); + else { + mir_sntprintf(buf, SIZEOF(buf), TranslateT("User %s changed status to %s"), + user->resourceName, + CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, user->status, GSMDF_TCHAR)); } - break; - case INFO_AFFILIATION: - if (m_options.GcLogAffiliations) - { - TCHAR *name = NULL; - switch (user->affiliation) - { - case AFFILIATION_NONE: name = TranslateT("None"); break; - case AFFILIATION_MEMBER: name = TranslateT("Member"); break; - case AFFILIATION_ADMIN: name = TranslateT("Admin"); break; - case AFFILIATION_OWNER: name = TranslateT("Owner"); break; - case AFFILIATION_OUTCAST: name = TranslateT("Outcast"); break; - } - if (name) mir_sntprintf(buf, SIZEOF(buf), TranslateT("Affiliation of %s was changed to '%s'."), user->resourceName, name); + } + break; + case INFO_CONFIG: + if (m_options.GcLogConfig) + mir_sntprintf(buf, SIZEOF(buf), TranslateT("Room configuration was changed.")); + break; + + case INFO_AFFILIATION: + if (m_options.GcLogAffiliations) { + TCHAR *name = NULL; + switch (user->affiliation) { + case AFFILIATION_NONE: name = TranslateT("None"); break; + case AFFILIATION_MEMBER: name = TranslateT("Member"); break; + case AFFILIATION_ADMIN: name = TranslateT("Admin"); break; + case AFFILIATION_OWNER: name = TranslateT("Owner"); break; + case AFFILIATION_OUTCAST: name = TranslateT("Outcast"); break; } - break; - case INFO_ROLE: - if (m_options.GcLogRoles) - { - TCHAR *name = NULL; - switch (user->role) - { - case ROLE_NONE: name = TranslateT("None"); break; - case ROLE_VISITOR: name = TranslateT("Visitor"); break; - case ROLE_PARTICIPANT: name = TranslateT("Participant"); break; - case ROLE_MODERATOR: name = TranslateT("Moderator"); break; - } - if (name) mir_sntprintf(buf, SIZEOF(buf), TranslateT("Role of %s was changed to '%s'."), user->resourceName, name); + if (name) + mir_sntprintf(buf, SIZEOF(buf), TranslateT("Affiliation of %s was changed to '%s'."), user->resourceName, name); + } + break; + + case INFO_ROLE: + if (m_options.GcLogRoles) { + TCHAR *name = NULL; + switch (user->role) { + case ROLE_NONE: name = TranslateT("None"); break; + case ROLE_VISITOR: name = TranslateT("Visitor"); break; + case ROLE_PARTICIPANT: name = TranslateT("Participant"); break; + case ROLE_MODERATOR: name = TranslateT("Moderator"); break; } - break; + + if (name) + mir_sntprintf(buf, SIZEOF(buf), TranslateT("Role of %s was changed to '%s'."), user->resourceName, name); + } + break; } - if (*buf) - { + if (*buf) { GCDEST gcd = { m_szModuleName, 0, 0 }; gcd.ptszID = item->jid; GCEVENT gce = {0}; diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 4aaa085b52..68d8d7bd8e 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -223,8 +223,6 @@ CJabberProto::~CJabberProto() DestroyHookableEvent(m_hEventNudge); DestroyHookableEvent(m_hEventXStatusIconChanged); DestroyHookableEvent(m_hEventXStatusChanged); - if (m_hInitChat) - DestroyHookableEvent(m_hInitChat); CleanLastResourceMap(); @@ -295,11 +293,6 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) JHookEvent(ME_GC_EVENT, &CJabberProto::JabberGcEventHook); JHookEvent(ME_GC_BUILDMENU, &CJabberProto::JabberGcMenuHook); - - char szEvent[ 200 ]; - mir_snprintf(szEvent, sizeof szEvent, "%s\\ChatInit", m_szModuleName); - m_hInitChat = CreateHookableEvent(szEvent); - JHookEvent(szEvent, &CJabberProto::JabberGcInit); } if (ServiceExists(MS_MSG_ADDICON)) { diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 048e0370de..96fd2665c4 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -226,7 +226,6 @@ struct CJabberProto : public PROTO_INTERFACE, public MZeroedObject int __cdecl JabberGcEventHook(WPARAM, LPARAM); int __cdecl JabberGcMenuHook(WPARAM, LPARAM); - int __cdecl JabberGcInit(WPARAM, LPARAM); // Google Shared Status BOOL m_bGoogleSharedStatus; @@ -441,6 +440,7 @@ struct CJabberProto : public PROTO_INTERFACE, public MZeroedObject //---- jabber_chat.cpp --------------------------------------------------------------- + int GcInit(JABBER_LIST_ITEM* item); void GcLogCreate(JABBER_LIST_ITEM* item); void GcLogUpdateMemberStatus(JABBER_LIST_ITEM* item, const TCHAR *resource, const TCHAR *nick, const TCHAR *jid, int action, HXML reason, int nStatusCode = -1); void GcLogShowInformation(JABBER_LIST_ITEM *item, JABBER_RESOURCE_STATUS *user, TJabberGcLogInfoType type); @@ -985,7 +985,6 @@ private: CRITICAL_SECTION m_csSerial; unsigned int m_nSerial; - HANDLE m_hInitChat; HGENMENU m_hPrivacyMenuRoot; BOOL m_menuItemsStatus; LIST m_hPrivacyMenuItems; diff --git a/protocols/MSN/src/msn.cpp b/protocols/MSN/src/msn.cpp index ca1e2cd041..cd633dcc1c 100644 --- a/protocols/MSN/src/msn.cpp +++ b/protocols/MSN/src/msn.cpp @@ -58,7 +58,6 @@ static const PLUGININFOEX pluginInfo = int MSN_GCEventHook(WPARAM wParam, LPARAM lParam); int MSN_GCMenuHook(WPARAM wParam, LPARAM lParam); -int MSN_ChatInit(WPARAM wParam, LPARAM lParam); ///////////////////////////////////////////////////////////////////////////// // Protocol instances diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 620477c6a3..cdeb14d969 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -39,10 +39,8 @@ HANDLE CMsnProto::MSN_GetChatInernalHandle(HANDLE hContact) return result; } - -int CMsnProto::MSN_ChatInit(WPARAM wParam, LPARAM) +int CMsnProto::MSN_ChatInit(ThreadData *info) { - ThreadData *info = (ThreadData*)wParam; InterlockedIncrement(&sttChatID); _ltot(sttChatID, info->mChatID, 10); @@ -95,7 +93,7 @@ void CMsnProto::MSN_ChatStart(ThreadData* info) MSN_StartStopTyping(info, false); - NotifyEventHooks(hInitChat, (WPARAM)info, 0); + MSN_ChatInit(info); // add all participants onto the list GCDEST gcd = { m_szModuleName, { NULL }, GC_EVENT_JOIN }; diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 1d92edf44f..8c31f781ab 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -205,8 +205,7 @@ CMsnProto::~CMsnProto() int CMsnProto::OnModulesLoaded(WPARAM, LPARAM) { - if (msnHaveChatDll) - { + if (msnHaveChatDll) { GCREGISTER gcr = {0}; gcr.cbSize = sizeof(GCREGISTER); gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR | GC_TCHAR; @@ -219,11 +218,6 @@ int CMsnProto::OnModulesLoaded(WPARAM, LPARAM) HookProtoEvent(ME_GC_EVENT, &CMsnProto::MSN_GCEventHook); HookProtoEvent(ME_GC_BUILDMENU, &CMsnProto::MSN_GCMenuHook); - - char szEvent[200]; - mir_snprintf(szEvent, sizeof szEvent, "%s\\ChatInit", m_szModuleName); - hInitChat = CreateHookableEvent(szEvent); - HookProtoEvent(szEvent, &CMsnProto::MSN_ChatInit); } HookProtoEvent(ME_IDLE_CHANGED, &CMsnProto::OnIdleChanged); diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h index 5b349bbfc7..c46c5f0665 100644 --- a/protocols/MSN/src/msn_proto.h +++ b/protocols/MSN/src/msn_proto.h @@ -185,7 +185,6 @@ struct CMsnProto : public PROTO_INTERFACE, public MZeroedObject HANDLE hNetlibUser; HANDLE hNetlibUserHttps; HANDLE hHttpsConnection; - HANDLE hInitChat; HANDLE hMSNNudge; HANDLE hMSNAvatarsFolder; @@ -419,6 +418,7 @@ struct CMsnProto : public PROTO_INTERFACE, public MZeroedObject ///////////////////////////////////////////////////////////////////////////////////////// // MSN Chat support + int MSN_ChatInit(ThreadData* info); void MSN_ChatStart(ThreadData* info); void MSN_KillChatSession(TCHAR* id); @@ -426,7 +426,6 @@ struct CMsnProto : public PROTO_INTERFACE, public MZeroedObject int __cdecl MSN_GCEventHook(WPARAM wParam, LPARAM lParam); int __cdecl MSN_GCMenuHook(WPARAM wParam, LPARAM lParam); - int __cdecl MSN_ChatInit(WPARAM wParam, LPARAM lParam); ///////////////////////////////////////////////////////////////////////////////////////// // MSN contact list @@ -451,18 +450,18 @@ struct CMsnProto : public PROTO_INTERFACE, public MZeroedObject void AddDelUserContList(const char* email, const int list, const int netId, const bool del); - void MSN_CreateContList(void); - void MSN_CleanupLists(void); - void MSN_FindYahooUser(const char* email); - bool MSN_RefreshContactList(void); + void MSN_CreateContList(void); + void MSN_CleanupLists(void); + void MSN_FindYahooUser(const char* email); + bool MSN_RefreshContactList(void); - bool MSN_IsMyContact(HANDLE hContact); - bool MSN_IsMeByContact(HANDLE hContact, char* szEmail = NULL); + bool MSN_IsMyContact(HANDLE hContact); + bool MSN_IsMeByContact(HANDLE hContact, char* szEmail = NULL); bool MSN_AddUser(HANDLE hContact, const char* email, int netId, int flags, const char *msg = NULL); void MSN_AddAuthRequest(const char *email, const char *nick, const char *reason); - void MSN_SetContactDb(HANDLE hContact, const char *szEmail); - HANDLE MSN_HContactFromEmail(const char* msnEmail, const char* msnNick = NULL, bool addIfNeeded = false, bool temporary = false); - HANDLE AddToListByEmail(const char *email, const char *nick, DWORD flags); + void MSN_SetContactDb(HANDLE hContact, const char *szEmail); + HANDLE MSN_HContactFromEmail(const char* msnEmail, const char* msnNick = NULL, bool addIfNeeded = false, bool temporary = false); + HANDLE AddToListByEmail(const char *email, const char *nick, DWORD flags); ///////////////////////////////////////////////////////////////////////////////////////// // MSN server groups @@ -484,7 +483,7 @@ struct CMsnProto : public PROTO_INTERFACE, public MZeroedObject ///////////////////////////////////////////////////////////////////////////////////////// // MSN Authentication - int MSN_GetPassportAuth(void); + int MSN_GetPassportAuth(void); char* GenerateLoginBlob(char* challenge); char* HotmailLogin(const char* url); void FreeAuthTokens(void); -- cgit v1.2.3