diff options
Diffstat (limited to 'protocols')
40 files changed, 517 insertions, 496 deletions
diff --git a/protocols/Discord/src/main.cpp b/protocols/Discord/src/main.cpp index 9a1c6aa7dd..4437ee1864 100644 --- a/protocols/Discord/src/main.cpp +++ b/protocols/Discord/src/main.cpp @@ -86,7 +86,9 @@ struct CMPlugin : public ACCPROTOPLUGIN<CDiscordProto> { CMPlugin() : ACCPROTOPLUGIN<CDiscordProto>("Discord") - {} + { + SetUniqueId(DB_KEY_ID); + } } g_plugin; diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index 6d899154dc..8884cc0ff8 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -117,8 +117,6 @@ DWORD_PTR CDiscordProto::GetCaps(int type, MCONTACT) return PF4_FORCEADDED | PF4_FORCEAUTH | PF4_NOCUSTOMAUTH | PF4_NOAUTHDENYREASON | PF4_SUPPORTTYPING | PF4_SUPPORTIDLE | PF4_AVATARS | PF4_IMSENDOFFLINE; case PFLAG_UNIQUEIDTEXT: return (DWORD_PTR)Translate("User ID"); - case PFLAG_UNIQUEIDSETTING: - return (DWORD_PTR)DB_KEY_ID; } return 0; } diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp index 3dd8c0ee4a..f95c8ccfb4 100644 --- a/protocols/Dummy/src/dummy_proto.cpp +++ b/protocols/Dummy/src/dummy_proto.cpp @@ -61,7 +61,14 @@ CDummyProto::CDummyProto(const char *szModuleName, const wchar_t *ptszUserName) msgid = 0; - uniqueIdText[0] = '\0'; + int id = getTemplateId(); + ptrA setting(id > 0 ? mir_strdup(templates[id].setting) : getStringA(DUMMY_ID_SETTING)); + if (setting != NULL) { + strncpy_s(uniqueIdText, setting, _TRUNCATE); + Proto_SetUniqueId(m_szModuleName, uniqueIdText); + } + else uniqueIdText[0] = '\0'; + uniqueIdSetting[0] = '\0'; dummy_Instances.insert(this); @@ -113,15 +120,6 @@ DWORD_PTR CDummyProto::GetCaps(int type, MCONTACT) strncpy_s(uniqueIdSetting, setting, _TRUNCATE); } return (DWORD_PTR)uniqueIdSetting; - - case PFLAG_UNIQUEIDSETTING: - if (uniqueIdText[0] == '\0') { - int id = getTemplateId(); - ptrA setting(id > 0 ? mir_strdup(templates[id].setting) : getStringA(DUMMY_ID_SETTING)); - if (setting != NULL) - strncpy_s(uniqueIdText, setting, _TRUNCATE); - } - return (DWORD_PTR)uniqueIdText; } return 0; } diff --git a/protocols/Dummy/src/main.cpp b/protocols/Dummy/src/main.cpp index 906ee1182a..6a57644bf3 100644 --- a/protocols/Dummy/src/main.cpp +++ b/protocols/Dummy/src/main.cpp @@ -85,6 +85,12 @@ struct CMPlugin : public ACCPROTOPLUGIN<CDummyProto> {
CMPlugin() :
ACCPROTOPLUGIN<CDummyProto>("Dummy")
- {}
+ {
+ int id = db_get_b(0, m_szModuleName, DUMMY_ID_TEMPLATE, -1);
+ if (id < 0 || id >= _countof(templates))
+ SetUniqueId(ptrA(db_get_sa(0, m_szModuleName, DUMMY_ID_SETTING)));
+ else
+ SetUniqueId(templates[id].setting);
+ }
}
g_plugin;
diff --git a/protocols/EmLanProto/src/amdproto.cpp b/protocols/EmLanProto/src/amdproto.cpp index 366a508a84..8305850048 100644 --- a/protocols/EmLanProto/src/amdproto.cpp +++ b/protocols/EmLanProto/src/amdproto.cpp @@ -68,9 +68,6 @@ static INT_PTR __cdecl EMPGetCaps(WPARAM wParam, LPARAM) return PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT;
case PFLAG_UNIQUEIDTEXT:
return (INT_PTR)Translate("User name or '*'");
- case PFLAG_UNIQUEIDSETTING:
- return (INT_PTR)"Nick";
- case PFLAG_MAXLENOFMESSAGE: //FIXME
default:
return 0;
}
@@ -371,6 +368,7 @@ struct CMPlugin : public CMPluginBase CMPluginBase(PROTONAME)
{
RegisterProtocol(PROTOTYPE_PROTOCOL);
+ SetUniqueId("Nick");
}
}
g_plugin;
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index b40314a8e3..f8c66e68b5 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -150,8 +150,6 @@ DWORD_PTR FacebookProto::GetCaps(int type, MCONTACT) return FACEBOOK_MESSAGE_LIMIT; case PFLAG_UNIQUEIDTEXT: return (DWORD_PTR) "Facebook ID"; - case PFLAG_UNIQUEIDSETTING: - return (DWORD_PTR)FACEBOOK_KEY_ID; } return 0; } diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index 8f4b547e61..099d75a187 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -291,5 +291,7 @@ struct CMPlugin : public ACCPROTOPLUGIN<FacebookProto> { CMPlugin() : ACCPROTOPLUGIN<FacebookProto>(FACEBOOK_NAME) - {} + { + SetUniqueId(FACEBOOK_KEY_ID); + } }; diff --git a/protocols/FacebookRM/src/stdafx.h b/protocols/FacebookRM/src/stdafx.h index 7e044a4bb7..3f7516c3dc 100644 --- a/protocols/FacebookRM/src/stdafx.h +++ b/protocols/FacebookRM/src/stdafx.h @@ -73,8 +73,8 @@ class FacebookProto; #include "http.h"
#include "client.h"
#include "http_request.h"
-#include "proto.h"
#include "db.h"
+#include "proto.h"
#include "dialogs.h"
#include "theme.h"
#include "resource.h"
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 30e9cbc5f9..10fbfc5aba 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -156,8 +156,6 @@ DWORD_PTR GaduProto::GetCaps(int type, MCONTACT) return PF2_LONGAWAY;
case PFLAG_UNIQUEIDTEXT:
return (DWORD_PTR)Translate("Gadu-Gadu Number");
- case PFLAG_UNIQUEIDSETTING:
- return (DWORD_PTR)GG_KEY_UIN;
}
return 0;
}
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h index ff973f010d..2a2ed13659 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.h +++ b/protocols/Gadu-Gadu/src/gg_proto.h @@ -313,7 +313,9 @@ struct CMPlugin : public ACCPROTOPLUGIN<GaduProto> {
CMPlugin() :
ACCPROTOPLUGIN<GaduProto>(GGDEF_PROTO)
- {}
+ {
+ SetUniqueId(GG_KEY_UIN);
+ }
};
#endif
diff --git a/protocols/ICQCorp/src/corp.cpp b/protocols/ICQCorp/src/corp.cpp index 4eabd5862c..2ea3819966 100644 --- a/protocols/ICQCorp/src/corp.cpp +++ b/protocols/ICQCorp/src/corp.cpp @@ -88,6 +88,7 @@ struct CMPlugin : public CMPluginBase strncpy_s(protoName, findData.cFileName, _TRUNCATE);
RegisterProtocol(PROTOTYPE_PROTOCOL);
+ SetUniqueId("UIN");
}
}
g_plugin;
diff --git a/protocols/ICQCorp/src/services.cpp b/protocols/ICQCorp/src/services.cpp index 163f0bd9fa..e71c0ce51c 100644 --- a/protocols/ICQCorp/src/services.cpp +++ b/protocols/ICQCorp/src/services.cpp @@ -35,9 +35,6 @@ static INT_PTR icqGetCaps(WPARAM wParam, LPARAM) case PFLAG_UNIQUEIDTEXT:
return (INT_PTR)Translate("ICQ number:");
-
- case PFLAG_UNIQUEIDSETTING:
- return (INT_PTR)"UIN";
}
return 0;
}
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 323e1dd587..fe7bb55831 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -451,9 +451,6 @@ DWORD_PTR __cdecl CIrcProto::GetCaps(int type, MCONTACT) case PFLAG_MAXLENOFMESSAGE:
return 400;
-
- case PFLAG_UNIQUEIDSETTING:
- return (DWORD_PTR) "Nick";
}
return 0;
diff --git a/protocols/IRCG/src/ircproto.h b/protocols/IRCG/src/ircproto.h new file mode 100644 index 0000000000..4a3e27fd43 --- /dev/null +++ b/protocols/IRCG/src/ircproto.h @@ -0,0 +1,432 @@ +/* +IRC plugin for Miranda IM + +Copyright (C) 2003-05 Jurgen Persson +Copyright (C) 2007-09 George Hazan + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef _IRCPROTO_H_ +#define _IRCPROTO_H_ + +///////////////////////////////////////////////////////////////////////////////////////// + +typedef bool (CIrcProto::*PfnIrcMessageHandler)(const CIrcMessage *pmsg); + +#pragma pack(4) + +struct CIrcHandler +{ + CIrcHandler(const wchar_t* _name, PfnIrcMessageHandler _handler) : + m_name(_name), + m_handler(_handler) + { + } + + const wchar_t* m_name; + PfnIrcMessageHandler m_handler; +}; +#pragma pack() + +struct CIrcProto : public PROTO<CIrcProto> +{ + CIrcProto(const char*, const wchar_t*); + ~CIrcProto(); + + // Protocol interface + + virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); + + virtual int __cdecl Authorize(MEVENT hDbEvent); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t* szReason); + + virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szPath); + virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer); + virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szReason); + virtual int __cdecl FileResume(HANDLE hTransfer, int *action, const wchar_t **szFilename); + + virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL); + + virtual HANDLE __cdecl SearchBasic(const wchar_t* id); + + virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles); + virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg); + + virtual int __cdecl SetStatus(int iNewStatus); + + virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact); + virtual int __cdecl SetAwayMsg(int m_iStatus, const wchar_t *msg); + + virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam); + + // Services + INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM, LPARAM); + INT_PTR __cdecl GetMyAwayMsg(WPARAM, LPARAM); + + INT_PTR __cdecl OnChangeNickMenuCommand(WPARAM, LPARAM); + INT_PTR __cdecl OnDoubleclicked(WPARAM, LPARAM); + INT_PTR __cdecl OnJoinChat(WPARAM, LPARAM); + INT_PTR __cdecl OnJoinMenuCommand(WPARAM, LPARAM); + INT_PTR __cdecl OnLeaveChat(WPARAM, LPARAM); + INT_PTR __cdecl OnMenuChanSettings(WPARAM, LPARAM); + INT_PTR __cdecl OnMenuDisconnect(WPARAM, LPARAM); + INT_PTR __cdecl OnMenuIgnore(WPARAM, LPARAM); + INT_PTR __cdecl OnMenuWhois(WPARAM, LPARAM); + INT_PTR __cdecl OnQuickConnectMenuCommand(WPARAM, LPARAM); + INT_PTR __cdecl OnShowListMenuCommand(WPARAM, LPARAM); + INT_PTR __cdecl OnShowServerMenuCommand(WPARAM, LPARAM); + + // Events + int __cdecl OnContactDeleted(WPARAM, LPARAM); + int __cdecl OnInitOptionsPages(WPARAM, LPARAM); + int __cdecl OnInitUserInfo(WPARAM, LPARAM); + int __cdecl OnModulesLoaded(WPARAM, LPARAM); + int __cdecl OnMenuPreBuild(WPARAM, LPARAM); + int __cdecl OnPreShutdown(WPARAM, LPARAM); + int __cdecl OnDbSettingChanged(WPARAM, LPARAM); + + int __cdecl GCEventHook(WPARAM, LPARAM); + int __cdecl GCMenuHook(WPARAM, LPARAM); + + // Data + + char m_serverName[100]; + char m_password[500]; + wchar_t m_identSystem[10]; + char m_network[30]; + char m_portStart[10]; + char m_portEnd[10]; + int m_iSSL; + wchar_t m_identPort[10]; + wchar_t m_nick[30], m_pNick[30]; + wchar_t m_alternativeNick[30]; + wchar_t m_name[200]; + wchar_t m_userID[200]; + wchar_t m_quitMessage[400]; + wchar_t m_userInfo[500]; + char m_myHost[50]; + char m_mySpecifiedHost[500]; + char m_mySpecifiedHostIP[50]; + char m_myLocalHost[50]; + WORD m_myLocalPort; + wchar_t *m_alias; + int m_serverComboSelection; + int m_quickComboSelection; + int m_onlineNotificationTime; + int m_onlineNotificationLimit; + BYTE m_scriptingEnabled; + BYTE m_IPFromServer; + BYTE m_showAddresses; + BYTE m_disconnectDCCChats; + BYTE m_disableErrorPopups; + BYTE m_rejoinChannels; + BYTE m_rejoinIfKicked; + BYTE m_hideServerWindow; + BYTE m_ident; + BYTE m_identTimer; + BYTE m_disableDefaultServer; + BYTE m_autoOnlineNotification; + BYTE m_sendKeepAlive; + BYTE m_joinOnInvite; + BYTE m_perform; + BYTE m_forceVisible; + BYTE m_ignore; + BYTE m_ignoreChannelDefault; + BYTE m_useServer; + BYTE m_DCCFileEnabled; + BYTE m_DCCChatEnabled; + BYTE m_DCCChatAccept; + BYTE m_DCCChatIgnore; + BYTE m_DCCPassive; + BYTE m_DCCMode; + WORD m_DCCPacketSize; + BYTE m_manualHost; + BYTE m_oldStyleModes; + BYTE m_channelAwayNotification; + BYTE m_sendNotice; + BYTE m_utfAutodetect; + BYTE m_bUseSASL; + int m_codepage; + COLORREF colors[16]; + HICON hIcon[13]; + + OBJLIST<CMStringW> vUserhostReasons; + OBJLIST<CMStringW> vWhoInProgress; + + mir_cs cs; + mir_cs m_gchook; + mir_cs m_resolve; + HANDLE m_evWndCreate; + + CMStringW m_statusMessage; + int m_iTempCheckTime; + + CIrcSessionInfo si; + + int m_portCount; + DWORD m_bConnectRequested; + DWORD m_bConnectThreadRunning; + + HGENMENU hMenuQuick, hMenuServer, hMenuJoin, hMenuNick, hMenuList; + HNETLIBUSER hNetlibDCC; + + bool bTempDisableCheck, bTempForceCheck, bEcho; + bool nickflag; + + bool bPerformDone; + + CJoinDlg *m_joinDlg; + CListDlg *m_listDlg; + CNickDlg *m_nickDlg; + CWhoisDlg *m_whoisDlg; + CQuickDlg *m_quickDlg; + CManagerDlg *m_managerDlg; + CIgnorePrefsDlg *m_ignoreDlg; + + int m_noOfChannels, m_manualWhoisCount; + CMStringA sChannelModes, sUserModes; + CMStringW sChannelPrefixes, sUserModePrefixes, WhoisAwayReply; + + // clist.cpp + MCONTACT CList_AddContact(CONTACT *user, bool InList, bool SetOnline); + bool CList_SetAllOffline(BYTE ChatsToo); + MCONTACT CList_SetOffline(CONTACT *user); + MCONTACT CList_FindContact(CONTACT *user); + BOOL CList_AddDCCChat(const CMStringW &name, const CMStringW &hostmask, unsigned long adr, int port); + + // commandmonitor.cpp + UINT_PTR IdentTimer, InitTimer, KeepAliveTimer, OnlineNotifTimer, OnlineNotifTimer3; + + int AddOutgoingMessageToDB(MCONTACT hContact, const wchar_t *msg); + bool DoOnConnect(const CIrcMessage *pmsg); + int DoPerform(const char *event); + void __cdecl ResolveIPThread(void *di); + + bool AddIgnore(const wchar_t *mask, const wchar_t *mode, const wchar_t *network); + int IsIgnored(const CMStringW &nick, const CMStringW &address, const CMStringW &host, char type); + int IsIgnored(CMStringW user, char type); + bool RemoveIgnore(const wchar_t *mask); + + // input.cpp + CMStringW DoAlias(const wchar_t *text, wchar_t *window); + BOOL DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hContact); + CMStringW DoIdentifiers(CMStringW text, const wchar_t *window); + void FormatMsg(CMStringW &text); + bool PostIrcMessageWnd(wchar_t *pszWindow, MCONTACT hContact, const wchar_t *szBuf); + bool PostIrcMessage(const wchar_t *fmt, ...); + + // irclib.cpp + UINT_PTR DCCTimer; + void SendIrcMessage(const wchar_t*, bool bNotify = true, int codepage = -1); + + // ircproto.cpp + void __cdecl AckBasicSearch(void* param); + void __cdecl AckMessageFail(void* info); + void __cdecl AckMessageFailDcc(void* info); + void __cdecl AckMessageSuccess(void* info); + + int SetStatusInternal(int iNewStatus, bool bIsInternal); + + //options.cpp + HWND m_hwndConnect; + + OBJLIST<CIrcIgnoreItem> m_ignoreItems; + + int m_channelNumber; + CMStringW m_whoReply; + CMStringW sNamesList; + CMStringW sTopic; + CMStringW sTopicName; + CMStringW sTopicTime; + CMStringW m_namesToWho; + CMStringW m_channelsToWho; + CMStringW m_namesToUserhost; + + void InitPrefs(void); + void InitIgnore(void); + + void ReadSettings(TDbSetting* sets, int count); + void RewriteIgnoreSettings(void); + void WriteSettings(TDbSetting* sets, int count); + + // output + BOOL ShowMessage(const CIrcMessage *pmsg); + + // scripting.cpp + INT_PTR __cdecl Scripting_InsertRawIn(WPARAM wParam, LPARAM lParam); + INT_PTR __cdecl Scripting_InsertRawOut(WPARAM wParam, LPARAM lParam); + 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); + + // services.cpp + void ConnectToServer(void); + void DisconnectFromServer(void); + void InitMainMenus(void); + + void __cdecl ConnectServerThread(void*); + void __cdecl DisconnectServerThread(void*); + + // tools.cpp + void AddToJTemp(wchar_t op, CMStringW& sCommand); + bool AddWindowItemData(CMStringW window, const wchar_t *pszLimit, const wchar_t *pszMode, const wchar_t *pszPassword, const wchar_t *pszTopic); + INT_PTR DoEvent(int iEvent, const wchar_t *pszWindow, const wchar_t *pszNick, const wchar_t *pszText, const wchar_t *pszStatus, const wchar_t *pszUserInfo, DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe, time_t timestamp = 1); + void FindLocalIP(HNETLIBCONN con); + bool FreeWindowItemData(CMStringW window, CHANNELINFO* wis); + bool IsChannel(const char* sName); + bool IsChannel(const wchar_t* sName); + void KillChatTimer(UINT_PTR &nIDEvent); + CMStringW MakeWndID(const wchar_t* sWindow); + CMStringW ModeToStatus(int sMode); + CMStringW PrefixToStatus(int cPrefix); + int SetChannelSBText(CMStringW sWindow, CHANNELINFO *wi); + void SetChatTimer(UINT_PTR &nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc); + + void ClearUserhostReasons(int type); + void DoUserhostWithReason(int type, CMStringW reason, bool bSendCommand, const wchar_t *userhostparams, ...); + CMStringW GetNextUserhostReason(int type); + CMStringW PeekAtReasons(int type); + + //////////////////////////////////////////////////////////////////////////////////////// + // former CIrcSession class + + void AddDCCSession(MCONTACT hContact, CDccSession *dcc); + void AddDCCSession(DCCINFO *pdci, CDccSession *dcc); + void RemoveDCCSession(MCONTACT hContact); + void RemoveDCCSession(DCCINFO *pdci); + + CDccSession* FindDCCSession(MCONTACT hContact); + CDccSession* FindDCCSession(DCCINFO *pdci); + CDccSession* FindDCCSendByPort(int iPort); + CDccSession* FindDCCRecvByPortAndName(int iPort, const wchar_t *szName); + CDccSession* FindPassiveDCCSend(int iToken); + CDccSession* FindPassiveDCCRecv(CMStringW sName, CMStringW sToken); + + void DisconnectAllDCCSessions(bool Shutdown); + void CheckDCCTimeout(void); + + bool Connect(const CIrcSessionInfo &info); + void Disconnect(void); + void KillIdent(void); + + int NLSend(const wchar_t* fmt, ...); + int NLSend(const char* fmt, ...); + int NLSend(const unsigned char* buf, int cbBuf); + int NLSendNoScript(const unsigned char* buf, int cbBuf); + int NLReceive(unsigned char* buf, int cbBuf); + void InsertIncomingEvent(wchar_t* pszRaw); + + __inline bool IsConnected() const { return con != nullptr; } + + // send-to-stream operators + int getCodepage() const; + __inline void setCodepage(int aPage) { codepage = aPage; } + + CIrcSessionInfo m_info; + +protected: + int codepage; + HNETLIBCONN con; + HNETLIBBIND hBindPort; + void DoReceive(); + LIST<CDccSession> m_dcc_chats; + LIST<CDccSession> m_dcc_xfers; + +private: + mir_cs m_dcc; // protect the dcc objects + + void createMessageFromPchar(const char* p); + void Notify(const CIrcMessage *pmsg); + void __cdecl ThreadProc(void *pparam); + + //////////////////////////////////////////////////////////////////////////////////////// + // former CIrcMonitor class + + bool OnIrc_PING(const CIrcMessage *pmsg); + bool OnIrc_WELCOME(const CIrcMessage *pmsg); + bool OnIrc_YOURHOST(const CIrcMessage *pmsg); + bool OnIrc_NICK(const CIrcMessage *pmsg); + bool OnIrc_PRIVMSG(const CIrcMessage *pmsg); + bool OnIrc_JOIN(const CIrcMessage *pmsg); + bool OnIrc_QUIT(const CIrcMessage *pmsg); + bool OnIrc_PART(const CIrcMessage *pmsg); + bool OnIrc_KICK(const CIrcMessage *pmsg); + bool OnIrc_MODE(const CIrcMessage *pmsg); + bool OnIrc_USERHOST_REPLY(const CIrcMessage *pmsg); + bool OnIrc_MODEQUERY(const CIrcMessage *pmsg); + bool OnIrc_NAMES(const CIrcMessage *pmsg); + bool OnIrc_ENDNAMES(const CIrcMessage *pmsg); + bool OnIrc_INITIALTOPIC(const CIrcMessage *pmsg); + bool OnIrc_INITIALTOPICNAME(const CIrcMessage *pmsg); + bool OnIrc_TOPIC(const CIrcMessage *pmsg); + bool OnIrc_TRYAGAIN(const CIrcMessage *pmsg); + bool OnIrc_NOTICE(const CIrcMessage *pmsg); + bool OnIrc_WHOIS_NAME(const CIrcMessage *pmsg); + bool OnIrc_WHOIS_CHANNELS(const CIrcMessage *pmsg); + bool OnIrc_WHOIS_SERVER(const CIrcMessage *pmsg); + bool OnIrc_WHOIS_AWAY(const CIrcMessage *pmsg); + bool OnIrc_WHOIS_IDLE(const CIrcMessage *pmsg); + bool OnIrc_WHOIS_END(const CIrcMessage *pmsg); + bool OnIrc_WHOIS_OTHER(const CIrcMessage *pmsg); + bool OnIrc_WHOIS_AUTH(const CIrcMessage *pmsg); + bool OnIrc_WHOIS_NO_USER(const CIrcMessage *pmsg); + bool OnIrc_NICK_ERR(const CIrcMessage *pmsg); + bool OnIrc_ENDMOTD(const CIrcMessage *pmsg); + bool OnIrc_LISTSTART(const CIrcMessage *pmsg); + bool OnIrc_LIST(const CIrcMessage *pmsg); + bool OnIrc_LISTEND(const CIrcMessage *pmsg); + bool OnIrc_BANLIST(const CIrcMessage *pmsg); + bool OnIrc_BANLISTEND(const CIrcMessage *pmsg); + bool OnIrc_SUPPORT(const CIrcMessage *pmsg); + bool OnIrc_BACKFROMAWAY(const CIrcMessage *pmsg); + bool OnIrc_SETAWAY(const CIrcMessage *pmsg); + bool OnIrc_JOINERROR(const CIrcMessage *pmsg); + bool OnIrc_UNKNOWN(const CIrcMessage *pmsg); + bool OnIrc_ERROR(const CIrcMessage *pmsg); + bool OnIrc_NOOFCHANNELS(const CIrcMessage *pmsg); + bool OnIrc_PINGPONG(const CIrcMessage *pmsg); + bool OnIrc_INVITE(const CIrcMessage *pmsg); + bool OnIrc_WHO_END(const CIrcMessage *pmsg); + bool OnIrc_WHO_REPLY(const CIrcMessage *pmsg); + bool OnIrc_WHOTOOLONG(const CIrcMessage *pmsg); + bool OnIrc_AUTHENTICATE(const CIrcMessage *pmsg); + bool OnIrc_AUTH_OK(const CIrcMessage *pmsg); + bool OnIrc_AUTH_FAIL(const CIrcMessage *pmsg); + bool OnIrc_CAP(const CIrcMessage *pmsg); + + bool IsCTCP(const CIrcMessage *pmsg); + + void OnIrcDefault(const CIrcMessage *pmsg); + void OnIrcDisconnected(); + + static OBJLIST<CIrcHandler> m_handlers; + + PfnIrcMessageHandler FindMethod(const wchar_t* lpszName); + + void OnIrcMessage(const CIrcMessage *pmsg); + CMStringW sNick4Perform; +}; + +struct CMPlugin : public ACCPROTOPLUGIN<CIrcProto> +{ + CMPlugin() : + ACCPROTOPLUGIN<CIrcProto>("IRC") + { + SetUniqueId("Nick"); + } +}; + +#endif // _IRCPROTO_H_ diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h index 6b0f5e659e..32bc8af34d 100644 --- a/protocols/IRCG/src/stdafx.h +++ b/protocols/IRCG/src/stdafx.h @@ -189,410 +189,7 @@ using namespace irc; #include "irc_dlg.h"
-/////////////////////////////////////////////////////////////////////////////////////////
-
-typedef bool (CIrcProto::*PfnIrcMessageHandler)(const CIrcMessage *pmsg);
-
-#pragma pack(4)
-
-struct CIrcHandler
-{
- CIrcHandler(const wchar_t* _name, PfnIrcMessageHandler _handler) :
- m_name(_name),
- m_handler(_handler)
- {
- }
-
- const wchar_t* m_name;
- PfnIrcMessageHandler m_handler;
-};
-#pragma pack()
-
-struct CIrcProto : public PROTO<CIrcProto>
-{
- CIrcProto(const char*, const wchar_t*);
- ~CIrcProto();
-
- // Protocol interface
-
- virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr);
-
- virtual int __cdecl Authorize(MEVENT hDbEvent);
- virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t* szReason);
-
- virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szPath);
- virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer);
- virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szReason);
- virtual int __cdecl FileResume(HANDLE hTransfer, int *action, const wchar_t **szFilename);
-
- virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
-
- virtual HANDLE __cdecl SearchBasic(const wchar_t* id);
-
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles);
- virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
-
- virtual int __cdecl SetStatus(int iNewStatus);
-
- virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact);
- virtual int __cdecl SetAwayMsg(int m_iStatus, const wchar_t *msg);
-
- virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam);
-
- // Services
- INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM, LPARAM);
- INT_PTR __cdecl GetMyAwayMsg(WPARAM, LPARAM);
-
- INT_PTR __cdecl OnChangeNickMenuCommand(WPARAM, LPARAM);
- INT_PTR __cdecl OnDoubleclicked(WPARAM, LPARAM);
- INT_PTR __cdecl OnJoinChat(WPARAM, LPARAM);
- INT_PTR __cdecl OnJoinMenuCommand(WPARAM, LPARAM);
- INT_PTR __cdecl OnLeaveChat(WPARAM, LPARAM);
- INT_PTR __cdecl OnMenuChanSettings(WPARAM, LPARAM);
- INT_PTR __cdecl OnMenuDisconnect(WPARAM, LPARAM);
- INT_PTR __cdecl OnMenuIgnore(WPARAM, LPARAM);
- INT_PTR __cdecl OnMenuWhois(WPARAM, LPARAM);
- INT_PTR __cdecl OnQuickConnectMenuCommand(WPARAM, LPARAM);
- INT_PTR __cdecl OnShowListMenuCommand(WPARAM, LPARAM);
- INT_PTR __cdecl OnShowServerMenuCommand(WPARAM, LPARAM);
-
- // Events
- int __cdecl OnContactDeleted(WPARAM, LPARAM);
- int __cdecl OnInitOptionsPages(WPARAM, LPARAM);
- int __cdecl OnInitUserInfo(WPARAM, LPARAM);
- int __cdecl OnModulesLoaded(WPARAM, LPARAM);
- int __cdecl OnMenuPreBuild(WPARAM, LPARAM);
- int __cdecl OnPreShutdown(WPARAM, LPARAM);
- int __cdecl OnDbSettingChanged(WPARAM, LPARAM);
-
- int __cdecl GCEventHook(WPARAM, LPARAM);
- int __cdecl GCMenuHook(WPARAM, LPARAM);
-
- // Data
-
- char m_serverName[100];
- char m_password[500];
- wchar_t m_identSystem[10];
- char m_network[30];
- char m_portStart[10];
- char m_portEnd[10];
- int m_iSSL;
- wchar_t m_identPort[10];
- wchar_t m_nick[30], m_pNick[30];
- wchar_t m_alternativeNick[30];
- wchar_t m_name[200];
- wchar_t m_userID[200];
- wchar_t m_quitMessage[400];
- wchar_t m_userInfo[500];
- char m_myHost[50];
- char m_mySpecifiedHost[500];
- char m_mySpecifiedHostIP[50];
- char m_myLocalHost[50];
- WORD m_myLocalPort;
- wchar_t *m_alias;
- int m_serverComboSelection;
- int m_quickComboSelection;
- int m_onlineNotificationTime;
- int m_onlineNotificationLimit;
- BYTE m_scriptingEnabled;
- BYTE m_IPFromServer;
- BYTE m_showAddresses;
- BYTE m_disconnectDCCChats;
- BYTE m_disableErrorPopups;
- BYTE m_rejoinChannels;
- BYTE m_rejoinIfKicked;
- BYTE m_hideServerWindow;
- BYTE m_ident;
- BYTE m_identTimer;
- BYTE m_disableDefaultServer;
- BYTE m_autoOnlineNotification;
- BYTE m_sendKeepAlive;
- BYTE m_joinOnInvite;
- BYTE m_perform;
- BYTE m_forceVisible;
- BYTE m_ignore;
- BYTE m_ignoreChannelDefault;
- BYTE m_useServer;
- BYTE m_DCCFileEnabled;
- BYTE m_DCCChatEnabled;
- BYTE m_DCCChatAccept;
- BYTE m_DCCChatIgnore;
- BYTE m_DCCPassive;
- BYTE m_DCCMode;
- WORD m_DCCPacketSize;
- BYTE m_manualHost;
- BYTE m_oldStyleModes;
- BYTE m_channelAwayNotification;
- BYTE m_sendNotice;
- BYTE m_utfAutodetect;
- BYTE m_bUseSASL;
- int m_codepage;
- COLORREF colors[16];
- HICON hIcon[13];
-
- OBJLIST<CMStringW> vUserhostReasons;
- OBJLIST<CMStringW> vWhoInProgress;
-
- mir_cs cs;
- mir_cs m_gchook;
- mir_cs m_resolve;
- HANDLE m_evWndCreate;
-
- CMStringW m_statusMessage;
- int m_iTempCheckTime;
-
- CIrcSessionInfo si;
-
- int m_portCount;
- DWORD m_bConnectRequested;
- DWORD m_bConnectThreadRunning;
-
- HGENMENU hMenuQuick, hMenuServer, hMenuJoin, hMenuNick, hMenuList;
- HNETLIBUSER hNetlibDCC;
-
- bool bTempDisableCheck, bTempForceCheck, bEcho;
- bool nickflag;
-
- bool bPerformDone;
-
- CJoinDlg *m_joinDlg;
- CListDlg *m_listDlg;
- CNickDlg *m_nickDlg;
- CWhoisDlg *m_whoisDlg;
- CQuickDlg *m_quickDlg;
- CManagerDlg *m_managerDlg;
- CIgnorePrefsDlg *m_ignoreDlg;
-
- int m_noOfChannels, m_manualWhoisCount;
- CMStringA sChannelModes, sUserModes;
- CMStringW sChannelPrefixes, sUserModePrefixes, WhoisAwayReply;
-
- // clist.cpp
- MCONTACT CList_AddContact(CONTACT *user, bool InList, bool SetOnline);
- bool CList_SetAllOffline(BYTE ChatsToo);
- MCONTACT CList_SetOffline(CONTACT *user);
- MCONTACT CList_FindContact(CONTACT *user);
- BOOL CList_AddDCCChat(const CMStringW &name, const CMStringW &hostmask, unsigned long adr, int port);
-
- // commandmonitor.cpp
- UINT_PTR IdentTimer, InitTimer, KeepAliveTimer, OnlineNotifTimer, OnlineNotifTimer3;
-
- int AddOutgoingMessageToDB(MCONTACT hContact, const wchar_t *msg);
- bool DoOnConnect(const CIrcMessage *pmsg);
- int DoPerform(const char *event);
- void __cdecl ResolveIPThread(void *di);
-
- bool AddIgnore(const wchar_t *mask, const wchar_t *mode, const wchar_t *network);
- int IsIgnored(const CMStringW &nick, const CMStringW &address, const CMStringW &host, char type);
- int IsIgnored(CMStringW user, char type);
- bool RemoveIgnore(const wchar_t *mask);
-
- // input.cpp
- CMStringW DoAlias(const wchar_t *text, wchar_t *window);
- BOOL DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hContact);
- CMStringW DoIdentifiers(CMStringW text, const wchar_t *window);
- void FormatMsg(CMStringW &text);
- bool PostIrcMessageWnd(wchar_t *pszWindow, MCONTACT hContact, const wchar_t *szBuf);
- bool PostIrcMessage(const wchar_t *fmt, ...);
-
- // irclib.cpp
- UINT_PTR DCCTimer;
- void SendIrcMessage(const wchar_t*, bool bNotify = true, int codepage = -1);
-
- // ircproto.cpp
- void __cdecl AckBasicSearch(void* param);
- void __cdecl AckMessageFail(void* info);
- void __cdecl AckMessageFailDcc(void* info);
- void __cdecl AckMessageSuccess(void* info);
-
- int SetStatusInternal(int iNewStatus, bool bIsInternal);
-
- //options.cpp
- HWND m_hwndConnect;
-
- OBJLIST<CIrcIgnoreItem> m_ignoreItems;
-
- int m_channelNumber;
- CMStringW m_whoReply;
- CMStringW sNamesList;
- CMStringW sTopic;
- CMStringW sTopicName;
- CMStringW sTopicTime;
- CMStringW m_namesToWho;
- CMStringW m_channelsToWho;
- CMStringW m_namesToUserhost;
-
- void InitPrefs(void);
- void InitIgnore(void);
-
- void ReadSettings(TDbSetting* sets, int count);
- void RewriteIgnoreSettings(void);
- void WriteSettings(TDbSetting* sets, int count);
-
- // output
- BOOL ShowMessage(const CIrcMessage *pmsg);
-
- // scripting.cpp
- INT_PTR __cdecl Scripting_InsertRawIn(WPARAM wParam, LPARAM lParam);
- INT_PTR __cdecl Scripting_InsertRawOut(WPARAM wParam, LPARAM lParam);
- 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);
-
- // services.cpp
- void ConnectToServer(void);
- void DisconnectFromServer(void);
- void InitMainMenus(void);
-
- void __cdecl ConnectServerThread(void*);
- void __cdecl DisconnectServerThread(void*);
-
- // tools.cpp
- void AddToJTemp(wchar_t op, CMStringW& sCommand);
- bool AddWindowItemData(CMStringW window, const wchar_t *pszLimit, const wchar_t *pszMode, const wchar_t *pszPassword, const wchar_t *pszTopic);
- INT_PTR DoEvent(int iEvent, const wchar_t *pszWindow, const wchar_t *pszNick, const wchar_t *pszText, const wchar_t *pszStatus, const wchar_t *pszUserInfo, DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe, time_t timestamp = 1);
- void FindLocalIP(HNETLIBCONN con);
- bool FreeWindowItemData(CMStringW window, CHANNELINFO* wis);
- bool IsChannel(const char* sName);
- bool IsChannel(const wchar_t* sName);
- void KillChatTimer(UINT_PTR &nIDEvent);
- CMStringW MakeWndID(const wchar_t* sWindow);
- CMStringW ModeToStatus(int sMode);
- CMStringW PrefixToStatus(int cPrefix);
- int SetChannelSBText(CMStringW sWindow, CHANNELINFO *wi);
- void SetChatTimer(UINT_PTR &nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc);
-
- void ClearUserhostReasons(int type);
- void DoUserhostWithReason(int type, CMStringW reason, bool bSendCommand, const wchar_t *userhostparams, ...);
- CMStringW GetNextUserhostReason(int type);
- CMStringW PeekAtReasons(int type);
-
- ////////////////////////////////////////////////////////////////////////////////////////
- // former CIrcSession class
-
- void AddDCCSession(MCONTACT hContact, CDccSession *dcc);
- void AddDCCSession(DCCINFO *pdci, CDccSession *dcc);
- void RemoveDCCSession(MCONTACT hContact);
- void RemoveDCCSession(DCCINFO *pdci);
-
- CDccSession* FindDCCSession(MCONTACT hContact);
- CDccSession* FindDCCSession(DCCINFO *pdci);
- CDccSession* FindDCCSendByPort(int iPort);
- CDccSession* FindDCCRecvByPortAndName(int iPort, const wchar_t *szName);
- CDccSession* FindPassiveDCCSend(int iToken);
- CDccSession* FindPassiveDCCRecv(CMStringW sName, CMStringW sToken);
-
- void DisconnectAllDCCSessions(bool Shutdown);
- void CheckDCCTimeout(void);
-
- bool Connect(const CIrcSessionInfo &info);
- void Disconnect(void);
- void KillIdent(void);
-
- int NLSend(const wchar_t* fmt, ...);
- int NLSend(const char* fmt, ...);
- int NLSend(const unsigned char* buf, int cbBuf);
- int NLSendNoScript(const unsigned char* buf, int cbBuf);
- int NLReceive(unsigned char* buf, int cbBuf);
- void InsertIncomingEvent(wchar_t* pszRaw);
-
- __inline bool IsConnected() const { return con != nullptr; }
-
- // send-to-stream operators
- int getCodepage() const;
- __inline void setCodepage(int aPage) { codepage = aPage; }
-
- CIrcSessionInfo m_info;
-
-protected:
- int codepage;
- HNETLIBCONN con;
- HNETLIBBIND hBindPort;
- void DoReceive();
- LIST<CDccSession> m_dcc_chats;
- LIST<CDccSession> m_dcc_xfers;
-
-private:
- mir_cs m_dcc; // protect the dcc objects
-
- void createMessageFromPchar(const char* p);
- void Notify(const CIrcMessage *pmsg);
- void __cdecl ThreadProc(void *pparam);
-
- ////////////////////////////////////////////////////////////////////////////////////////
- // former CIrcMonitor class
-
- bool OnIrc_PING(const CIrcMessage *pmsg);
- bool OnIrc_WELCOME(const CIrcMessage *pmsg);
- bool OnIrc_YOURHOST(const CIrcMessage *pmsg);
- bool OnIrc_NICK(const CIrcMessage *pmsg);
- bool OnIrc_PRIVMSG(const CIrcMessage *pmsg);
- bool OnIrc_JOIN(const CIrcMessage *pmsg);
- bool OnIrc_QUIT(const CIrcMessage *pmsg);
- bool OnIrc_PART(const CIrcMessage *pmsg);
- bool OnIrc_KICK(const CIrcMessage *pmsg);
- bool OnIrc_MODE(const CIrcMessage *pmsg);
- bool OnIrc_USERHOST_REPLY(const CIrcMessage *pmsg);
- bool OnIrc_MODEQUERY(const CIrcMessage *pmsg);
- bool OnIrc_NAMES(const CIrcMessage *pmsg);
- bool OnIrc_ENDNAMES(const CIrcMessage *pmsg);
- bool OnIrc_INITIALTOPIC(const CIrcMessage *pmsg);
- bool OnIrc_INITIALTOPICNAME(const CIrcMessage *pmsg);
- bool OnIrc_TOPIC(const CIrcMessage *pmsg);
- bool OnIrc_TRYAGAIN(const CIrcMessage *pmsg);
- bool OnIrc_NOTICE(const CIrcMessage *pmsg);
- bool OnIrc_WHOIS_NAME(const CIrcMessage *pmsg);
- bool OnIrc_WHOIS_CHANNELS(const CIrcMessage *pmsg);
- bool OnIrc_WHOIS_SERVER(const CIrcMessage *pmsg);
- bool OnIrc_WHOIS_AWAY(const CIrcMessage *pmsg);
- bool OnIrc_WHOIS_IDLE(const CIrcMessage *pmsg);
- bool OnIrc_WHOIS_END(const CIrcMessage *pmsg);
- bool OnIrc_WHOIS_OTHER(const CIrcMessage *pmsg);
- bool OnIrc_WHOIS_AUTH(const CIrcMessage *pmsg);
- bool OnIrc_WHOIS_NO_USER(const CIrcMessage *pmsg);
- bool OnIrc_NICK_ERR(const CIrcMessage *pmsg);
- bool OnIrc_ENDMOTD(const CIrcMessage *pmsg);
- bool OnIrc_LISTSTART(const CIrcMessage *pmsg);
- bool OnIrc_LIST(const CIrcMessage *pmsg);
- bool OnIrc_LISTEND(const CIrcMessage *pmsg);
- bool OnIrc_BANLIST(const CIrcMessage *pmsg);
- bool OnIrc_BANLISTEND(const CIrcMessage *pmsg);
- bool OnIrc_SUPPORT(const CIrcMessage *pmsg);
- bool OnIrc_BACKFROMAWAY(const CIrcMessage *pmsg);
- bool OnIrc_SETAWAY(const CIrcMessage *pmsg);
- bool OnIrc_JOINERROR(const CIrcMessage *pmsg);
- bool OnIrc_UNKNOWN(const CIrcMessage *pmsg);
- bool OnIrc_ERROR(const CIrcMessage *pmsg);
- bool OnIrc_NOOFCHANNELS(const CIrcMessage *pmsg);
- bool OnIrc_PINGPONG(const CIrcMessage *pmsg);
- bool OnIrc_INVITE(const CIrcMessage *pmsg);
- bool OnIrc_WHO_END(const CIrcMessage *pmsg);
- bool OnIrc_WHO_REPLY(const CIrcMessage *pmsg);
- bool OnIrc_WHOTOOLONG(const CIrcMessage *pmsg);
- bool OnIrc_AUTHENTICATE(const CIrcMessage *pmsg);
- bool OnIrc_AUTH_OK(const CIrcMessage *pmsg);
- bool OnIrc_AUTH_FAIL(const CIrcMessage *pmsg);
- bool OnIrc_CAP(const CIrcMessage *pmsg);
-
- bool IsCTCP(const CIrcMessage *pmsg);
-
- void OnIrcDefault(const CIrcMessage *pmsg);
- void OnIrcDisconnected();
-
- static OBJLIST<CIrcHandler> m_handlers;
-
- PfnIrcMessageHandler FindMethod(const wchar_t* lpszName);
-
- void OnIrcMessage(const CIrcMessage *pmsg);
- CMStringW sNick4Perform;
-};
-
-struct CMPlugin : public ACCPROTOPLUGIN<CIrcProto>
-{
- CMPlugin() :
- ACCPROTOPLUGIN<CIrcProto>("IRC")
- {}
-};
+#include "ircproto.h"
// map actual member functions to their associated IRC command.
// put any number of this macro in the class's constructor.
@@ -602,7 +199,7 @@ struct CMPlugin : public ACCPROTOPLUGIN<CIrcProto> /////////////////////////////////////////////////////////////////////////////////////////
// Functions
-//main.cpp
+// main.cpp
extern HINSTANCE hInst;
extern OBJLIST<SERVER_INFO> g_servers;
@@ -628,16 +225,16 @@ void InitIcons(void); HICON LoadIconEx(int iIndex, bool big = false);
HANDLE GetIconHandle(int iconId);
-//tools.cpp
-int __stdcall WCCmp(const wchar_t* wild, const wchar_t* string);
-char* __stdcall IrcLoadFile(wchar_t * szPath);
-CMStringW __stdcall GetWord(const wchar_t* text, int index);
+// tools.cpp
+int __stdcall WCCmp(const wchar_t* wild, const wchar_t* string);
+char* __stdcall IrcLoadFile(wchar_t * szPath);
+CMStringW __stdcall GetWord(const wchar_t* text, int index);
const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index);
-void __stdcall RemoveLinebreaks(CMStringW& Message);
+void __stdcall RemoveLinebreaks(CMStringW& Message);
wchar_t* __stdcall my_strstri(const wchar_t *s1, const wchar_t *s2);
wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplacePercent);
-CMStringA __stdcall GetWord(const char* text, int index);
+CMStringA __stdcall GetWord(const char* text, int index);
#pragma comment(lib,"comctl32.lib")
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index bb15968d86..6cc998712c 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -638,9 +638,6 @@ DWORD_PTR __cdecl CIcqProto::GetCaps(int type, MCONTACT hContact) case PFLAG_UNIQUEIDTEXT:
return (DWORD_PTR)Translate("User ID");
- case PFLAG_UNIQUEIDSETTING:
- return (DWORD_PTR)UNIQUEIDSETTING;
-
case PFLAG_MAXLENOFMESSAGE:
return MAX_MESSAGESNACSIZE - 102;
diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h index 08fff03c9e..0adec2a619 100644 --- a/protocols/IcqOscarJ/src/icq_proto.h +++ b/protocols/IcqOscarJ/src/icq_proto.h @@ -899,7 +899,9 @@ struct CMPlugin : public ACCPROTOPLUGIN<CIcqProto> {
CMPlugin() :
ACCPROTOPLUGIN<CIcqProto>(ICQ_PROTOCOL_NAME)
- {}
+ {
+ SetUniqueId(UNIQUEIDSETTING);
+ }
};
#endif
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index f2c0e992d7..421868087e 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -598,8 +598,6 @@ DWORD_PTR __cdecl CJabberProto::GetCaps(int type, MCONTACT hContact) return PF4_FORCEAUTH | PF4_NOCUSTOMAUTH | PF4_NOAUTHDENYREASON | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_FORCEADDED;
case PFLAG_UNIQUEIDTEXT:
return (DWORD_PTR)Translate("JID");
- case PFLAG_UNIQUEIDSETTING:
- return (DWORD_PTR)"jid";
case PFLAG_MAXCONTACTSPERPACKET:
wchar_t szClientJid[JABBER_MAX_JID_LEN];
if (GetClientJID(hContact, szClientJid, _countof(szClientJid))) {
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 15ce0aeb26..a90d65494a 100755 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -937,7 +937,9 @@ struct CMPlugin : public ACCPROTOPLUGIN<CJabberProto> {
CMPlugin() :
ACCPROTOPLUGIN<CJabberProto>("JABBER")
- {}
+ {
+ SetUniqueId("jid");
+ }
};
#endif
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 89f2046dae..819587e4e6 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -271,9 +271,6 @@ DWORD_PTR CMraProto::GetCaps(int type, MCONTACT) case PFLAG_MAXCONTACTSPERPACKET:
return MRA_MAXCONTACTSPERPACKET;
- case PFLAG_UNIQUEIDSETTING:
- return (INT_PTR)"e-mail";
-
case PFLAG_MAXLENOFMESSAGE:
return MRA_MAXLENOFMESSAGE;
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index b6f2bede82..be0302ea39 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -344,5 +344,7 @@ struct CMPlugin : public ACCPROTOPLUGIN<CMraProto> {
CMPlugin() :
ACCPROTOPLUGIN<CMraProto>("MRA")
- {}
+ {
+ SetUniqueId("e-mail");
+ }
};
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index d631d6b1af..0a7103ebd3 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -649,9 +649,6 @@ DWORD_PTR __cdecl CMsnProto::GetCaps(int type, MCONTACT) case PFLAG_UNIQUEIDTEXT:
return (UINT_PTR)Translate("Live ID");
- case PFLAG_UNIQUEIDSETTING:
- return (UINT_PTR)"wlid";
-
case PFLAG_MAXLENOFMESSAGE:
return 1202;
diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h index ece0e0d6a2..3f9af6c5d3 100644 --- a/protocols/MSN/src/msn_proto.h +++ b/protocols/MSN/src/msn_proto.h @@ -496,7 +496,9 @@ struct CMPlugin : public ACCPROTOPLUGIN<CMsnProto> {
CMPlugin() :
ACCPROTOPLUGIN<CMsnProto>("MSN")
- {}
+ {
+ SetUniqueId("wlid");
+ }
};
#endif
diff --git a/protocols/MinecraftDynmap/src/proto.cpp b/protocols/MinecraftDynmap/src/proto.cpp index b81b21d479..ea486cc3a7 100644 --- a/protocols/MinecraftDynmap/src/proto.cpp +++ b/protocols/MinecraftDynmap/src/proto.cpp @@ -90,8 +90,6 @@ DWORD_PTR MinecraftDynmapProto::GetCaps(int type, MCONTACT) return MINECRAFTDYNMAP_MESSAGE_LIMIT; case PFLAG_UNIQUEIDTEXT: return (DWORD_PTR) Translate("Visible name"); - case PFLAG_UNIQUEIDSETTING: - return (DWORD_PTR) "Nick"; } return 0; } diff --git a/protocols/MinecraftDynmap/src/proto.h b/protocols/MinecraftDynmap/src/proto.h index 15be7bac17..1a19f2eae4 100644 --- a/protocols/MinecraftDynmap/src/proto.h +++ b/protocols/MinecraftDynmap/src/proto.h @@ -135,5 +135,7 @@ struct CMPlugin : public ACCPROTOPLUGIN<MinecraftDynmapProto> { CMPlugin() : ACCPROTOPLUGIN<MinecraftDynmapProto>("MinecraftDynmap") - {} + { + SetUniqueId("Nick"); + } }; diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index 86207b8a31..60361f1974 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -92,8 +92,6 @@ DWORD_PTR OmegleProto::GetCaps(int type, MCONTACT) return OMEGLE_MESSAGE_LIMIT;
case PFLAG_UNIQUEIDTEXT:
return (DWORD_PTR)Translate("Visible name");
- case PFLAG_UNIQUEIDSETTING:
- return (DWORD_PTR) "Nick";
}
return 0;
}
diff --git a/protocols/Omegle/src/proto.h b/protocols/Omegle/src/proto.h index 332746c792..ee6dd91f9d 100644 --- a/protocols/Omegle/src/proto.h +++ b/protocols/Omegle/src/proto.h @@ -108,5 +108,7 @@ struct CMPlugin : public ACCPROTOPLUGIN<OmegleProto> {
CMPlugin() :
ACCPROTOPLUGIN<OmegleProto>("Omegle")
- {}
+ {
+ SetUniqueId("Nick");
+ }
};
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index 5ff1285790..a7cf8202d2 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -128,8 +128,6 @@ DWORD_PTR CSametimeProto::GetCaps(int type, MCONTACT hContact) return (DWORD_PTR)Translate("ID");
case PFLAG_MAXLENOFMESSAGE:
return MAX_MESSAGE_SIZE;
- case PFLAG_UNIQUEIDSETTING:
- return (DWORD_PTR) "stid";
default:
return 0;
}
diff --git a/protocols/Sametime/src/sametime_proto.h b/protocols/Sametime/src/sametime_proto.h index 0742839875..37c94513c2 100644 --- a/protocols/Sametime/src/sametime_proto.h +++ b/protocols/Sametime/src/sametime_proto.h @@ -197,7 +197,9 @@ struct CMPlugin : public ACCPROTOPLUGIN<CSametimeProto> {
CMPlugin() :
ACCPROTOPLUGIN<CSametimeProto>("Sametime")
- {}
+ {
+ SetUniqueId("stid");
+ }
};
typedef struct tag_TFakeAckParams {
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 3b665b3f0a..459bfe04bf 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -108,8 +108,6 @@ DWORD_PTR CSkypeProto::GetCaps(int type, MCONTACT) return PF4_FORCEADDED | PF4_NOAUTHDENYREASON | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_IMSENDOFFLINE | PF4_OFFLINEFILES; case PFLAG_UNIQUEIDTEXT: return (DWORD_PTR)Translate("Skypename"); - case PFLAG_UNIQUEIDSETTING: - return (DWORD_PTR)SKYPE_SETTINGS_ID; } return 0; } diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 3584fde7c4..d9b7f1ec91 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -426,7 +426,9 @@ struct CMPlugin : public ACCPROTOPLUGIN<CSkypeProto> {
CMPlugin() :
ACCPROTOPLUGIN<CSkypeProto>("SKYPE")
- {}
+ {
+ SetUniqueId(SKYPE_SETTINGS_ID);
+ }
};
#endif //_SKYPE_PROTO_H_
\ No newline at end of file diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index 8a92e60534..fde2920507 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -200,8 +200,6 @@ DWORD_PTR CSteamProto:: GetCaps(int type, MCONTACT) return PF2_HEAVYDND | PF2_OUTTOLUNCH | PF2_FREECHAT; case PFLAG_UNIQUEIDTEXT: return (DWORD_PTR)Translate("SteamID"); - case PFLAG_UNIQUEIDSETTING: - return (DWORD_PTR)"SteamID"; default: return 0; } diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index 93e8aca4be..7638b0d73e 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -278,7 +278,9 @@ struct CMPlugin : public ACCPROTOPLUGIN<CSteamProto> {
CMPlugin() :
ACCPROTOPLUGIN<CSteamProto>("STEAM")
- {}
+ {
+ SetUniqueId("SteamID");
+ }
};
int OnReloadIcons(WPARAM wParam, LPARAM lParam);
diff --git a/protocols/Tox/src/stdafx.h b/protocols/Tox/src/stdafx.h index d6270b9373..aed6d505eb 100644 --- a/protocols/Tox/src/stdafx.h +++ b/protocols/Tox/src/stdafx.h @@ -45,21 +45,6 @@ struct CToxProto; #define now() time(nullptr)
-#include "version.h"
-#include "resource.h"
-#include "tox_menus.h"
-#include "tox_thread.h"
-#include "tox_address.h"
-#include "tox_dialogs.h"
-#include "tox_profile.h"
-#include "tox_options.h"
-#include "tox_transfer.h"
-#include "tox_proto.h"
-
-#include "http_request.h"
-
-extern HINSTANCE g_hInstance;
-
#define MODULE "Tox"
#define TOX_ERROR -1
@@ -92,6 +77,20 @@ extern HINSTANCE g_hInstance; #define TOX_MAX_AVATAR_SIZE 1 << 16 // 2 ^ 16 bytes
+#include "version.h"
+#include "resource.h"
+#include "tox_menus.h"
+#include "tox_thread.h"
+#include "tox_address.h"
+#include "tox_dialogs.h"
+#include "tox_profile.h"
+#include "tox_options.h"
+#include "tox_transfer.h"
+#include "tox_proto.h"
+
+#include "http_request.h"
+
+extern HINSTANCE g_hInstance;
extern HANDLE hProfileFolderPath;
#endif //_COMMON_H_
\ No newline at end of file diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 0de30278a4..f5a169797b 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -56,8 +56,6 @@ DWORD_PTR CToxProto::GetCaps(int type, MCONTACT) return PF4_SINGLEFILEONLY | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_FORCEADDED | PF4_NOAUTHDENYREASON | PF4_FORCEAUTH;
case PFLAG_UNIQUEIDTEXT:
return (INT_PTR)"Tox ID";
- case PFLAG_UNIQUEIDSETTING:
- return (DWORD_PTR)TOX_SETTINGS_ID;
case PFLAG_MAXLENOFMESSAGE:
return TOX_MAX_MESSAGE_LENGTH;
}
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index ac71b30686..4b97cbad9a 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -251,7 +251,9 @@ struct CMPlugin : public ACCPROTOPLUGIN<CToxProto> {
CMPlugin() :
ACCPROTOPLUGIN<CToxProto>("TOX")
- {}
+ {
+ SetUniqueId(TOX_SETTINGS_ID);
+ }
};
#endif //_TOX_PROTO_H_
\ No newline at end of file diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 588c866a0e..615db54869 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -90,8 +90,6 @@ DWORD_PTR TwitterProto::GetCaps(int type, MCONTACT) return 159; // 140 + <max length of a users name (15 apparently)> + 4 ("RT @"). this allows for the new style retweets
case PFLAG_UNIQUEIDTEXT:
return (DWORD_PTR) "Username";
- case PFLAG_UNIQUEIDSETTING:
- return (DWORD_PTR)TWITTER_KEY_UN;
}
return 0;
}
diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h index a73b5caacc..0d5420bdc0 100644 --- a/protocols/Twitter/src/proto.h +++ b/protocols/Twitter/src/proto.h @@ -133,7 +133,9 @@ struct CMPlugin : public ACCPROTOPLUGIN<TwitterProto> {
CMPlugin() :
ACCPROTOPLUGIN<TwitterProto>("Twitter")
- {}
+ {
+ SetUniqueId(TWITTER_KEY_UN);
+ }
};
// TODO: remove this
diff --git a/protocols/VKontakte/src/main.cpp b/protocols/VKontakte/src/main.cpp index 8516360ba0..71e8ddd3cd 100644 --- a/protocols/VKontakte/src/main.cpp +++ b/protocols/VKontakte/src/main.cpp @@ -77,6 +77,8 @@ struct CMPlugin : public ACCPROTOPLUGIN<CVkProto> {
CMPlugin() :
ACCPROTOPLUGIN<CVkProto>("VKontakte")
- {}
+ {
+ SetUniqueId("ID");
+ }
}
g_plugin;
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 4d3505c327..fd27121b4c 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -528,9 +528,6 @@ DWORD_PTR CVkProto::GetCaps(int type, MCONTACT) case PFLAG_UNIQUEIDTEXT:
return (DWORD_PTR)"VKontakte ID";
-
- case PFLAG_UNIQUEIDSETTING:
- return (DWORD_PTR)"ID";
}
return 0;
}
|