From 7de38a08b97e0554e318b8c25806cef5d47259e6 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Thu, 12 Jun 2014 17:49:53 +0000 Subject: headers of not adopted plugins moved to !Deprecated git-svn-id: http://svn.miranda-ng.org/main/trunk@9438 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IRCG/src/irc.h | 10 -- protocols/IRCG/src/irclib.cpp | 8 +- protocols/IRCG/src/ircproto.cpp | 209 +++++++++++------------- protocols/IRCG/src/options.cpp | 1 - protocols/IRCG/src/scripting.cpp | 53 +----- protocols/IRCG/src/services.cpp | 340 +++++++++++++++++++-------------------- 6 files changed, 273 insertions(+), 348 deletions(-) (limited to 'protocols/IRCG') diff --git a/protocols/IRCG/src/irc.h b/protocols/IRCG/src/irc.h index 27ef8bc750..89f2edd82d 100644 --- a/protocols/IRCG/src/irc.h +++ b/protocols/IRCG/src/irc.h @@ -73,8 +73,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "m_string.h" #include "win2k.h" -#include "m_ircscript.h" - #include "resource.h" #define IRC_QUICKCONNECT "/QuickConnectMenu" @@ -459,10 +457,6 @@ struct CIrcProto : public PROTO INT_PTR __cdecl Scripting_InsertGuiIn(WPARAM wParam,LPARAM lParam); INT_PTR __cdecl Scripting_InsertGuiOut(WPARAM wParam,LPARAM lParam); INT_PTR __cdecl Scripting_GetIrcData(WPARAM wparam, LPARAM lparam); - BOOL Scripting_TriggerMSPRawIn(char ** pszRaw); - BOOL Scripting_TriggerMSPRawOut(char ** pszRaw); - BOOL Scripting_TriggerMSPGuiIn(WPARAM * wparam, GCEVENT *gce); - BOOL Scripting_TriggerMSPGuiOut(GCHOOK * gch); // services.cpp void ConnectToServer(void); @@ -654,10 +648,6 @@ HICON LoadIconEx(int iIndex, bool big = false); HANDLE GetIconHandle(int iconId); void ReleaseIconEx(HICON hIcon); -// services.cpp - -extern BOOL bChatInstalled, m_bMbotInstalled; - //tools.cpp int __stdcall WCCmp(const TCHAR* wild, const TCHAR* string); char* __stdcall IrcLoadFile(TCHAR * szPath); diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index 369d2ff6ed..0e1fc195b6 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -276,13 +276,13 @@ void CIrcProto::Notify(const CIrcMessage* pmsg) int CIrcProto::NLSend(const unsigned char* buf, int cbBuf) { - if (m_bMbotInstalled && m_scriptingEnabled) { + if (m_scriptingEnabled) { int iVal = NULL; char * pszTemp = 0; pszTemp = (char*)mir_alloc(lstrlenA((const char *)buf) + 1); lstrcpynA(pszTemp, (const char *)buf, lstrlenA((const char *)buf) + 1); - if (Scripting_TriggerMSPRawOut(&pszTemp) && pszTemp) { + if (pszTemp) { if (con) iVal = Netlib_Send(con, (const char*)pszTemp, lstrlenA(pszTemp), MSG_DUMPASTEXT); } @@ -413,10 +413,10 @@ void CIrcProto::DoReceive() // process single message by monitor objects if (*pStart) { - if (m_bMbotInstalled && m_scriptingEnabled) { + if (m_scriptingEnabled) { char* pszTemp = mir_strdup(pStart); - if (Scripting_TriggerMSPRawIn(&pszTemp) && pszTemp) { + if (pszTemp) { char* p1 = pszTemp; // replace end-of-line with NULLs while (*p1 != '\0') { diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index e6a93a0d42..a212afdfdb 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -26,18 +26,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static volatile LONG g_msgid = 1; -static int CompareSessions( const CDccSession* p1, const CDccSession* p2 ) +static int CompareSessions(const CDccSession* p1, const CDccSession* p2) { - return INT_PTR( p1->di->hContact ) - INT_PTR( p2->di->hContact ); + return INT_PTR(p1->di->hContact) - INT_PTR(p2->di->hContact); } CIrcProto::CIrcProto(const char* szModuleName, const TCHAR* tszUserName) : - PROTO(szModuleName, tszUserName), - m_dcc_chats( 10, CompareSessions ), - m_dcc_xfers( 10, CompareSessions ), - m_ignoreItems( 10 ), - vUserhostReasons( 10 ), - vWhoInProgress( 10 ) +PROTO(szModuleName, tszUserName), +m_dcc_chats(10, CompareSessions), +m_dcc_xfers(10, CompareSessions), +m_ignoreItems(10), +vUserhostReasons(10), +vWhoInProgress(10) { InitializeCriticalSection(&cs); InitializeCriticalSection(&m_gchook); @@ -77,69 +77,69 @@ CIrcProto::CIrcProto(const char* szModuleName, const TCHAR* tszUserName) : CList_SetAllOffline(true); IRC_MAP_ENTRY("PING", PING) - IRC_MAP_ENTRY("JOIN", JOIN) - IRC_MAP_ENTRY("QUIT", QUIT) - IRC_MAP_ENTRY("KICK", KICK) - IRC_MAP_ENTRY("MODE", MODE) - IRC_MAP_ENTRY("NICK", NICK) - IRC_MAP_ENTRY("PART", PART) - IRC_MAP_ENTRY("PRIVMSG", PRIVMSG) - IRC_MAP_ENTRY("TOPIC", TOPIC) - IRC_MAP_ENTRY("NOTICE", NOTICE) - IRC_MAP_ENTRY("PING", PINGPONG) - IRC_MAP_ENTRY("PONG", PINGPONG) - IRC_MAP_ENTRY("INVITE", INVITE) - IRC_MAP_ENTRY("ERROR", ERROR) - IRC_MAP_ENTRY("001", WELCOME) - IRC_MAP_ENTRY("002", YOURHOST) - IRC_MAP_ENTRY("005", SUPPORT) - IRC_MAP_ENTRY("223", WHOIS_OTHER) //CodePage info - IRC_MAP_ENTRY("254", NOOFCHANNELS) - IRC_MAP_ENTRY("263", TRYAGAIN) - IRC_MAP_ENTRY("264", WHOIS_OTHER) //Encryption info (SSL connect) - IRC_MAP_ENTRY("301", WHOIS_AWAY) - IRC_MAP_ENTRY("302", USERHOST_REPLY) - IRC_MAP_ENTRY("305", BACKFROMAWAY) - IRC_MAP_ENTRY("306", SETAWAY) - IRC_MAP_ENTRY("307", WHOIS_AUTH) - IRC_MAP_ENTRY("310", WHOIS_OTHER) - IRC_MAP_ENTRY("311", WHOIS_NAME) - IRC_MAP_ENTRY("312", WHOIS_SERVER) - IRC_MAP_ENTRY("313", WHOIS_OTHER) - IRC_MAP_ENTRY("315", WHO_END) - IRC_MAP_ENTRY("317", WHOIS_IDLE) - IRC_MAP_ENTRY("318", WHOIS_END) - IRC_MAP_ENTRY("319", WHOIS_CHANNELS) - IRC_MAP_ENTRY("320", WHOIS_AUTH) - IRC_MAP_ENTRY("321", LISTSTART) - IRC_MAP_ENTRY("322", LIST) - IRC_MAP_ENTRY("323", LISTEND) - IRC_MAP_ENTRY("324", MODEQUERY) - IRC_MAP_ENTRY("330", WHOIS_AUTH) - IRC_MAP_ENTRY("332", INITIALTOPIC) - IRC_MAP_ENTRY("333", INITIALTOPICNAME) - IRC_MAP_ENTRY("352", WHO_REPLY) - IRC_MAP_ENTRY("353", NAMES) - IRC_MAP_ENTRY("366", ENDNAMES) - IRC_MAP_ENTRY("367", BANLIST) - IRC_MAP_ENTRY("368", BANLISTEND) - IRC_MAP_ENTRY("346", BANLIST) - IRC_MAP_ENTRY("347", BANLISTEND) - IRC_MAP_ENTRY("348", BANLIST) - IRC_MAP_ENTRY("349", BANLISTEND) - IRC_MAP_ENTRY("371", WHOIS_OTHER) - IRC_MAP_ENTRY("376", ENDMOTD) - IRC_MAP_ENTRY("401", WHOIS_NO_USER) - IRC_MAP_ENTRY("403", JOINERROR) - IRC_MAP_ENTRY("416", WHOTOOLONG) - IRC_MAP_ENTRY("421", UNKNOWN) - IRC_MAP_ENTRY("422", ENDMOTD) - IRC_MAP_ENTRY("433", NICK_ERR) - IRC_MAP_ENTRY("471", JOINERROR) - IRC_MAP_ENTRY("473", JOINERROR) - IRC_MAP_ENTRY("474", JOINERROR) - IRC_MAP_ENTRY("475", JOINERROR) - IRC_MAP_ENTRY("671", WHOIS_OTHER) //Encryption info (SSL connect) + IRC_MAP_ENTRY("JOIN", JOIN) + IRC_MAP_ENTRY("QUIT", QUIT) + IRC_MAP_ENTRY("KICK", KICK) + IRC_MAP_ENTRY("MODE", MODE) + IRC_MAP_ENTRY("NICK", NICK) + IRC_MAP_ENTRY("PART", PART) + IRC_MAP_ENTRY("PRIVMSG", PRIVMSG) + IRC_MAP_ENTRY("TOPIC", TOPIC) + IRC_MAP_ENTRY("NOTICE", NOTICE) + IRC_MAP_ENTRY("PING", PINGPONG) + IRC_MAP_ENTRY("PONG", PINGPONG) + IRC_MAP_ENTRY("INVITE", INVITE) + IRC_MAP_ENTRY("ERROR", ERROR) + IRC_MAP_ENTRY("001", WELCOME) + IRC_MAP_ENTRY("002", YOURHOST) + IRC_MAP_ENTRY("005", SUPPORT) + IRC_MAP_ENTRY("223", WHOIS_OTHER) //CodePage info + IRC_MAP_ENTRY("254", NOOFCHANNELS) + IRC_MAP_ENTRY("263", TRYAGAIN) + IRC_MAP_ENTRY("264", WHOIS_OTHER) //Encryption info (SSL connect) + IRC_MAP_ENTRY("301", WHOIS_AWAY) + IRC_MAP_ENTRY("302", USERHOST_REPLY) + IRC_MAP_ENTRY("305", BACKFROMAWAY) + IRC_MAP_ENTRY("306", SETAWAY) + IRC_MAP_ENTRY("307", WHOIS_AUTH) + IRC_MAP_ENTRY("310", WHOIS_OTHER) + IRC_MAP_ENTRY("311", WHOIS_NAME) + IRC_MAP_ENTRY("312", WHOIS_SERVER) + IRC_MAP_ENTRY("313", WHOIS_OTHER) + IRC_MAP_ENTRY("315", WHO_END) + IRC_MAP_ENTRY("317", WHOIS_IDLE) + IRC_MAP_ENTRY("318", WHOIS_END) + IRC_MAP_ENTRY("319", WHOIS_CHANNELS) + IRC_MAP_ENTRY("320", WHOIS_AUTH) + IRC_MAP_ENTRY("321", LISTSTART) + IRC_MAP_ENTRY("322", LIST) + IRC_MAP_ENTRY("323", LISTEND) + IRC_MAP_ENTRY("324", MODEQUERY) + IRC_MAP_ENTRY("330", WHOIS_AUTH) + IRC_MAP_ENTRY("332", INITIALTOPIC) + IRC_MAP_ENTRY("333", INITIALTOPICNAME) + IRC_MAP_ENTRY("352", WHO_REPLY) + IRC_MAP_ENTRY("353", NAMES) + IRC_MAP_ENTRY("366", ENDNAMES) + IRC_MAP_ENTRY("367", BANLIST) + IRC_MAP_ENTRY("368", BANLISTEND) + IRC_MAP_ENTRY("346", BANLIST) + IRC_MAP_ENTRY("347", BANLISTEND) + IRC_MAP_ENTRY("348", BANLIST) + IRC_MAP_ENTRY("349", BANLISTEND) + IRC_MAP_ENTRY("371", WHOIS_OTHER) + IRC_MAP_ENTRY("376", ENDMOTD) + IRC_MAP_ENTRY("401", WHOIS_NO_USER) + IRC_MAP_ENTRY("403", JOINERROR) + IRC_MAP_ENTRY("416", WHOTOOLONG) + IRC_MAP_ENTRY("421", UNKNOWN) + IRC_MAP_ENTRY("422", ENDMOTD) + IRC_MAP_ENTRY("433", NICK_ERR) + IRC_MAP_ENTRY("471", JOINERROR) + IRC_MAP_ENTRY("473", JOINERROR) + IRC_MAP_ENTRY("474", JOINERROR) + IRC_MAP_ENTRY("475", JOINERROR) + IRC_MAP_ENTRY("671", WHOIS_OTHER) //Encryption info (SSL connect) } CIrcProto::~CIrcProto() @@ -170,7 +170,7 @@ CIrcProto::~CIrcProto() //////////////////////////////////////////////////////////////////////////////////////// // OnModulesLoaded - performs hook registration -static COLORREF crCols[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; +static COLORREF crCols[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; static int sttCheckPerform(const char *szSetting, LPARAM lParam) { @@ -207,42 +207,30 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) nlu.ptszDescriptiveName = name; hNetlibDCC = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); - if (ServiceExists("MBot/GetFcnTable")) { - CallService(MS_MBOT_REGISTERIRC, 0, (LPARAM)m_szModuleName); - m_bMbotInstalled = TRUE; - } - - if (ServiceExists(MS_GC_REGISTER)) { - GCREGISTER gcr = { sizeof(GCREGISTER) }; - gcr.dwFlags = GC_CHANMGR | GC_BOLD | GC_ITALICS | GC_UNDERLINE | GC_COLOR | GC_BKGCOLOR; - gcr.nColors = 16; - gcr.pColors = colors; - gcr.ptszDispName = m_tszUserName; - gcr.pszModule = m_szModuleName; - CallServiceSync(MS_GC_REGISTER, NULL, (LPARAM)&gcr); - - HookProtoEvent(ME_GC_EVENT, &CIrcProto::GCEventHook); - HookProtoEvent(ME_GC_BUILDMENU, &CIrcProto::GCMenuHook); - - GCSESSION gcw = { sizeof(GCSESSION) }; - gcw.iType = GCW_SERVER; - gcw.ptszID = SERVERWINDOW; - gcw.pszModule = m_szModuleName; - gcw.ptszName = NEWTSTR_ALLOCA((TCHAR*)_A2T(m_network)); - CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw); - - GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL }; - GCEVENT gce = { sizeof(gce), &gcd }; - if (m_useServer && !m_hideServerWindow) - CallChatEvent(WINDOW_VISIBLE, (LPARAM)&gce); - else - CallChatEvent(WINDOW_HIDDEN, (LPARAM)&gce); - bChatInstalled = TRUE; - } - else { - if (IDYES == MessageBox(0, TranslateT("The IRC protocol depends on another plugin called 'Chat'\n\nDo you want to download it from the Miranda NG web site now?"), TranslateT("Information"), MB_YESNO | MB_ICONINFORMATION)) - CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://miranda-ng.org/"); - } + GCREGISTER gcr = { sizeof(GCREGISTER) }; + gcr.dwFlags = GC_CHANMGR | GC_BOLD | GC_ITALICS | GC_UNDERLINE | GC_COLOR | GC_BKGCOLOR; + gcr.nColors = 16; + gcr.pColors = colors; + gcr.ptszDispName = m_tszUserName; + gcr.pszModule = m_szModuleName; + CallServiceSync(MS_GC_REGISTER, NULL, (LPARAM)&gcr); + + HookProtoEvent(ME_GC_EVENT, &CIrcProto::GCEventHook); + HookProtoEvent(ME_GC_BUILDMENU, &CIrcProto::GCMenuHook); + + GCSESSION gcw = { sizeof(GCSESSION) }; + gcw.iType = GCW_SERVER; + gcw.ptszID = SERVERWINDOW; + gcw.pszModule = m_szModuleName; + gcw.ptszName = NEWTSTR_ALLOCA((TCHAR*)_A2T(m_network)); + CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw); + + GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL }; + GCEVENT gce = { sizeof(gce), &gcd }; + if (m_useServer && !m_hideServerWindow) + CallChatEvent(WINDOW_VISIBLE, (LPARAM)&gce); + else + CallChatEvent(WINDOW_HIDDEN, (LPARAM)&gce); TCHAR szTemp[MAX_PATH]; mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%miranda_path%%\\Plugins\\%S_perform.ini"), m_szModuleName); @@ -774,7 +762,7 @@ struct TFakeAckParam { __inline TFakeAckParam(MCONTACT _hContact, int _msgid) : hContact(_hContact), msgid(_msgid) - {} + {} MCONTACT hContact; int msgid; @@ -861,9 +849,6 @@ int __cdecl CIrcProto::SetStatus(int iNewStatus) int CIrcProto::SetStatusInternal(int iNewStatus, bool bIsInternal) { - if (!bChatInstalled) - return 0; - if (iNewStatus != ID_STATUS_OFFLINE && !m_network[0]) { if (m_nick[0] && !m_disableDefaultServer) { CQuickDlg* dlg = new CQuickDlg(this); diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 5ffdac047a..a5805e266f 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -1026,7 +1026,6 @@ void COtherPrefsDlg::OnInitDialog() m_quitMessage.SetText(m_proto->m_quitMessage); m_perform.SetState(m_proto->m_perform); m_scripting.SetState(m_proto->m_scriptingEnabled); - m_scripting.Enable(m_bMbotInstalled); m_performCombo.Enable(m_proto->m_perform); m_pertormEdit.Enable(m_proto->m_perform); m_add.Enable(m_proto->m_perform); diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp index 84dfcc8203..484a2b6739 100644 --- a/protocols/IRCG/src/scripting.cpp +++ b/protocols/IRCG/src/scripting.cpp @@ -25,7 +25,7 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertRawIn(WPARAM, LPARAM lParam) { char* pszRaw = (char*)lParam; - if (m_bMbotInstalled && m_scriptingEnabled && pszRaw && IsConnected()) { + if (m_scriptingEnabled && pszRaw && IsConnected()) { TCHAR* p = mir_a2t(pszRaw); InsertIncomingEvent(p); mir_free(p); @@ -38,7 +38,7 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertRawIn(WPARAM, LPARAM lParam) INT_PTR __cdecl CIrcProto::Scripting_InsertRawOut( WPARAM, LPARAM lParam ) { char* pszRaw = (char*)lParam; - if (m_bMbotInstalled && m_scriptingEnabled && pszRaw && IsConnected()) { + if (m_scriptingEnabled && pszRaw && IsConnected()) { String S = pszRaw; ReplaceString(S, "%", "%%%%"); NLSendNoScript((const unsigned char *)S.c_str(), lstrlenA(S.c_str())); @@ -75,7 +75,7 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertGuiOut(WPARAM, LPARAM lParam) { GCHOOK* gch = (GCHOOK*)lParam; - if (m_bMbotInstalled && m_scriptingEnabled && gch) { + if (m_scriptingEnabled && gch) { GCHOOK* gchook = new GCHOOK; gchook->pDest = new GCDEST; @@ -107,54 +107,9 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertGuiOut(WPARAM, LPARAM lParam) return 1; } -BOOL CIrcProto::Scripting_TriggerMSPRawIn(char** pszRaw) -{ - int iVal = CallService(MS_MBOT_IRC_RAW_IN, (WPARAM)m_szModuleName, (LPARAM)pszRaw); - if (iVal == 0) - return TRUE; - - return iVal > 0 ? FALSE : TRUE; -} - -BOOL CIrcProto::Scripting_TriggerMSPRawOut(char ** pszRaw) -{ - int iVal = CallService(MS_MBOT_IRC_RAW_OUT, (WPARAM)m_szModuleName, (LPARAM)pszRaw); - if (iVal == 0) - return TRUE; - - return iVal > 0 ? FALSE : TRUE; -} - -BOOL CIrcProto::Scripting_TriggerMSPGuiIn(WPARAM * wparam, GCEVENT *gce) -{ - WPARAM_GUI_IN wgi = { 0 }; - - wgi.pszModule = m_szModuleName; - wgi.wParam = *wparam; - if (gce->time == 0) - gce->time = time(0); - - int iVal = CallService(MS_MBOT_IRC_GUI_IN, (WPARAM)&wgi, (LPARAM)gce); - if (iVal == 0) { - *wparam = wgi.wParam; - return TRUE; - } - - return iVal > 0 ? FALSE : TRUE; -} - -BOOL CIrcProto::Scripting_TriggerMSPGuiOut(GCHOOK* gch) -{ - int iVal = CallService(MS_MBOT_IRC_GUI_OUT, (WPARAM)m_szModuleName, (LPARAM)gch); - if (iVal == 0) - return TRUE; - - return iVal > 0 ? FALSE : TRUE; -} - INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) { - if (m_bMbotInstalled && m_scriptingEnabled && lparam) { + if (m_scriptingEnabled && lparam) { String sString = (char*)lparam, sRequest; CMString sOutput, sChannel; diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 1b922570d8..c7aa5a6be6 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "irc.h" -BOOL bChatInstalled = FALSE, m_bMbotInstalled = FALSE; - void CIrcProto::InitMainMenus(void) { char temp[MAXMODULELABELLENGTH]; @@ -31,58 +29,56 @@ void CIrcProto::InitMainMenus(void) CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = temp; - if (bChatInstalled) { - HGENMENU hRoot = MO_GetProtoRootMenu(m_szModuleName); - if (hRoot == NULL) { - // Root popupmenuitem - mi.ptszName = m_tszUserName; - mi.position = -1999901010; - mi.hParentMenu = HGENMENU_ROOT; - mi.flags = CMIF_ROOTPOPUP | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; - mi.icolibItem = GetIconHandle(IDI_MAIN); - hRoot = hMenuRoot = Menu_AddProtoMenuItem(&mi); - } - else { - if (hMenuRoot) - CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)hMenuRoot, 0); - hMenuRoot = NULL; - } - - mi.flags = CMIF_CHILDPOPUP; - mi.pszName = LPGEN("&Quick connect"); - mi.icolibItem = GetIconHandle(IDI_QUICK); - strcpy(d, IRC_QUICKCONNECT); - mi.position = 201001; - mi.hParentMenu = hRoot; - hMenuQuick = Menu_AddProtoMenuItem(&mi); - - if (m_iStatus != ID_STATUS_OFFLINE) mi.flags |= CMIF_GRAYED; - - mi.pszName = LPGEN("&Join channel"); - mi.icolibItem = LoadSkinnedIconHandle(SKINICON_CHAT_JOIN);//GetIconHandle(IDI_JOIN); - strcpy(d, IRC_JOINCHANNEL); - mi.position = 201002; - hMenuJoin = Menu_AddProtoMenuItem(&mi); - - mi.pszName = LPGEN("&Change your nickname"); - mi.icolibItem = GetIconHandle(IDI_RENAME); - strcpy(d, IRC_CHANGENICK); - mi.position = 201003; - hMenuNick = Menu_AddProtoMenuItem(&mi); - - mi.pszName = LPGEN("Show the &list of available channels"); - mi.icolibItem = GetIconHandle(IDI_LIST); - strcpy(d, IRC_SHOWLIST); - mi.position = 201004; - hMenuList = Menu_AddProtoMenuItem(&mi); - - if (m_useServer) mi.flags &= ~CMIF_GRAYED; - mi.pszName = LPGEN("&Show the server window"); - mi.icolibItem = GetIconHandle(IDI_SERVER); - strcpy(d, IRC_SHOWSERVER); - mi.position = 201005; - hMenuServer = Menu_AddProtoMenuItem(&mi); + HGENMENU hRoot = MO_GetProtoRootMenu(m_szModuleName); + if (hRoot == NULL) { + // Root popupmenuitem + mi.ptszName = m_tszUserName; + mi.position = -1999901010; + mi.hParentMenu = HGENMENU_ROOT; + mi.flags = CMIF_ROOTPOPUP | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.icolibItem = GetIconHandle(IDI_MAIN); + hRoot = hMenuRoot = Menu_AddProtoMenuItem(&mi); } + else { + if (hMenuRoot) + CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)hMenuRoot, 0); + hMenuRoot = NULL; + } + + mi.flags = CMIF_CHILDPOPUP; + mi.pszName = LPGEN("&Quick connect"); + mi.icolibItem = GetIconHandle(IDI_QUICK); + strcpy(d, IRC_QUICKCONNECT); + mi.position = 201001; + mi.hParentMenu = hRoot; + hMenuQuick = Menu_AddProtoMenuItem(&mi); + + if (m_iStatus != ID_STATUS_OFFLINE) mi.flags |= CMIF_GRAYED; + + mi.pszName = LPGEN("&Join channel"); + mi.icolibItem = LoadSkinnedIconHandle(SKINICON_CHAT_JOIN);//GetIconHandle(IDI_JOIN); + strcpy(d, IRC_JOINCHANNEL); + mi.position = 201002; + hMenuJoin = Menu_AddProtoMenuItem(&mi); + + mi.pszName = LPGEN("&Change your nickname"); + mi.icolibItem = GetIconHandle(IDI_RENAME); + strcpy(d, IRC_CHANGENICK); + mi.position = 201003; + hMenuNick = Menu_AddProtoMenuItem(&mi); + + mi.pszName = LPGEN("Show the &list of available channels"); + mi.icolibItem = GetIconHandle(IDI_LIST); + strcpy(d, IRC_SHOWLIST); + mi.position = 201004; + hMenuList = Menu_AddProtoMenuItem(&mi); + + if (m_useServer) mi.flags &= ~CMIF_GRAYED; + mi.pszName = LPGEN("&Show the server window"); + mi.icolibItem = GetIconHandle(IDI_SERVER); + strcpy(d, IRC_SHOWSERVER); + mi.position = 201005; + hMenuServer = Menu_AddProtoMenuItem(&mi); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -97,8 +93,8 @@ static CIrcProto* IrcGetInstanceByHContact(MCONTACT hContact) return NULL; for (int i = 0; i < g_Instances.getCount(); i++) - if (!strcmp(szProto, g_Instances[i]->m_szModuleName)) - return g_Instances[i]; + if (!strcmp(szProto, g_Instances[i]->m_szModuleName)) + return g_Instances[i]; return NULL; } @@ -439,12 +435,12 @@ static void DoChatFormatting(TCHAR* pszText) break; case 'c': { - lstrcpy(InsertThis, _T("\003")); - iRemoveChars = 2; + lstrcpy(InsertThis, _T("\003")); + iRemoveChars = 2; - TCHAR szTemp[3]; - lstrcpyn(szTemp, p1 + 2, 3); - iFG = _ttoi(szTemp); + TCHAR szTemp[3]; + lstrcpyn(szTemp, p1 + 2, 3); + iFG = _ttoi(szTemp); } break; case 'C': @@ -534,9 +530,9 @@ int __cdecl CIrcProto::GCEventHook(WPARAM wParam, LPARAM lParam) case GC_USER_PRIVMESS: { - TCHAR szTemp[4000]; - mir_sntprintf(szTemp, SIZEOF(szTemp), _T("/QUERY %s"), gch->ptszUID); - PostIrcMessageWnd(p1, NULL, szTemp); + TCHAR szTemp[4000]; + mir_sntprintf(szTemp, SIZEOF(szTemp), _T("/QUERY %s"), gch->ptszUID); + PostIrcMessageWnd(p1, NULL, szTemp); } break; @@ -576,29 +572,29 @@ int __cdecl CIrcProto::GCEventHook(WPARAM wParam, LPARAM lParam) PostIrcMessage(_T("/nickserv DROP")); break; case 8: // nickserv Identify - { - CQuestionDlg* dlg = new CQuestionDlg(this); - dlg->Show(); - HWND question_hWnd = dlg->GetHwnd(); - HWND hEditCtrl = GetDlgItem(question_hWnd, IDC_EDIT); - SetDlgItemText(question_hWnd, IDC_CAPTION, TranslateT("Identify nick")); - SetWindowText(GetDlgItem(question_hWnd, IDC_TEXT), TranslateT("Please enter your password")); - SetDlgItemText(question_hWnd, IDC_HIDDENEDIT, _T("/nickserv IDENTIFY %question=\"%s\",\"%s\"")); - SetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE, - (LONG)GetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE) | ES_PASSWORD); - SendMessage(hEditCtrl, EM_SETPASSWORDCHAR, (WPARAM)_T('*'), 0); - SetFocus(hEditCtrl); - dlg->Activate(); - } + { + CQuestionDlg* dlg = new CQuestionDlg(this); + dlg->Show(); + HWND question_hWnd = dlg->GetHwnd(); + HWND hEditCtrl = GetDlgItem(question_hWnd, IDC_EDIT); + SetDlgItemText(question_hWnd, IDC_CAPTION, TranslateT("Identify nick")); + SetWindowText(GetDlgItem(question_hWnd, IDC_TEXT), TranslateT("Please enter your password")); + SetDlgItemText(question_hWnd, IDC_HIDDENEDIT, _T("/nickserv IDENTIFY %question=\"%s\",\"%s\"")); + SetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE, + (LONG)GetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE) | ES_PASSWORD); + SendMessage(hEditCtrl, EM_SETPASSWORDCHAR, (WPARAM)_T('*'), 0); + SetFocus(hEditCtrl); + dlg->Activate(); + } break; case 9: // nickserv remind password - { - DBVARIANT dbv; - if (!getTString("Nick", &dbv)) { - PostIrcMessage(_T("/nickserv SENDPASS %s"), dbv.ptszVal); - db_free(&dbv); - } + { + DBVARIANT dbv; + if (!getTString("Nick", &dbv)) { + PostIrcMessage(_T("/nickserv SENDPASS %s"), dbv.ptszVal); + db_free(&dbv); } + } break; case 10: // nickserv set new password PostIrcMessage(_T("/nickserv SET PASSWORD %%question=\"%s\",\"%s\""), @@ -701,12 +697,12 @@ int __cdecl CIrcProto::GCEventHook(WPARAM wParam, LPARAM lParam) case 10: PostIrcMessage(_T("/WHOIS %s %s"), gch->ptszUID, gch->ptszUID); break; - // case 11: - // DoUserhostWithReason(1, "I", true, "%s", gch->ptszUID ); - // break; - // case 12: - // DoUserhostWithReason(1, "J", true, "%s", gch->ptszUID ); - // break; + // case 11: + // DoUserhostWithReason(1, "I", true, "%s", gch->ptszUID ); + // break; + // case 12: + // DoUserhostWithReason(1, "J", true, "%s", gch->ptszUID ); + // break; case 13: PostIrcMessage(_T("/DCC CHAT %s"), gch->ptszUID); break; @@ -743,19 +739,19 @@ int __cdecl CIrcProto::GCEventHook(WPARAM wParam, LPARAM lParam) gch->ptszUID, TranslateT("Please enter the channel name to invite to"), TranslateT("Invite to channel")); break; case 30: - { - PROTOSEARCHRESULT psr = { 0 }; - psr.cbSize = sizeof(psr); - psr.flags = PSR_TCHAR; - psr.id = gch->ptszUID; - psr.nick = gch->ptszUID; - - ADDCONTACTSTRUCT acs = { 0 }; - acs.handleType = HANDLE_SEARCHRESULT; - acs.szProto = m_szModuleName; - acs.psr = &psr; - CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs); - } + { + PROTOSEARCHRESULT psr = { 0 }; + psr.cbSize = sizeof(psr); + psr.flags = PSR_TCHAR; + psr.id = gch->ptszUID; + psr.nick = gch->ptszUID; + + ADDCONTACTSTRUCT acs = { 0 }; + acs.handleType = HANDLE_SEARCHRESULT; + acs.szProto = m_szModuleName; + acs.psr = &psr; + CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs); + } break; case 31: //slap PostIrcMessageWnd(p1, NULL, CMString(FORMAT, _T("/slap %s"), gch->ptszUID)); @@ -780,74 +776,74 @@ int __cdecl CIrcProto::GCEventHook(WPARAM wParam, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// static gc_item logItems[] = { - { LPGENT("&Change your nickname" ), 1, MENU_ITEM, FALSE }, - { LPGENT("Channel &settings" ), 2, MENU_ITEM, FALSE }, - { _T(""), 0, MENU_SEPARATOR, FALSE }, - { LPGENT("NickServ"), 0, MENU_NEWPOPUP, FALSE }, - { LPGENT("Register nick" ), 5, MENU_POPUPITEM, TRUE }, - { LPGENT("Auth nick" ), 6, MENU_POPUPITEM, FALSE }, - { LPGENT("Delete nick" ), 7, MENU_POPUPITEM, FALSE }, - { LPGENT("Identify nick" ), 8, MENU_POPUPITEM, FALSE }, - { LPGENT("Remind password" ), 9, MENU_POPUPITEM, FALSE }, - { LPGENT("Set new password" ), 10, MENU_POPUPITEM, TRUE }, - { LPGENT("Set language" ), 11, MENU_POPUPITEM, FALSE }, - { LPGENT("Set homepage" ), 12, MENU_POPUPITEM, FALSE }, - { LPGENT("Set e-mail" ), 13, MENU_POPUPITEM, FALSE }, - { LPGENT("Set info" ), 14, MENU_POPUPITEM, FALSE }, - { _T("" ), 0, MENU_POPUPSEPARATOR, FALSE }, - { LPGENT("Hide e-mail from info" ), 20, MENU_POPUPITEM, FALSE }, - { LPGENT("Show e-mail in info" ), 21, MENU_POPUPITEM, FALSE }, - { _T("" ), 0, MENU_POPUPSEPARATOR, FALSE }, - { LPGENT("Set security for nick" ), 22, MENU_POPUPITEM, FALSE }, - { LPGENT("Remove security for nick" ), 23, MENU_POPUPITEM, FALSE }, - { _T("" ), 0, MENU_POPUPSEPARATOR, FALSE }, - { LPGENT("Link nick to current" ), 24, MENU_POPUPITEM, FALSE }, - { LPGENT("Unlink nick from current" ), 25, MENU_POPUPITEM, FALSE }, - { LPGENT("Set main nick" ), 26, MENU_POPUPITEM, FALSE }, - { LPGENT("List all your nicks" ), 27, MENU_POPUPITEM, FALSE }, - { LPGENT("List your channels" ), 28, MENU_POPUPITEM, FALSE }, - { _T("" ), 0, MENU_POPUPSEPARATOR, FALSE }, - { LPGENT("Kill unauthorized: off" ), 15, MENU_POPUPITEM, FALSE }, - { LPGENT("Kill unauthorized: on" ), 16, MENU_POPUPITEM, FALSE }, - { LPGENT("Kill unauthorized: quick" ), 17, MENU_POPUPITEM, FALSE }, - { _T("" ), 0, MENU_POPUPSEPARATOR, FALSE }, - { LPGENT("Hide nick from list" ), 18, MENU_POPUPITEM, FALSE }, - { LPGENT("Show nick to list" ), 19, MENU_POPUPITEM, FALSE }, - { LPGENT("Show the server &window" ), 4, MENU_ITEM, FALSE }, - { _T(""), 0, MENU_SEPARATOR, FALSE }, - { LPGENT("&Leave the channel" ), 3, MENU_ITEM, FALSE } -}; - -static gc_item nickItems[] = { - { LPGENT("&WhoIs info"), 10, MENU_ITEM, FALSE }, //0 - { LPGENT("&Invite to channel"), 23, MENU_ITEM, FALSE }, - { LPGENT("Send ¬ice"), 22, MENU_ITEM, FALSE }, - { LPGENT("&Slap"), 31, MENU_ITEM, FALSE }, - { LPGENT("Nickserv info"), 32, MENU_ITEM, FALSE }, - { LPGENT("Nickserv kill ghost"), 33, MENU_ITEM, FALSE }, //5 - { LPGENT("&Control"), 0, MENU_NEWPOPUP, FALSE }, - { LPGENT("Give Owner"), 18, MENU_POPUPITEM, FALSE }, //7 - { LPGENT("Take Owner"), 19, MENU_POPUPITEM, FALSE }, - { LPGENT("Give Admin"), 20, MENU_POPUPITEM, FALSE }, - { LPGENT("Take Admin"), 21, MENU_POPUPITEM, FALSE }, //10 - { LPGENT("Give &Op"), 1, MENU_POPUPITEM, FALSE }, - { LPGENT("Take O&p"), 2, MENU_POPUPITEM, FALSE }, - { LPGENT("Give &Halfop"), 16, MENU_POPUPITEM, FALSE }, - { LPGENT("Take H&alfop"), 17, MENU_POPUPITEM, FALSE }, - { LPGENT("Give &Voice"), 3, MENU_POPUPITEM, FALSE }, //15 - { LPGENT("Take V&oice"), 4, MENU_POPUPITEM, FALSE }, - { _T(""), 0, MENU_POPUPSEPARATOR, FALSE }, - { LPGENT("&Kick"), 5, MENU_POPUPITEM, FALSE }, - { LPGENT("Ki&ck (reason)"), 6, MENU_POPUPITEM, FALSE }, - { LPGENT("&Ban"), 7, MENU_POPUPITEM, FALSE }, //20 - { LPGENT("Ban'&n kick"), 8, MENU_POPUPITEM, FALSE }, - { LPGENT("Ban'n kick (&reason)"), 9, MENU_POPUPITEM, FALSE }, - { LPGENT("&Direct Connection"), 0, MENU_NEWPOPUP, FALSE }, - { LPGENT("Request &Chat"), 13, MENU_POPUPITEM, FALSE }, - { LPGENT("Send &File"), 14, MENU_POPUPITEM, FALSE }, //25 - { LPGENT("Add to &ignore list"), 15, MENU_ITEM, FALSE }, - { _T(""), 12, MENU_SEPARATOR, FALSE }, - { LPGENT("&Add User"), 30, MENU_ITEM, FALSE } + { LPGENT("&Change your nickname"), 1, MENU_ITEM, FALSE }, + { LPGENT("Channel &settings"), 2, MENU_ITEM, FALSE }, + { _T(""), 0, MENU_SEPARATOR, FALSE }, + { LPGENT("NickServ"), 0, MENU_NEWPOPUP, FALSE }, + { LPGENT("Register nick"), 5, MENU_POPUPITEM, TRUE }, + { LPGENT("Auth nick"), 6, MENU_POPUPITEM, FALSE }, + { LPGENT("Delete nick"), 7, MENU_POPUPITEM, FALSE }, + { LPGENT("Identify nick"), 8, MENU_POPUPITEM, FALSE }, + { LPGENT("Remind password"), 9, MENU_POPUPITEM, FALSE }, + { LPGENT("Set new password"), 10, MENU_POPUPITEM, TRUE }, + { LPGENT("Set language"), 11, MENU_POPUPITEM, FALSE }, + { LPGENT("Set homepage"), 12, MENU_POPUPITEM, FALSE }, + { LPGENT("Set e-mail"), 13, MENU_POPUPITEM, FALSE }, + { LPGENT("Set info"), 14, MENU_POPUPITEM, FALSE }, + { _T(""), 0, MENU_POPUPSEPARATOR, FALSE }, + { LPGENT("Hide e-mail from info"), 20, MENU_POPUPITEM, FALSE }, + { LPGENT("Show e-mail in info"), 21, MENU_POPUPITEM, FALSE }, + { _T(""), 0, MENU_POPUPSEPARATOR, FALSE }, + { LPGENT("Set security for nick"), 22, MENU_POPUPITEM, FALSE }, + { LPGENT("Remove security for nick"), 23, MENU_POPUPITEM, FALSE }, + { _T(""), 0, MENU_POPUPSEPARATOR, FALSE }, + { LPGENT("Link nick to current"), 24, MENU_POPUPITEM, FALSE }, + { LPGENT("Unlink nick from current"), 25, MENU_POPUPITEM, FALSE }, + { LPGENT("Set main nick"), 26, MENU_POPUPITEM, FALSE }, + { LPGENT("List all your nicks"), 27, MENU_POPUPITEM, FALSE }, + { LPGENT("List your channels"), 28, MENU_POPUPITEM, FALSE }, + { _T(""), 0, MENU_POPUPSEPARATOR, FALSE }, + { LPGENT("Kill unauthorized: off"), 15, MENU_POPUPITEM, FALSE }, + { LPGENT("Kill unauthorized: on"), 16, MENU_POPUPITEM, FALSE }, + { LPGENT("Kill unauthorized: quick"), 17, MENU_POPUPITEM, FALSE }, + { _T(""), 0, MENU_POPUPSEPARATOR, FALSE }, + { LPGENT("Hide nick from list"), 18, MENU_POPUPITEM, FALSE }, + { LPGENT("Show nick to list"), 19, MENU_POPUPITEM, FALSE }, + { LPGENT("Show the server &window"), 4, MENU_ITEM, FALSE }, + { _T(""), 0, MENU_SEPARATOR, FALSE }, + { LPGENT("&Leave the channel"), 3, MENU_ITEM, FALSE } +}; + +static gc_item nickItems[] = { + { LPGENT("&WhoIs info"), 10, MENU_ITEM, FALSE }, //0 + { LPGENT("&Invite to channel"), 23, MENU_ITEM, FALSE }, + { LPGENT("Send ¬ice"), 22, MENU_ITEM, FALSE }, + { LPGENT("&Slap"), 31, MENU_ITEM, FALSE }, + { LPGENT("Nickserv info"), 32, MENU_ITEM, FALSE }, + { LPGENT("Nickserv kill ghost"), 33, MENU_ITEM, FALSE }, //5 + { LPGENT("&Control"), 0, MENU_NEWPOPUP, FALSE }, + { LPGENT("Give Owner"), 18, MENU_POPUPITEM, FALSE }, //7 + { LPGENT("Take Owner"), 19, MENU_POPUPITEM, FALSE }, + { LPGENT("Give Admin"), 20, MENU_POPUPITEM, FALSE }, + { LPGENT("Take Admin"), 21, MENU_POPUPITEM, FALSE }, //10 + { LPGENT("Give &Op"), 1, MENU_POPUPITEM, FALSE }, + { LPGENT("Take O&p"), 2, MENU_POPUPITEM, FALSE }, + { LPGENT("Give &Halfop"), 16, MENU_POPUPITEM, FALSE }, + { LPGENT("Take H&alfop"), 17, MENU_POPUPITEM, FALSE }, + { LPGENT("Give &Voice"), 3, MENU_POPUPITEM, FALSE }, //15 + { LPGENT("Take V&oice"), 4, MENU_POPUPITEM, FALSE }, + { _T(""), 0, MENU_POPUPSEPARATOR, FALSE }, + { LPGENT("&Kick"), 5, MENU_POPUPITEM, FALSE }, + { LPGENT("Ki&ck (reason)"), 6, MENU_POPUPITEM, FALSE }, + { LPGENT("&Ban"), 7, MENU_POPUPITEM, FALSE }, //20 + { LPGENT("Ban'&n kick"), 8, MENU_POPUPITEM, FALSE }, + { LPGENT("Ban'n kick (&reason)"), 9, MENU_POPUPITEM, FALSE }, + { LPGENT("&Direct Connection"), 0, MENU_NEWPOPUP, FALSE }, + { LPGENT("Request &Chat"), 13, MENU_POPUPITEM, FALSE }, + { LPGENT("Send &File"), 14, MENU_POPUPITEM, FALSE }, //25 + { LPGENT("Add to &ignore list"), 15, MENU_ITEM, FALSE }, + { _T(""), 12, MENU_SEPARATOR, FALSE }, + { LPGENT("&Add User"), 30, MENU_ITEM, FALSE } }; int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam) @@ -913,8 +909,8 @@ int __cdecl CIrcProto::OnPreShutdown(WPARAM, LPARAM) EnterCriticalSection(&cs); if (m_perform && IsConnected()) - if (DoPerform("Event: Disconnect")) - Sleep(200); + if (DoPerform("Event: Disconnect")) + Sleep(200); DisconnectAllDCCSessions(true); -- cgit v1.2.3