summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/delphi/m_protocols.inc31
-rw-r--r--include/delphi/m_protosvc.inc1
-rw-r--r--include/m_plugin.h4
-rw-r--r--include/m_protocols.h12
-rw-r--r--include/m_protosvc.h1
-rw-r--r--libs/win32/mir_app.libbin142962 -> 143728 bytes
-rw-r--r--libs/win64/mir_app.libbin138934 -> 139670 bytes
-rw-r--r--plugins/Actman/iac_contact.pas2
-rw-r--r--plugins/CSList/src/cslist.cpp8
-rw-r--r--plugins/Clist_nicer/src/extBackg.cpp2
-rw-r--r--plugins/ContactsPlus/src/utils.cpp4
-rw-r--r--plugins/DbEditorPP/src/exportimport.cpp12
-rw-r--r--plugins/DbEditorPP/src/main.cpp4
-rw-r--r--plugins/HistoryPlusPlus/hpp_contacts.pas4
-rw-r--r--plugins/Import/src/import.cpp16
-rw-r--r--plugins/ImportTXT/General.pas4
-rw-r--r--plugins/MenuItemEx/src/main.cpp4
-rwxr-xr-xplugins/New_GPG/src/utilities.cpp8
-rw-r--r--plugins/NewsAggregator/Src/NewsAggregator.cpp1
-rw-r--r--plugins/NewsAggregator/Src/Services.cpp2
-rw-r--r--plugins/Quotes/src/Forex.cpp3
-rw-r--r--plugins/SecureIM/src/crypt_lists.cpp3
-rw-r--r--plugins/SeenPlugin/src/utils.cpp8
-rw-r--r--plugins/TipperYM/src/subst.cpp4
-rw-r--r--plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp2
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp23
-rw-r--r--plugins/Utils.pas/mircontacts.pas16
-rw-r--r--plugins/Variables/src/contact.cpp2
-rw-r--r--plugins/Variables/src/parse_miranda.cpp10
-rw-r--r--plugins/Weather/src/weather.cpp1
-rw-r--r--plugins/Weather/src/weather_svcs.cpp4
-rw-r--r--plugins/WebView/src/main.cpp1
-rw-r--r--plugins/WebView/src/webview_services.cpp2
-rw-r--r--plugins/XSoundNotify/src/dialog.cpp4
-rw-r--r--plugins/XSoundNotify/src/options.cpp6
-rw-r--r--plugins/YAMN/src/main.cpp1
-rw-r--r--plugins/YAMN/src/services.cpp2
-rw-r--r--plugins/mRadio/i_service.inc2
-rw-r--r--plugins/mRadio/mradio.dpr2
-rw-r--r--protocols/Discord/src/main.cpp4
-rw-r--r--protocols/Discord/src/proto.cpp2
-rw-r--r--protocols/Dummy/src/dummy_proto.cpp18
-rw-r--r--protocols/Dummy/src/main.cpp8
-rw-r--r--protocols/EmLanProto/src/amdproto.cpp4
-rw-r--r--protocols/FacebookRM/src/proto.cpp2
-rw-r--r--protocols/FacebookRM/src/proto.h4
-rw-r--r--protocols/FacebookRM/src/stdafx.h2
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.h4
-rw-r--r--protocols/ICQCorp/src/corp.cpp1
-rw-r--r--protocols/ICQCorp/src/services.cpp3
-rw-r--r--protocols/IRCG/src/ircproto.cpp3
-rw-r--r--protocols/IRCG/src/ircproto.h432
-rw-r--r--protocols/IRCG/src/stdafx.h419
-rw-r--r--protocols/IcqOscarJ/src/icq_proto.cpp3
-rw-r--r--protocols/IcqOscarJ/src/icq_proto.h4
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.h4
-rw-r--r--protocols/MRA/src/MraProto.cpp3
-rw-r--r--protocols/MRA/src/MraProto.h4
-rw-r--r--protocols/MSN/src/msn_proto.cpp3
-rw-r--r--protocols/MSN/src/msn_proto.h4
-rw-r--r--protocols/MinecraftDynmap/src/proto.cpp2
-rw-r--r--protocols/MinecraftDynmap/src/proto.h4
-rw-r--r--protocols/Omegle/src/proto.cpp2
-rw-r--r--protocols/Omegle/src/proto.h4
-rw-r--r--protocols/Sametime/src/sametime_proto.cpp2
-rw-r--r--protocols/Sametime/src/sametime_proto.h4
-rw-r--r--protocols/SkypeWeb/src/skype_proto.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h4
-rw-r--r--protocols/Steam/src/steam_proto.cpp2
-rw-r--r--protocols/Steam/src/steam_proto.h4
-rw-r--r--protocols/Tox/src/stdafx.h29
-rw-r--r--protocols/Tox/src/tox_proto.cpp2
-rw-r--r--protocols/Tox/src/tox_proto.h4
-rw-r--r--protocols/Twitter/src/proto.cpp2
-rw-r--r--protocols/Twitter/src/proto.h4
-rw-r--r--protocols/VKontakte/src/main.cpp4
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp3
-rw-r--r--src/mir_app/src/clc.cpp4
-rw-r--r--src/mir_app/src/contacts.cpp12
-rw-r--r--src/mir_app/src/meta_edit.cpp2
-rw-r--r--src/mir_app/src/meta_utils.cpp2
-rw-r--r--src/mir_app/src/mir_app.def2
-rw-r--r--src/mir_app/src/mir_app64.def2
-rw-r--r--src/mir_app/src/miranda.h8
-rw-r--r--src/mir_app/src/proto_accs.cpp6
-rw-r--r--src/mir_app/src/proto_chains.cpp2
-rw-r--r--src/mir_app/src/proto_utils.cpp8
-rw-r--r--src/mir_app/src/protocols.cpp49
90 files changed, 691 insertions, 635 deletions
diff --git a/include/delphi/m_protocols.inc b/include/delphi/m_protocols.inc
index e5af3b4189..83deebaf44 100644
--- a/include/delphi/m_protocols.inc
+++ b/include/delphi/m_protocols.inc
@@ -186,8 +186,7 @@ const
NULL if it isn't.
}
-function Proto_IsProtocolLoaded(protoName:PAnsiCHar) : PPROTOCOLDESCRIPTOR; stdcall;
- external AppDLL name 'Proto_IsProtocolLoaded';
+function Proto_IsProtocolLoaded(protoName:PAnsiCHar) : PPROTOCOLDESCRIPTOR; stdcall; external AppDLL;
{ gets the network-level protocol associated with a contact
Returns a AnsiChar* pointing to the asciiz name of the protocol or NULL if the
@@ -195,8 +194,7 @@ function Proto_IsProtocolLoaded(protoName:PAnsiCHar) : PPROTOCOLDESCRIPTOR; stdc
This is the name of the module that actually accesses the network for that
contact. }
-function Proto_GetProtoName(hContact:TMCONTACT) : PAnsiChar; stdcall;
- external AppDLL name 'GetContactProto';
+function Proto_GetProtoName(hContact:TMCONTACT) : PAnsiChar; stdcall; external AppDLL name 'GetContactProto';
{ determines whether the specified contact has the given protocol in its chain
wParam=(WPARAM)(HANDLE)hContact
@@ -260,11 +258,9 @@ type
tagACCOUNT = TPROTOACCOUNT;
//account enumeration service
-procedure Proto_EnumAccounts(var nAccs:int; var pAccs:PPPROTOACCOUNT); stdcall;
- external AppDLL name 'Proto_EnumAccounts';
+procedure Proto_EnumAccounts(var nAccs:int; var pAccs:PPPROTOACCOUNT); stdcall; external AppDLL;
-procedure Proto_EnumProtocols(var nProtos:int; var pProtos:PPPROTOCOLDESCRIPTOR); stdcall;
- external AppDLL name 'Proto_EnumProtocols';
+procedure Proto_EnumProtocols(var nProtos:int; var pProtos:PPPROTOCOLDESCRIPTOR); stdcall; external AppDLL;
type
PACC_CREATE = ^TACC_CREATE;
@@ -286,8 +282,7 @@ const
//lParam=(LPARAM)(AnsiChar*)szAccountName
//return value = PROTOACCOUNT* or NULL
-function Proto_GetAccount(proto:PAnsiChar) : PPROTOACCOUNT; stdcall;
- external AppDLL name 'Proto_GetAccount';
+function Proto_GetAccount(proto:PAnsiChar) : PPROTOACCOUNT; stdcall; external AppDLL;
(*
__inline PROTOACCOUNT* ProtoGetAccount( const AnsiChar* accName )
@@ -321,8 +316,7 @@ const
Returns 1 if an account is valid and enabled, 0 otherwise
}
-function Proto_IsAccountEnabled(proto:PPROTOACCOUNT) : byte; stdcall;
- external AppDLL name 'Proto_IsAccountEnabled';
+function Proto_IsAccountEnabled(proto:PPROTOACCOUNT) : byte; stdcall; external AppDLL;
{
determines if an account is locked or not
@@ -331,8 +325,7 @@ function Proto_IsAccountEnabled(proto:PPROTOACCOUNT) : byte; stdcall;
Returns 1 if an account is locked and not supposed to change status, 0 otherwise
}
-function Proto_IsAccountLocked(proto:PPROTOACCOUNT) : byte; stdcall;
- external AppDLL name 'Proto_IsAccountLocked';
+function Proto_IsAccountLocked(proto:PPROTOACCOUNT) : byte; stdcall; external AppDLL;
{
gets the account associated with a contact
@@ -341,8 +334,14 @@ function Proto_IsAccountLocked(proto:PPROTOACCOUNT) : byte; stdcall;
This is the name of the module that actually accesses the network for that contact.
}
-function Proto_GetBaseAccountName(hContact:TMCONTACT) : PAnsiChar; stdcall;
- external AppDLL name 'Proto_GetBaseAccountName';
+function Proto_GetBaseAccountName(hContact:TMCONTACT) : PAnsiChar; stdcall; external AppDLL;
+
+{
+ gets and sets unique id name of any contact
+}
+
+function Proto_GetUniqueId(proto:PAnsiChar) : PAnsiChar; stdcall; external AppDLL;
+procedure Proto_SetUniqueId(proto, id:PAnsiChar); stdcall; external AppDLL;
// -------------- avatar support ---------------------
{
diff --git a/include/delphi/m_protosvc.inc b/include/delphi/m_protosvc.inc
index 73bc565a72..1e6296d3b3 100644
--- a/include/delphi/m_protosvc.inc
+++ b/include/delphi/m_protosvc.inc
@@ -133,7 +133,6 @@ const
PFLAG_UNIQUEIDTEXT = 100; // returns a static buffer of text describing the unique field by which this protocol identifies users (already translated), or NULL
PFLAG_MAXCONTACTSPERPACKET = 200; // v0.1.2.2+: returns the maximum number of contacts which can be sent in a single PSS_CONTACTS. lParam=(LPARAM)hContact.
- PFLAG_UNIQUEIDSETTING = 300; // v0.3+: returns the DB setting name (e.g. szProto=ICQ, szSetting=UIN) that has the ID which makes this user unique on that system (0.3a ONLY), the string is statically allocated so no need to free()
PFLAG_MAXLENOFMESSAGE = 400; // v0.3.2+: return the maximum length of an instant message, lParam=(LPARAM)hContact
{
A protocol might not support this cap, it allows a protocol to say that PFLAGNUM_2 is for
diff --git a/include/m_plugin.h b/include/m_plugin.h
index 233e03a432..592aa565bf 100644
--- a/include/m_plugin.h
+++ b/include/m_plugin.h
@@ -17,6 +17,10 @@ protected:
// pass one of PROTOTYPE_* constants as type
void RegisterProtocol(int type, pfnInitProto = nullptr, pfnUninitProto = nullptr);
+ __forceinline void SetUniqueId(const char *pszUniqueId)
+ {
+ ::Proto_SetUniqueId(m_szModuleName, pszUniqueId);
+ }
public:
void debugLogA(LPCSTR szFormat, ...);
diff --git a/include/m_protocols.h b/include/m_protocols.h
index a7e13ffab1..cee4513363 100644
--- a/include/m_protocols.h
+++ b/include/m_protocols.h
@@ -211,6 +211,16 @@ EXTERN_C MIR_APP_DLL(void) Proto_EnumProtocols(int *nProtos, PROTOCOLDESCRIPTOR
EXTERN_C MIR_APP_DLL(PROTOCOLDESCRIPTOR*) Proto_IsProtocolLoaded(const char *szProtoName);
/////////////////////////////////////////////////////////////////////////////////////////
+// gets a name of a variable inside a protocol's module that identifies a contact
+
+EXTERN_C MIR_APP_DLL(const char*) Proto_GetUniqueId(const char *szModuleName);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// sets a name of a variable inside a protocol's module that identifies a contact
+
+EXTERN_C MIR_APP_DLL(void) Proto_SetUniqueId(const char *szProtoName, const char *szUniqueId);
+
+/////////////////////////////////////////////////////////////////////////////////////////
// gets the network-level protocol associated with a contact
// Returns a char* pointing to the asciiz name of the protocol or NULL if the
// contact has no protocol. There is no need to free() it or anything.
@@ -283,6 +293,8 @@ typedef struct tagACCOUNT
int iOrder; // account order in various menus & lists
PROTO_INTERFACE *ppro; // pointer to the underlying object
+
+ char* szUniqueId; // setting's unique id for any contact in the account
}
PROTOACCOUNT;
diff --git a/include/m_protosvc.h b/include/m_protosvc.h
index 723b7260ae..0709e5b542 100644
--- a/include/m_protosvc.h
+++ b/include/m_protosvc.h
@@ -151,7 +151,6 @@ static __inline unsigned long Proto_Status2Flag(int status)
#define PFLAG_UNIQUEIDTEXT 100 // returns a static buffer of text describing the unique field by which this protocol identifies users (already translated), or NULL
#define PFLAG_MAXCONTACTSPERPACKET 200 // returns the maximum number of contacts which can be sent in a single PSS_CONTACTS, lParam = (LPARAM)hContact.
-#define PFLAG_UNIQUEIDSETTING 300 // returns the setting name of where the unique id is stored
#define PFLAG_MAXLENOFMESSAGE 400 // return the maximum length of an instant message, lParam = (LPARAM)hContact
///////////////////////////////////////////////////////////////////////////////
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 4cc21599c5..7ce264876d 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index a9c9c37fe0..547147bfd8 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/plugins/Actman/iac_contact.pas b/plugins/Actman/iac_contact.pas
index 02931f7ae9..ffcfd47bd5 100644
--- a/plugins/Actman/iac_contact.pas
+++ b/plugins/Actman/iac_contact.pas
@@ -115,7 +115,7 @@ begin
end
else
begin
- uid:=pAnsiChar(CallProtoService(proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0));
+ uid:=Proto_GetUniqueId(proto);
if DBReadSetting(hContact,proto,uid,@cws)=0 then
begin
result:=1;
diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp
index 2bc27345bb..a63999c415 100644
--- a/plugins/CSList/src/cslist.cpp
+++ b/plugins/CSList/src/cslist.cpp
@@ -70,8 +70,8 @@ static int OnDbChanged(WPARAM hContact, LPARAM lparam)
// if user changes his UIN or JID on any account
if (hContact == NULL) {
- INT_PTR szUniqueID = CallProtoService(cws->szModule, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (szUniqueID != CALLSERVICE_NOTFOUND && !mir_strcmp(cws->szSetting, (char*)szUniqueID))
+ const char *szUniqueID = Proto_GetUniqueId(cws->szModule);
+ if (!mir_strcmp(cws->szSetting, szUniqueID))
pcli->pfnReloadProtoMenus();
}
return 0;
@@ -322,7 +322,7 @@ void CSWindow::initIcons()
if (pdescr == nullptr)
return;
- char *szUniqueID = (char*)CallProtoService(m_protoName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ const char *szUniqueID = Proto_GetUniqueId(m_protoName);
if (szUniqueID == nullptr)
return;
@@ -472,7 +472,7 @@ void CSAMWindow::setCombo()
if (pdescr == nullptr)
return;
- char *szUniqueID = (char*)CallProtoService(pdescr->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ const char *szUniqueID = Proto_GetUniqueId(pdescr->szModuleName);
if (szUniqueID == nullptr)
return;
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp
index 57a70373d5..7b8ff8a8ff 100644
--- a/plugins/Clist_nicer/src/extBackg.cpp
+++ b/plugins/Clist_nicer/src/extBackg.cpp
@@ -1286,7 +1286,7 @@ void LoadPerContactSkins(wchar_t *tszFileName)
if (szProto == nullptr)
continue;
- char *uid = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ const char *uid = Proto_GetUniqueId(szProto);
if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid != nullptr) {
DBVARIANT dbv = { 0 };
if (db_get(hContact, szProto, uid, &dbv))
diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp
index acc2c47a16..35608b4b86 100644
--- a/plugins/ContactsPlus/src/utils.cpp
+++ b/plugins/ContactsPlus/src/utils.cpp
@@ -58,8 +58,8 @@ char* __fastcall null_strdup(const char *string)
wchar_t* GetContactUID(MCONTACT hContact)
{
char *szProto = GetContactProto(hContact);
- char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (INT_PTR(uid) == CALLSERVICE_NOTFOUND || uid == nullptr)
+ const char *uid = Proto_GetUniqueId(szProto);
+ if (uid == nullptr)
return nullptr;
DBVARIANT vrUid;
diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp
index 6ae2f27626..b7a404c980 100644
--- a/plugins/DbEditorPP/src/exportimport.cpp
+++ b/plugins/DbEditorPP/src/exportimport.cpp
@@ -124,8 +124,8 @@ char* NickFromHContact(MCONTACT hContact)
mir_strncpy(nick, name, _countof(nick));
}
else {
- char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) {
+ const char *uid = Proto_GetUniqueId(szProto);
+ if (uid) {
char szUID[FLD_SIZE];
GetValueA(hContact, szProto, uid, szUID, _countof(szUID));
mir_snprintf(nick, "%s *(%s)*<%s>*{%s}*", name, szProto, uid, szUID);
@@ -316,13 +316,7 @@ void importSettings(MCONTACT hContact, char *utf8)
if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < _countof(szProto)) {
strncpy(szProto, p1 + 1, p2 - p1 - 3);
-
- char *protouid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if ((INT_PTR)protouid != CALLSERVICE_NOTFOUND) {
- if (!mir_strcmp(protouid, uid))
- hContact = CheckNewContact(szProto, uid, szUID);
- }
- else hContact = CheckNewContact(szProto, uid, szUID);
+ hContact = CheckNewContact(szProto, uid, szUID);
}
}
}
diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp
index 9974bcc60c..f72c886360 100644
--- a/plugins/DbEditorPP/src/main.cpp
+++ b/plugins/DbEditorPP/src/main.cpp
@@ -458,8 +458,8 @@ int GetContactName(MCONTACT hContact, const char *proto, wchar_t *value, int max
case 5: // Unique id
if (szProto) {
// protocol must define a PFLAG_UNIQUEIDSETTING
- char *uid = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid)
+ const char *uid = Proto_GetUniqueId(szProto);
+ if (uid)
GetValue(hContact, szProto, uid, name, _countof(name));
}
break;
diff --git a/plugins/HistoryPlusPlus/hpp_contacts.pas b/plugins/HistoryPlusPlus/hpp_contacts.pas
index 331efce404..58386f658a 100644
--- a/plugins/HistoryPlusPlus/hpp_contacts.pas
+++ b/plugins/HistoryPlusPlus/hpp_contacts.pas
@@ -129,8 +129,8 @@ begin
begin
if Proto = '' then
Proto := GetContactProto(hContact);
- uid := PAnsiChar(CallProtoService(PAnsiChar(Proto), PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0));
- if (uid <> pAnsiChar(CALLSERVICE_NOTFOUND)) and (uid <> nil) then
+ uid := Proto_GetUniqueId(PAnsiChar(Proto));
+ if uid <> nil then
begin
if db_get(hContact, PAnsiChar(Proto), uid, @dbv) = 0 then
begin
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp
index 84a02428d1..6ca7d031bb 100644
--- a/plugins/Import/src/import.cpp
+++ b/plugins/Import/src/import.cpp
@@ -146,7 +146,7 @@ static MCONTACT HContactFromChatID(char *pszProtoName, const wchar_t *pszChatID)
return INVALID_CONTACT_ID;
}
-static MCONTACT HContactFromNumericID(char *pszProtoName, char *pszSetting, DWORD dwID)
+static MCONTACT HContactFromNumericID(char *pszProtoName, const char *pszSetting, DWORD dwID)
{
for (MCONTACT hContact = dstDb->FindFirstContact(pszProtoName); hContact; hContact = dstDb->FindNextContact(hContact, pszProtoName))
if (db_get_dw(hContact, pszProtoName, pszSetting, 0) == dwID)
@@ -155,7 +155,7 @@ static MCONTACT HContactFromNumericID(char *pszProtoName, char *pszSetting, DWOR
return INVALID_CONTACT_ID;
}
-static MCONTACT HContactFromID(char *pszProtoName, char *pszSetting, wchar_t *pwszID)
+static MCONTACT HContactFromID(char *pszProtoName, const char *pszSetting, wchar_t *pwszID)
{
for (MCONTACT hContact = dstDb->FindFirstContact(pszProtoName); hContact; hContact = dstDb->FindNextContact(hContact, pszProtoName)) {
ptrW id(db_get_wsa(hContact, pszProtoName, pszSetting));
@@ -401,8 +401,8 @@ static PROTOACCOUNT* FindMyAccount(const char *szProto, const char *szBaseProto,
if (ptszName && !mir_wstrcmp(pa->tszAccountName, ptszName))
return pa;
- char *pszUniqueSetting = (char*)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (!pszUniqueSetting || INT_PTR(pszUniqueSetting) == CALLSERVICE_NOTFOUND) {
+ const char *pszUniqueSetting = Proto_GetUniqueId(pa->szModuleName);
+ if (!pszUniqueSetting) {
pProto = pa;
continue;
}
@@ -542,7 +542,7 @@ static MCONTACT MapContact(MCONTACT hSrc)
return (pDestContact == nullptr) ? INVALID_CONTACT_ID : pDestContact->dstID;
}
-static MCONTACT AddContact(char *szProto, char *pszUniqueSetting, DBVARIANT *id, const wchar_t *pszUserID, wchar_t *nick, wchar_t *group)
+static MCONTACT AddContact(char *szProto, const char *pszUniqueSetting, DBVARIANT *id, const wchar_t *pszUserID, wchar_t *nick, wchar_t *group)
{
MCONTACT hContact = db_add_contact();
if (Proto_AddToContact(hContact, szProto) != 0) {
@@ -798,14 +798,14 @@ static MCONTACT ImportContact(MCONTACT hSrc)
}
// group chat?
- char *pszUniqueSetting;
+ const char *pszUniqueSetting;
bool bIsChat = myGetD(hSrc, cc->szProto, "ChatRoom", 0) != 0;
if (bIsChat)
pszUniqueSetting = "ChatRoomID";
else {
// Skip protocols with no unique id setting (some non IM protocols return NULL)
- pszUniqueSetting = (char*)CallProtoService(pda->pa->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (!pszUniqueSetting || (INT_PTR)pszUniqueSetting == CALLSERVICE_NOTFOUND) {
+ pszUniqueSetting = Proto_GetUniqueId(pda->pa->szModuleName);
+ if (!pszUniqueSetting) {
AddMessage(LPGENW("Skipping non-IM contact (%S)"), cc->szProto);
return NULL;
}
diff --git a/plugins/ImportTXT/General.pas b/plugins/ImportTXT/General.pas
index 0a53d03ffc..76a25be9ae 100644
--- a/plugins/ImportTXT/General.pas
+++ b/plugins/ImportTXT/General.pas
@@ -354,8 +354,8 @@ begin
begin
if proto = '' then
proto := GetContactProto(hContact);
- uid := PAnsiChar(CallProtoService(PAnsiChar(proto), PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0));
- if (uid <> pAnsiChar(CALLSERVICE_NOTFOUND)) and (uid <> nil) then
+ uid := Proto_GetUniqueId(PAnsiChar(proto));
+ if uid <> nil then
begin
if db_get(hContact, PAnsiChar(proto), uid, @dbv) = 0 then
begin
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp
index f6238d5cfb..067857dd7b 100644
--- a/plugins/MenuItemEx/src/main.cpp
+++ b/plugins/MenuItemEx/src/main.cpp
@@ -260,9 +260,7 @@ BOOL isMetaContact(MCONTACT hContact)
void GetID(MCONTACT hContact, LPSTR szProto, LPSTR szID, size_t dwIDSize)
{
DBVARIANT dbv_uniqueid;
- LPSTR uID = (LPSTR)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (uID == (LPSTR)CALLSERVICE_NOTFOUND)
- uID = nullptr;
+ LPCSTR uID = Proto_GetUniqueId(szProto);
szID[0] = 0;
if (uID && db_get(hContact, szProto, uID, &dbv_uniqueid) == 0) {
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index 7ec25605b9..27eef26991 100755
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -1263,9 +1263,9 @@ void ExportGpGKeysFunc(int type)
mir_free(k);
}
- const char* proto = (const char*)GetContactProto(hContact);
+ const char *proto = GetContactProto(hContact);
std::string id = "Comment: login ";
- const char * uid = (const char*)CallProtoService(proto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0);
+ const char *uid = Proto_GetUniqueId(proto);
DBVARIANT dbv = { 0 };
db_get(0, proto, uid, &dbv);
switch (dbv.type) {
@@ -1467,7 +1467,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM)
for (int i = 0; i < acc_count; i++) {
if (acc.length())
break;
- const char * uid = (const char*)CallProtoService(accs[i]->szModuleName, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0);
+ const char *uid = Proto_GetUniqueId(accs[i]->szModuleName);
DBVARIANT dbv = { 0 };
db_get(0, accs[i]->szModuleName, uid, &dbv);
std::string id;
@@ -1532,7 +1532,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM)
}
}
if (acc.length()) {
- const char * uid = (const char*)CallProtoService(acc.c_str(), PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0);
+ const char *uid = Proto_GetUniqueId(acc.c_str());
for (auto &hContact : Contacts(acc.c_str())) {
DBVARIANT dbv = { 0 };
db_get(hContact, acc.c_str(), uid, &dbv);
diff --git a/plugins/NewsAggregator/Src/NewsAggregator.cpp b/plugins/NewsAggregator/Src/NewsAggregator.cpp
index 421fe9666b..d0b1547f22 100644
--- a/plugins/NewsAggregator/Src/NewsAggregator.cpp
+++ b/plugins/NewsAggregator/Src/NewsAggregator.cpp
@@ -112,6 +112,7 @@ struct CMPlugin : public CMPluginBase
CMPluginBase(MODULE)
{
RegisterProtocol(PROTOTYPE_VIRTUAL);
+ SetUniqueId("URL");
}
}
g_plugin;
diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp
index 36e25ba073..bf9030bb6f 100644
--- a/plugins/NewsAggregator/Src/Services.cpp
+++ b/plugins/NewsAggregator/Src/Services.cpp
@@ -83,8 +83,6 @@ INT_PTR NewsAggrGetCaps(WPARAM wp, LPARAM)
return PF4_AVATARS;
case PFLAG_UNIQUEIDTEXT:
return (INT_PTR) "News Feed";
- case PFLAG_UNIQUEIDSETTING:
- return (INT_PTR) "URL";
default:
return 0;
}
diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp
index 7a99cd754d..55c5e6379b 100644
--- a/plugins/Quotes/src/Forex.cpp
+++ b/plugins/Quotes/src/Forex.cpp
@@ -241,8 +241,6 @@ INT_PTR QuoteProtoFunc_GetCaps(WPARAM wParam, LPARAM)
switch (wParam) {
case PFLAG_UNIQUEIDTEXT:
return (INT_PTR)Translate("Quote Symbol");
- case PFLAG_UNIQUEIDSETTING:
- return (INT_PTR)DB_STR_QUOTE_SYMBOL;
}
return 0;
@@ -346,6 +344,7 @@ struct CMPlugin : public CMPluginBase
CMPluginBase(QUOTES_PROTOCOL_NAME)
{
RegisterProtocol(PROTOTYPE_VIRTUAL);
+ SetUniqueId(DB_STR_QUOTE_SYMBOL);
}
}
g_plugin;
diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp
index 29bc80c0b9..5844557134 100644
--- a/plugins/SecureIM/src/crypt_lists.cpp
+++ b/plugins/SecureIM/src/crypt_lists.cpp
@@ -208,8 +208,7 @@ void getContactUinA(MCONTACT hContact, LPSTR szUIN)
return;
DBVARIANT dbv_uniqueid;
- LPSTR uID = (LPSTR)CallProtoService(ptr->name, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (uID == (LPSTR)CALLSERVICE_NOTFOUND) uID = nullptr; // Billy_Bons
+ LPCSTR uID = Proto_GetUniqueId(ptr->name);
if (uID && db_get(hContact, ptr->name, uID, &dbv_uniqueid) == 0) {
if (dbv_uniqueid.type == DBVT_WORD)
sprintf(szUIN, "%u [%s]", dbv_uniqueid.wVal, ptr->name); //!!!!!!!!!!!
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp
index 5537de86dc..22af9a35b4 100644
--- a/plugins/SeenPlugin/src/utils.cpp
+++ b/plugins/SeenPlugin/src/utils.cpp
@@ -70,7 +70,7 @@ int IsWatchedProtocol(const char* szProto)
BOOL isYahoo(char *protoname)
{
if (protoname) {
- char *pszUniqueSetting = (char*)CallProtoService(protoname, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ const char *pszUniqueSetting = Proto_GetUniqueId(protoname);
if (pszUniqueSetting)
return !mir_strcmp(pszUniqueSetting, "yahoo_id");
}
@@ -80,7 +80,7 @@ BOOL isYahoo(char *protoname)
BOOL isJabber(char *protoname)
{
if (protoname) {
- char *pszUniqueSetting = (char*)CallProtoService(protoname, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ const char *pszUniqueSetting = Proto_GetUniqueId(protoname);
if (pszUniqueSetting)
return !mir_strcmp(pszUniqueSetting, "jid");
}
@@ -90,7 +90,7 @@ BOOL isJabber(char *protoname)
BOOL isICQ(char *protoname)
{
if (protoname) {
- char *pszUniqueSetting = (char*)CallProtoService(protoname, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ const char *pszUniqueSetting = Proto_GetUniqueId(protoname);
if (pszUniqueSetting)
return !mir_strcmp(pszUniqueSetting, "UIN");
}
@@ -100,7 +100,7 @@ BOOL isICQ(char *protoname)
BOOL isMSN(char *protoname)
{
if (protoname) {
- char *pszUniqueSetting = (char*)CallProtoService(protoname, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ const char *pszUniqueSetting = Proto_GetUniqueId(protoname);
if (pszUniqueSetting)
return !mir_strcmp(pszUniqueSetting, "e-mail");
}
diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp
index bc153af624..e50a1c808a 100644
--- a/plugins/TipperYM/src/subst.cpp
+++ b/plugins/TipperYM/src/subst.cpp
@@ -142,8 +142,8 @@ bool Uid(MCONTACT hContact, char *szProto, wchar_t *buff, int bufflen)
{
char *tmpProto = (hContact ? GetContactProto(hContact) : szProto);
if (tmpProto) {
- char *szUid = (char*)CallProtoService(tmpProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (szUid && (INT_PTR)szUid != CALLSERVICE_NOTFOUND)
+ const char *szUid = Proto_GetUniqueId(tmpProto);
+ if (szUid)
return DBGetContactSettingAsString(hContact, tmpProto, szUid, buff, bufflen);
}
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
index 23c19e0e3d..bd1829e228 100644
--- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
+++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
@@ -113,7 +113,7 @@ BYTE CExImContactBase::fromDB(MCONTACT hContact)
}
// unique id (normal)
else {
- uidSetting = (LPCSTR)CallProtoService(pszProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ uidSetting = Proto_GetUniqueId(pszProto);
// valid
if (uidSetting != nullptr && (INT_PTR)uidSetting != CALLSERVICE_NOTFOUND) {
_pszUIDKey = mir_strdup(uidSetting);
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp
index 38e55fceec..eab2949fe4 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp
@@ -1074,26 +1074,19 @@ BYTE CVCardFileVCF::Export(BYTE bExportUtf)
//
// contacts protocol, uin setting, uin value
//
- {
+ LPCSTR uid = Proto_GetUniqueId(_pszBaseProto);
+ if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) {
CHAR szUID[MAXUID];
- LPCSTR uid;
-
- uid = (LPCSTR)CallProtoService(_pszBaseProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) {
- if (!db_get_static(_hContact, _pszBaseProto, uid, szUID, sizeof(szUID)))
- fprintf(_pFile, "IM;%s;%s:%s\n", _pszBaseProto, uid, szUID);
- }
+ if (!db_get_static(_hContact, _pszBaseProto, uid, szUID, sizeof(szUID)))
+ fprintf(_pFile, "IM;%s;%s:%s\n", _pszBaseProto, uid, szUID);
}
-
+
//
// time of creation
//
- {
- SYSTEMTIME st;
-
- GetLocalTime(&st);
- fprintf(_pFile, "REV:%04d%02d%02dD%02d%02d%02dT\n", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
- }
+ SYSTEMTIME st;
+ GetLocalTime(&st);
+ fprintf(_pFile, "REV:%04d%02d%02dD%02d%02d%02dT\n", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
fputs("END:VCARD", _pFile);
return 0;
diff --git a/plugins/Utils.pas/mircontacts.pas b/plugins/Utils.pas/mircontacts.pas
index 8847ea96f0..44a8441857 100644
--- a/plugins/Utils.pas/mircontacts.pas
+++ b/plugins/Utils.pas/mircontacts.pas
@@ -127,8 +127,8 @@ begin
begin
if Proto = nil then
Proto := GetContactProto(hContact);
- uid := PAnsiChar(CallProtoService(Proto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0));
- if (uid <> PAnsiChar(CALLSERVICE_NOTFOUND)) and (uid <> nil) then
+ uid := Proto_GetUniqueId(Proto);
+ if (uid <> nil) then
begin
// db_get_s comparing to DBGetContactSetting don't translate strings
// when uType=0 (DBVT_ASIS)
@@ -275,8 +275,8 @@ begin
uid:=nil;
if not is_chat then
begin
- uid:=PAnsiChar(CallProtoService(Proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0));
- if uid=PAnsiChar(CALLSERVICE_NOTFOUND) then exit;
+ uid:=Proto_GetUniqueId(Proto);
+ if uid=nil then exit;
end;
hContact:=db_find_first();
@@ -371,8 +371,8 @@ begin
end
else
begin
- uid:=PAnsiChar(CallProtoService(Proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0));
- if uid<>PAnsiChar(CALLSERVICE_NOTFOUND) then
+ uid:=Proto_GetUniqueId(Proto);
+ if uid<>nil then
begin
if DBReadSetting(hContact,Proto,uid,@cws)=0 then
begin
@@ -540,8 +540,8 @@ begin
end
else
begin
- uid:=PAnsiChar(CallProtoService(acc,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0));
- if uid<>PAnsiChar(CALLSERVICE_NOTFOUND) then
+ uid:=Proto_GetUniqueId(acc);
+ if uid<>nil then
begin
if DBReadSetting(hContact,acc,uid,@ldbv)=0 then
begin
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp
index 52ecf66950..6a49e0b4f5 100644
--- a/plugins/Variables/src/contact.cpp
+++ b/plugins/Variables/src/contact.cpp
@@ -309,7 +309,7 @@ static int contactSettingChanged(WPARAM hContact, LPARAM lParam)
if (szProto == nullptr)
return 0;
- char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ const char *uid = Proto_GetUniqueId(szProto);
bool isNick = !strcmp(dbw->szSetting, "Nick");
bool isFirstName = !strcmp(dbw->szSetting, "FirstName");
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp
index 0dad8e92a0..43610db3fc 100644
--- a/plugins/Variables/src/parse_miranda.cpp
+++ b/plugins/Variables/src/parse_miranda.cpp
@@ -343,20 +343,20 @@ static wchar_t* parseProtoInfo(ARGUMENTSINFO *ai)
if (ai->argc != 3)
return nullptr;
- char *szRes = nullptr;
+ const char *szRes = nullptr;
wchar_t *tszRes = nullptr;
ptrA szProto(mir_u2a(ai->targv[1]));
if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PINAME)))
tszRes = Hlp_GetProtocolName(szProto);
else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PIUIDTEXT))) {
- szRes = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDTEXT, 0);
- if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND)
+ szRes = (const char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDTEXT, 0);
+ if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND || szRes == nullptr)
return nullptr;
}
else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PIUIDSETTING))) {
- szRes = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0);
- if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND)
+ szRes = Proto_GetUniqueId(szProto);
+ if (szRes == nullptr)
return nullptr;
}
else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PINICK)))
diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp
index 1a01b18802..00ceba9e93 100644
--- a/plugins/Weather/src/weather.cpp
+++ b/plugins/Weather/src/weather.cpp
@@ -241,6 +241,7 @@ struct CMPlugin : public CMPluginBase
{
opt.NoProtoCondition = db_get_b(NULL, WEATHERPROTONAME, "NoStatus", true);
RegisterProtocol((opt.NoProtoCondition) ? PROTOTYPE_VIRTUAL : PROTOTYPE_PROTOCOL);
+ SetUniqueId("ID");
}
}
g_plugin;
diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp
index 83521bb0d5..194975bd4a 100644
--- a/plugins/Weather/src/weather_svcs.cpp
+++ b/plugins/Weather/src/weather_svcs.cpp
@@ -79,10 +79,6 @@ INT_PTR WeatherGetCaps(WPARAM wParam, LPARAM)
case PFLAG_UNIQUEIDTEXT:
ret = (INT_PTR)Translate("Station ID");
break;
-
- case PFLAG_UNIQUEIDSETTING:
- ret = (INT_PTR)"ID";
- break;
}
return ret;
}
diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp
index 712dc64f0c..ae13134832 100644
--- a/plugins/WebView/src/main.cpp
+++ b/plugins/WebView/src/main.cpp
@@ -292,6 +292,7 @@ struct CMPlugin : public CMPluginBase
CMPluginBase(MODULENAME)
{
RegisterProtocol(PROTOTYPE_PROTOCOL);
+ SetUniqueId("PreserveName");
}
}
g_plugin;
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp
index 6a3197e425..3d0f27c556 100644
--- a/plugins/WebView/src/webview_services.cpp
+++ b/plugins/WebView/src/webview_services.cpp
@@ -211,8 +211,6 @@ INT_PTR GetCaps(WPARAM wParam, LPARAM)
return PF2_INVISIBLE|PF2_SHORTAWAY|PF2_LONGAWAY|PF2_LIGHTDND|PF2_HEAVYDND|PF2_FREECHAT|PF2_OUTTOLUNCH|PF2_ONTHEPHONE;
case PFLAG_UNIQUEIDTEXT:
return (INT_PTR)Translate("Site URL");
- case PFLAG_UNIQUEIDSETTING:
- return (INT_PTR)"PreserveName";
default:
return 0;
}
diff --git a/plugins/XSoundNotify/src/dialog.cpp b/plugins/XSoundNotify/src/dialog.cpp
index 8c1dafa8de..6d96d971e1 100644
--- a/plugins/XSoundNotify/src/dialog.cpp
+++ b/plugins/XSoundNotify/src/dialog.cpp
@@ -24,8 +24,8 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP
Utils_RestoreWindowPositionNoSize(hwndDlg, hContact, SETTINGSNAME, "ChangeSoundDlg");
char* szProto = GetContactProto(hContact);
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- char* szUniqueId = (char*)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if ((INT_PTR)szUniqueId != CALLSERVICE_NOTFOUND && szUniqueId != nullptr) {
+ const char* szUniqueId = Proto_GetUniqueId(pa->szModuleName);
+ if (szUniqueId != nullptr) {
DBVARIANT dbvuid = { 0 };
if (!db_get(hContact, pa->szModuleName, szUniqueId, &dbvuid)) {
wchar_t uid[MAX_PATH];
diff --git a/plugins/XSoundNotify/src/options.cpp b/plugins/XSoundNotify/src/options.cpp
index ef8eb7c084..cc8f91796b 100644
--- a/plugins/XSoundNotify/src/options.cpp
+++ b/plugins/XSoundNotify/src/options.cpp
@@ -52,12 +52,12 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_SETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_ADDSTRING, 0, (LPARAM)TranslateT("All contacts")), cursel);
for (auto &hContact : Contacts()) {
- char *szUniqueId = nullptr;
+ const char *szUniqueId;
if (db_get_b(hContact, pa->szModuleName, "ChatRoom", 0))
szUniqueId = "ChatRoomID";
else
- szUniqueId = (char*)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if ((INT_PTR)szUniqueId != CALLSERVICE_NOTFOUND && szUniqueId != nullptr) {
+ szUniqueId = Proto_GetUniqueId(pa->szModuleName);
+ if (szUniqueId != nullptr) {
DBVARIANT dbvuid = { 0 };
if (!db_get(hContact, pa->szModuleName, szUniqueId, &dbvuid)) {
wchar_t uid[MAX_PATH];
diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp
index 1e5a26ecb9..edfbf9c6ec 100644
--- a/plugins/YAMN/src/main.cpp
+++ b/plugins/YAMN/src/main.cpp
@@ -368,6 +368,7 @@ struct CMPlugin : public CMPluginBase
CMPluginBase(YAMN_DBMODULE)
{
RegisterProtocol(PROTOTYPE_VIRTUAL);
+ SetUniqueId("Id");
}
}
g_plugin;
diff --git a/plugins/YAMN/src/services.cpp b/plugins/YAMN/src/services.cpp
index c667d3df4a..d6d4cb6a9e 100644
--- a/plugins/YAMN/src/services.cpp
+++ b/plugins/YAMN/src/services.cpp
@@ -8,8 +8,6 @@ static INT_PTR Service_GetCaps(WPARAM wParam, LPARAM)
return (INT_PTR) Translate("Nick");
if (wParam == PFLAG_MAXLENOFMESSAGE)
return 400;
- if (wParam == PFLAG_UNIQUEIDSETTING)
- return (INT_PTR) "Id";
if (wParam == PFLAGNUM_2)
return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND;
if (wParam == PFLAGNUM_5) {
diff --git a/plugins/mRadio/i_service.inc b/plugins/mRadio/i_service.inc
index 9b953c40e7..894392716d 100644
--- a/plugins/mRadio/i_service.inc
+++ b/plugins/mRadio/i_service.inc
@@ -13,8 +13,6 @@ begin
result:=PF4_NOCUSTOMAUTH or PF4_AVATARS;
PFLAG_UNIQUEIDTEXT:
result:=int_ptr(Translate('Radio station URL'));
- PFLAG_UNIQUEIDSETTING:
- result:=int_ptr(optStationURL)
else
result:=0;
end
diff --git a/plugins/mRadio/mradio.dpr b/plugins/mRadio/mradio.dpr
index 9f55ee4f2b..a61dae29c5 100644
--- a/plugins/mRadio/mradio.dpr
+++ b/plugins/mRadio/mradio.dpr
@@ -211,5 +211,7 @@ begin
desc._type :=PROTOTYPE_VIRTUAL;
Proto_RegisterModule(@desc);
+ Proto_SetUniqueId(PluginName,optStationURL);
+
DisableThreadLibraryCalls(hInstance);
end.
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;
}
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp
index 8ece944316..6fb781a2b8 100644
--- a/src/mir_app/src/clc.cpp
+++ b/src/mir_app/src/clc.cpp
@@ -106,8 +106,8 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam)
// something is being written to a protocol module
if (!strcmp(szProto, cws->szModule)) {
// was a unique setting key written?
- char *id = (char *)CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if ((INT_PTR)id != CALLSERVICE_NOTFOUND && id != nullptr && !strcmp(id, cws->szSetting))
+ const char *id = Proto_GetUniqueId(szProto);
+ if (id != nullptr && !strcmp(id, cws->szSetting))
Clist_Broadcast(INTM_PROTOCHANGED, hContact, lParam);
}
}
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp
index 382ef24d8b..b53fb0bcd5 100644
--- a/src/mir_app/src/contacts.cpp
+++ b/src/mir_app/src/contacts.cpp
@@ -95,7 +95,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s
if (szProto == nullptr)
return nullptr;
- char *uid;
+ const char *uid;
wchar_t *res;
DBVARIANT dbv;
switch (type) {
@@ -184,8 +184,8 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s
return mir_wstrdup(buf);
}
- uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid)
+ uid = Proto_GetUniqueId(szProto);
+ if (uid)
return ProcessDatabaseValueDefault(hContact, szProto, uid);
break;
@@ -193,8 +193,8 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s
if (res = ProcessDatabaseValueDefault(hContact, szProto, "display_uid"))
return res;
- uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid)
+ uid = Proto_GetUniqueId(szProto);
+ if (uid)
return ProcessDatabaseValueDefault(hContact, szProto, uid);
break;
@@ -228,7 +228,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s
case 5: // Unique id
// protocol must define a PFLAG_UNIQUEIDSETTING
- uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ uid = Proto_GetUniqueId(szProto);
if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) {
if (!GetDatabaseString(hContact, szProto, uid, &dbv)) {
if (dbv.type == DBVT_BYTE || dbv.type == DBVT_WORD || dbv.type == DBVT_DWORD) {
diff --git a/src/mir_app/src/meta_edit.cpp b/src/mir_app/src/meta_edit.cpp
index 345bd98927..bb233f4ef1 100644
--- a/src/mir_app/src/meta_edit.cpp
+++ b/src/mir_app/src/meta_edit.cpp
@@ -65,7 +65,7 @@ static void FillContactList(HWND hList)
if (szProto) {
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- char *szField = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ const char *szField = Proto_GetUniqueId(szProto);
DBVARIANT dbv;
if (!db_get(g_data.hContact[i], szProto, szField, &dbv)) {
diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp
index 5b590129c0..7a1b8565a0 100644
--- a/src/mir_app/src/meta_utils.cpp
+++ b/src/mir_app/src/meta_utils.cpp
@@ -70,7 +70,7 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default)
}
// Get the login of the subcontact
- char *field = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ const char *field = Proto_GetUniqueId(szProto);
DBVARIANT dbv;
if (db_get(hSub, szProto, field, &dbv)) {
MessageBox(nullptr, TranslateT("Could not get unique ID of contact"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 97445ad173..922fd0e0b5 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -527,3 +527,5 @@ Proto_ActivateAccount @512
?setWord@CMPluginBase@@QAEXPBDG@Z @545 NONAME
?tryOpenLog@CMPluginBase@@AAEXXZ @546 NONAME
?RegisterProtocol@CMPluginBase@@IAEXHP6APAUPROTO_INTERFACE@@PBDPB_W@ZP6AHPAU2@@Z@Z @547 NONAME
+Proto_GetUniqueId @548
+Proto_SetUniqueId @549
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index fbc4904145..8456025d4e 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -527,3 +527,5 @@ Proto_ActivateAccount @512
?setWord@CMPluginBase@@QEAAXPEBDG@Z @545 NONAME
?tryOpenLog@CMPluginBase@@AEAAXXZ @546 NONAME
?RegisterProtocol@CMPluginBase@@IEAAXHP6APEAUPROTO_INTERFACE@@PEBDPEB_W@ZP6AHPEAU2@@Z@Z @547 NONAME
+Proto_GetUniqueId @548
+Proto_SetUniqueId @549
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h
index 5cad812460..36b14b2022 100644
--- a/src/mir_app/src/miranda.h
+++ b/src/mir_app/src/miranda.h
@@ -134,7 +134,13 @@ extern OBJLIST<CListEvent> g_cliEvents;
#define OFFSET_NAME 800
extern LIST<PROTOACCOUNT> accounts;
-extern LIST<PROTOCOLDESCRIPTOR> protos;
+
+struct MBaseProto : public PROTOCOLDESCRIPTOR
+{
+ char *szUniqueId; // name of the unique setting that identifies a contact
+};
+
+extern LIST<MBaseProto> protos, filters;
INT_PTR ProtoCallService(const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam);
diff --git a/src/mir_app/src/proto_accs.cpp b/src/mir_app/src/proto_accs.cpp
index 6319a270fd..163e693527 100644
--- a/src/mir_app/src/proto_accs.cpp
+++ b/src/mir_app/src/proto_accs.cpp
@@ -392,8 +392,10 @@ void UnloadAccount(PROTOACCOUNT *pa, bool bIsDynamic, bool bErase)
{
DeactivateAccount(pa, bIsDynamic, bErase);
- mir_free(pa->tszAccountName);
- mir_free(pa->szProtoName);
+ replaceStrW(pa->tszAccountName, 0);
+ replaceStr(pa->szProtoName, 0);
+ replaceStr(pa->szUniqueId, 0);
+
// szModuleName should be freed only on a program's exit.
// otherwise many plugins dependand on static protocol names will crash!
// do NOT fix this 'leak', please
diff --git a/src/mir_app/src/proto_chains.cpp b/src/mir_app/src/proto_chains.cpp
index 6bfb1df0a9..d405cccae9 100644
--- a/src/mir_app/src/proto_chains.cpp
+++ b/src/mir_app/src/proto_chains.cpp
@@ -24,8 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-extern LIST<PROTOCOLDESCRIPTOR> filters;
-
static int GetProtocolP(MCONTACT hContact, char *szBuf, int cbLen)
{
if (currDb == nullptr)
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp
index 53301d7269..16c094e51b 100644
--- a/src/mir_app/src/proto_utils.cpp
+++ b/src/mir_app/src/proto_utils.cpp
@@ -23,12 +23,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-static int CompareProtos(const PROTOCOLDESCRIPTOR *p1, const PROTOCOLDESCRIPTOR *p2)
+static int CompareProtos(const MBaseProto *p1, const MBaseProto *p2)
{
return strcmp(p1->szName, p2->szName);
}
-LIST<PROTOCOLDESCRIPTOR> protos(10, CompareProtos);
+LIST<MBaseProto> protos(10, CompareProtos);
extern HANDLE hAckEvent;
@@ -39,7 +39,7 @@ MIR_APP_DLL(PROTOCOLDESCRIPTOR*) Proto_IsProtocolLoaded(const char *szProtoName)
if (szProtoName == nullptr)
return nullptr;
- PROTOCOLDESCRIPTOR tmp;
+ MBaseProto tmp;
tmp.szName = (char*)szProtoName;
return protos.find(&tmp);
}
@@ -49,7 +49,7 @@ MIR_APP_DLL(PROTOCOLDESCRIPTOR*) Proto_IsProtocolLoaded(const char *szProtoName)
MIR_APP_DLL(void) Proto_EnumProtocols(int *nProtos, PROTOCOLDESCRIPTOR ***pProtos)
{
if (nProtos) *nProtos = protos.getCount();
- if (pProtos) *pProtos = protos.getArray();
+ if (pProtos) *pProtos = (PROTOCOLDESCRIPTOR **)protos.getArray();
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp
index 7043c99e2c..3ac0e4b117 100644
--- a/src/mir_app/src/protocols.cpp
+++ b/src/mir_app/src/protocols.cpp
@@ -81,7 +81,7 @@ static TServiceListItem serviceItems[] =
//------------------------------------------------------------------------------------
-static int CompareProtos(const PROTOCOLDESCRIPTOR *p1, const PROTOCOLDESCRIPTOR *p2)
+static int CompareProtos(const MBaseProto *p1, const MBaseProto *p2)
{
if (p1->type != p2->type)
return p1->type - p2->type;
@@ -89,7 +89,7 @@ static int CompareProtos(const PROTOCOLDESCRIPTOR *p1, const PROTOCOLDESCRIPTOR
return mir_strcmp(p1->szName, p2->szName);
}
-LIST<PROTOCOLDESCRIPTOR> filters(10, CompareProtos);
+LIST<MBaseProto> filters(10, CompareProtos);
//------------------------------------------------------------------------------------
@@ -108,12 +108,13 @@ MIR_APP_DLL(int) Proto_RegisterModule(PROTOCOLDESCRIPTOR *pd)
if (pd->cbSize != sizeof(PROTOCOLDESCRIPTOR) && pd->cbSize != PROTOCOLDESCRIPTOR_V3_SIZE)
return 1;
- PROTOCOLDESCRIPTOR *p = (PROTOCOLDESCRIPTOR*)mir_calloc(sizeof(PROTOCOLDESCRIPTOR));
- if (!p)
- return 2;
-
- memcpy(p, pd, pd->cbSize);
+ MBaseProto *p = (MBaseProto*)mir_calloc(sizeof(MBaseProto));
p->szName = mir_strdup(pd->szName);
+ p->type = pd->type;
+ if (pd->cbSize == sizeof(PROTOCOLDESCRIPTOR)) {
+ p->fnInit = pd->fnInit;
+ p->fnUninit = pd->fnUninit;
+ }
protos.insert(p);
if (p->fnInit == nullptr && (p->type == PROTOTYPE_PROTOCOL || p->type == PROTOTYPE_VIRTUAL)) {
@@ -146,6 +147,39 @@ MIR_APP_DLL(int) Proto_RegisterModule(PROTOCOLDESCRIPTOR *pd)
}
/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(void) Proto_SetUniqueId(const char *szModuleName, const char *pszUniqueId)
+{
+ PROTOACCOUNT *pa = Proto_GetAccount(szModuleName);
+ if (pa != nullptr) {
+ pa->szUniqueId = mir_strdup(pszUniqueId);
+ return;
+ }
+
+ MBaseProto tmp;
+ tmp.szName = (char*)szModuleName;
+ MBaseProto *pd = protos.find(&tmp);
+ if (pd != nullptr)
+ pd->szUniqueId = mir_strdup(pszUniqueId);
+}
+
+MIR_APP_DLL(const char*) Proto_GetUniqueId(const char *szModuleName)
+{
+ MBaseProto tmp;
+ PROTOACCOUNT *pa = Proto_GetAccount(szModuleName);
+ if (pa != nullptr) {
+ if (pa->szUniqueId != nullptr)
+ return pa->szUniqueId;
+
+ tmp.szName = pa->szProtoName;
+ }
+ else tmp.szName = (char*)szModuleName;
+
+ MBaseProto *pd = protos.find(&tmp);
+ return (pd != nullptr) ? pd->szUniqueId : nullptr;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Basic core services
MIR_APP_DLL(MEVENT) Proto_AuthRecv(const char *szProtoName, PROTORECVEVENT *pcre)
@@ -425,6 +459,7 @@ void UnloadProtocolsModule()
if (!bModuleInitialized) return;
for (auto &p : protos) {
+ mir_free(p->szUniqueId);
mir_free(p->szName);
mir_free(p);
}