diff options
author | George Hazan <ghazan@miranda.im> | 2016-11-26 20:15:05 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2016-11-26 20:15:05 +0300 |
commit | e4c501febbf9460ec24f90efb479deb5e68a2494 (patch) | |
tree | fd10ba01480f248fd10d4d8aff8df10577631852 /protocols/IRCG | |
parent | d5960ef7a6e6764fd33e473ecd12a819e172dcef (diff) |
crash fix for IRC kick/makeop commands
Diffstat (limited to 'protocols/IRCG')
-rw-r--r-- | protocols/IRCG/src/commandmonitor.cpp | 9 | ||||
-rw-r--r-- | protocols/IRCG/src/irclib.cpp | 10 | ||||
-rw-r--r-- | protocols/IRCG/src/services.cpp | 2 |
3 files changed, 8 insertions, 13 deletions
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index ecf55b4f83..26eaeebb80 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -408,7 +408,7 @@ bool CIrcProto::OnIrc_KICK(const CIrcMessage* pmsg) Chat_Control(m_szModuleName, S, SESSION_OFFLINE);
if (m_rejoinIfKicked) {
- CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, pmsg->parameters[0]);
+ CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, MakeWndID(pmsg->parameters[0]));
if (wi && wi->pszPassword)
PostIrcMessage(L"/JOIN %s %s", pmsg->parameters[0], wi->pszPassword);
else
@@ -492,7 +492,8 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) if ((int)pmsg->parameters.getCount() > iParametercount) {
if (!mir_wstrcmp(pmsg->parameters[2], m_info.sNick)) {
char cModeBit = -1;
- CHANNELINFO *wi = (CHANNELINFO*)Chat_GetUserInfo(m_szModuleName, pmsg->parameters[0]);
+ CMStringW windowName = MakeWndID(pmsg->parameters[0]);
+ CHANNELINFO *wi = (CHANNELINFO*)Chat_GetUserInfo(m_szModuleName, windowName);
switch (*p1) {
case 'v': cModeBit = 0; break;
case 'h': cModeBit = 1; break;
@@ -502,14 +503,14 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) }
// set bit for own mode on this channel (voice/hop/op/admin/owner)
- if (cModeBit >= 0) {
+ if (wi && cModeBit >= 0) {
if (bAdd)
wi->OwnMode |= (1 << cModeBit);
else
wi->OwnMode &= ~(1 << cModeBit);
}
- Chat_SetUserInfo(m_szModuleName, pmsg->parameters[0], wi);
+ Chat_SetUserInfo(m_szModuleName, windowName, wi);
}
DoEvent(bAdd ? GC_EVENT_ADDSTATUS : GC_EVENT_REMOVESTATUS, pmsg->parameters[0], pmsg->parameters[iParametercount], pmsg->prefix.sNick, sStatus, NULL, NULL, m_oldStyleModes ? false : true, false);
iParametercount++;
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index 36c9f09f40..d59717900a 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -658,14 +658,8 @@ void CIrcProto::OnIrcMessage(const CIrcMessage* pmsg) if (pfn) { // call member function. if it returns 'false', // call the default handling - __try { - if (!(this->*pfn)(pmsg)) - OnIrcDefault(pmsg); - } - __except (EXCEPTION_EXECUTE_HANDLER) // dedicated to Sava :) - { - debugLogA("IRC handler feels sick: %S", pmsg->sCommand.c_str()); - } + if (!(this->*pfn)(pmsg)) + OnIrcDefault(pmsg); } else // handler not found. call default handler OnIrcDefault(pmsg); diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index dc0b504209..ad3ef5605f 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -846,7 +846,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam) ulAdr = ConvertIPToInteger(m_IPFromServer ? m_myHost : m_myLocalHost);
gcmi->Item[23].bDisabled = ulAdr == 0 ? TRUE : FALSE; // DCC submenu
- CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, gcmi->pszID);
+ CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, MakeWndID(gcmi->pszID));
BOOL bServOwner = strchr(sUserModes.c_str(), 'q') == NULL ? FALSE : TRUE;
BOOL bServAdmin = strchr(sUserModes.c_str(), 'a') == NULL ? FALSE : TRUE;
BOOL bOwner = bServOwner ? ((wi->OwnMode >> 4) & 01) : FALSE;
|