summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/delphi/m_protosvc.inc10
-rw-r--r--include/m_core.h8
-rw-r--r--include/m_protosvc.h1027
-rw-r--r--plugins/AddContactPlus/src/addcontact.cpp4
-rw-r--r--plugins/BossKeyPlus/src/BossKey.cpp10
-rw-r--r--plugins/ConnectionNotify/src/ConnectionNotify.cpp16
-rw-r--r--plugins/CryptoPP/src/main.cpp3
-rw-r--r--plugins/CyrTranslit/src/TransliterationProtocol.cpp3
-rw-r--r--plugins/Dropbox/src/dropbox.cpp5
-rw-r--r--plugins/Dropbox/src/dropbox_commands.cpp3
-rw-r--r--plugins/FileAsMessage/src/main.cpp3
-rw-r--r--plugins/ListeningTo/src/listeningto.cpp30
-rw-r--r--plugins/LotusNotify/src/LotusNotify.cpp3
-rw-r--r--plugins/MenuItemEx/src/main.cpp2
-rw-r--r--plugins/MirFox/src/MirandaUtils.cpp13
-rw-r--r--plugins/MirOTR/src/dllmain.cpp7
-rw-r--r--plugins/MyDetails/src/data.cpp2
-rw-r--r--plugins/New_GPG/src/init.cpp3
-rw-r--r--plugins/NewsAggregator/Src/NewsAggregator.cpp3
-rw-r--r--plugins/SecureIM/src/main.cpp3
-rw-r--r--plugins/SendScreenshotPlus/src/CSend.cpp2
-rw-r--r--plugins/SimpleStatusMsg/src/main.cpp20
-rw-r--r--plugins/StatusPlugins/commonstatus.cpp6
-rwxr-xr-xplugins/StopSpamMod/src/stopspam.cpp2
-rw-r--r--plugins/Weather/src/weather.cpp3
-rw-r--r--plugins/Weather/src/weather_svcs.cpp4
-rw-r--r--plugins/WebView/src/main.cpp3
-rw-r--r--protocols/AimOscar/src/aim.cpp3
-rw-r--r--protocols/AimOscar/src/server.cpp6
-rw-r--r--protocols/Dummy/src/main.cpp3
-rw-r--r--protocols/FacebookRM/src/main.cpp3
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp6
-rw-r--r--protocols/Gadu-Gadu/src/filetransfer.cpp4
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp3
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp2
-rw-r--r--protocols/ICQCorp/src/corp.cpp23
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp2
-rw-r--r--protocols/IRCG/src/main.cpp3
-rw-r--r--protocols/IcqOscarJ/src/icq_filerequests.cpp6
-rw-r--r--protocols/IcqOscarJ/src/init.cpp3
-rw-r--r--protocols/IcqOscarJ/src/oscar_filetransfer.cpp6
-rw-r--r--protocols/JabberG/src/jabber.cpp3
-rw-r--r--protocols/JabberG/src/jabber_ft.cpp4
-rw-r--r--protocols/JabberG/src/jabber_iq_handlers.cpp4
-rw-r--r--protocols/JabberG/src/jabber_search.cpp334
-rw-r--r--protocols/MRA/src/Mra.cpp3
-rw-r--r--protocols/MRA/src/MraFilesQueue.cpp6
-rw-r--r--protocols/MSN/src/msn.cpp3
-rw-r--r--protocols/MSN/src/msn_commands.cpp10
-rw-r--r--protocols/MSN/src/msn_p2p.cpp4
-rw-r--r--protocols/MinecraftDynmap/src/main.cpp3
-rw-r--r--protocols/Omegle/src/main.cpp3
-rw-r--r--protocols/Sametime/src/files.cpp4
-rw-r--r--protocols/Sametime/src/sametime.cpp3
-rw-r--r--protocols/SkypeClassic/src/skype.cpp8
-rw-r--r--protocols/SkypeClassic/src/skypeapi.cpp15
-rw-r--r--protocols/SkypeClassic/src/skypeapi.h1
-rw-r--r--protocols/SkypeClassic/src/skypesvc.cpp5
-rw-r--r--protocols/SkypeWeb/src/main.cpp3
-rw-r--r--protocols/Steam/src/main.cpp3
-rw-r--r--protocols/Tlen/src/tlen.cpp3
-rw-r--r--protocols/Tlen/src/tlen_file.cpp4
-rw-r--r--protocols/Tlen/src/tlen_p2p_new.cpp4
-rw-r--r--protocols/Tox/src/tox.cpp3
-rw-r--r--protocols/Tox/src/tox_transfer.cpp6
-rw-r--r--protocols/Twitter/src/main.cpp3
-rw-r--r--protocols/VKontakte/src/main.cpp3
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp2
-rw-r--r--protocols/WhatsApp/src/main.cpp3
-rw-r--r--protocols/Yahoo/src/file_transfer.cpp10
-rw-r--r--protocols/Yahoo/src/main.cpp3
-rw-r--r--src/core/stdauth/src/authdialogs.cpp4
-rw-r--r--src/core/stdautoaway/src/autoaway.cpp2
-rw-r--r--src/core/stdaway/src/sendmsg.cpp4
-rw-r--r--src/core/stdfile/src/file.cpp8
-rw-r--r--src/core/stdfile/src/filerecvdlg.cpp2
-rw-r--r--src/core/stdfile/src/filexferdlg.cpp6
-rw-r--r--src/modules/addcontact/addcontact.cpp4
-rw-r--r--src/modules/findadd/findadd.cpp6
-rw-r--r--src/modules/metacontacts/meta_main.cpp3
-rw-r--r--src/modules/protocols/protocols.cpp211
-rw-r--r--src/modules/protocols/protoint.cpp20
82 files changed, 958 insertions, 1046 deletions
diff --git a/include/delphi/m_protosvc.inc b/include/delphi/m_protosvc.inc
index 4a7d8085fb..664b8552c6 100644
--- a/include/delphi/m_protosvc.inc
+++ b/include/delphi/m_protosvc.inc
@@ -301,7 +301,6 @@ const
any requests.
}
PS_SETAWAYMSG = '/SetAwayMsg';
- PS_SETAWAYMSGW = '/SetAwayMsgW';
{
wParam : newMode from statusmodes.inc
@@ -370,7 +369,6 @@ const
Notes : Protocol modules must be able to cope with lParam=NULL(0)
}
PS_AUTHDENY = '/AuthDeny';
- PS_AUTHDENYW = '/AuthDenyW';
{
Send a "You were added" event
@@ -413,7 +411,6 @@ const
}
PS_BASICSEARCH = '/BasicSearch';
- PS_BASICSEARCHW = '/BasicSearchW';
{
wParam : 0
@@ -428,7 +425,6 @@ const
Version: v0.1.2.1+
}
PS_SEARCHBYEMAIL = '/SearchByEmail';
- PS_SEARCHBYEMAILW = '/SearchByEmailW';
{
wParam : 0
@@ -440,7 +436,6 @@ const
Version: v0.1.2.1+
}
PS_SEARCHBYNAME = '/SearchByName';
- PS_SEARCHBYNAMEW = '/SearchByNameW';
{
wParam : 0
@@ -541,7 +536,6 @@ const
Version: v0.1.2.2+
}
PS_FILERESUME = '/FileResume';
- PS_FILERESUMEW = '/FileResumeW';
{
Asks a protocol to join the chatroom from contact v0.8.0+
@@ -797,7 +791,6 @@ const
filename(s), description: ASCIIZ
}
PSS_FILEALLOW = '/FileAllow';
- PSS_FILEALLOWW = '/FileAllowW';
{
CCSDATA: Yes
@@ -807,7 +800,6 @@ const
Returns: 0 on success, [non zero] on failure
}
PSS_FILEDENY = '/FileDeny';
- PSS_FILEDENYW = '/FileDenyW';
{
CCSDATA: Yes
@@ -830,7 +822,6 @@ const
lParam=null terminated string containing reason
}
PSS_FILE = '/SendFile';
- PSS_FILEW = '/SendFileW';
{
Send an auth request
@@ -839,7 +830,6 @@ const
Returns 0 on success, nonzero on failure
}
PSS_AUTHREQUEST = '/AuthRequest';
- PSS_AUTHREQUESTW = '/AuthRequestW';
{
Send "User is Typing" (user is typing a message to the user) v0.3.3+
diff --git a/include/m_core.h b/include/m_core.h
index 9ed2a86a9d..5e431808a7 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -486,9 +486,15 @@ __forceinline char* lrtrimp(char *str) { return ltrimp(rtrim(str)); };
typedef union {
char *a; // utf8 or ansi strings
TCHAR *t; // strings of TCHARs
- wchar_t w; // strings of WCHARs
+ wchar_t *w; // strings of WCHARs
} MAllStrings;
+typedef union {
+ char **a; // array of utf8 or ansi strings
+ TCHAR **t; // array of strings of TCHARs
+ wchar_t **w; // array of strings of WCHARs
+} MAllStringArray;
+
#ifdef _UNICODE
#define mir_t2a(s) mir_u2a(s)
#define mir_a2t(s) mir_a2u(s)
diff --git a/include/m_protosvc.h b/include/m_protosvc.h
index 9c9518b95f..49f3aa57d4 100644
--- a/include/m_protosvc.h
+++ b/include/m_protosvc.h
@@ -2,7 +2,7 @@
Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org)
+Copyright (ñ) 2012-15 Miranda NG project (http:// miranda-ng.org)
Copyright (c) 2000-09 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -22,11 +22,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-//this module was created in v0.1.1.0
+// this module was created in v0.1.1.0
-//none of these services should be used on their own (ie using CallService,
-//CreateServiceFunction(), etc), hence the PS_ prefix. Instead use the services
-//exposed in m_protocols.h
+// none of these services should be used on their own (ie using CallService,
+// CreateServiceFunction(), etc), hence the PS_ prefix. Instead use the services
+// exposed in m_protocols.h
#ifndef M_PROTOSVC_H__
#define M_PROTOSVC_H__ 1
@@ -44,94 +44,102 @@ convert Unicode to ANSI and call the appropriate service.
*/
/*************************** NON-CONTACT SERVICES ************************/
-//these should be called with CallProtoServiceInt(NULL,)
-
-//Get the capability flags of the module.
-//wParam = flagNum
-//lParam = 0
-//Returns a bitfield corresponding to wParam. See the #defines below
-//Should return 0 for unknown values of flagNum
-//Non-network-access modules should return flags to represent the things they
-//actually actively use, not the values that it is known to pass through
-//correctly
+// these should be called with CallProtoServiceInt(NULL,)
+
+// Get the capability flags of the module.
+// wParam = flagNum
+// lParam = 0
+// Returns a bitfield corresponding to wParam. See the #defines below
+// Should return 0 for unknown values of flagNum
+// Non-network-access modules should return flags to represent the things they
+// actually actively use, not the values that it is known to pass through
+// correctly
#define PFLAGNUM_1 1
-#define PF1_IMSEND 0x00000001 //supports IM sending
-#define PF1_IMRECV 0x00000002 //supports IM receiving
+#define PF1_IMSEND 0x00000001 // supports IM sending
+#define PF1_IMRECV 0x00000002 // supports IM receiving
#define PF1_IM (PF1_IMSEND|PF1_IMRECV)
-#define PF1_URLSEND 0x00000004 //supports separate URL sending
-#define PF1_URLRECV 0x00000008 //supports separate URL receiving
+#define PF1_URLSEND 0x00000004 // supports separate URL sending
+#define PF1_URLRECV 0x00000008 // supports separate URL receiving
#define PF1_URL (PF1_URLSEND|PF1_URLRECV)
-#define PF1_FILESEND 0x00000010 //supports file sending
-#define PF1_FILERECV 0x00000020 //supports file receiving
+#define PF1_FILESEND 0x00000010 // supports file sending
+#define PF1_FILERECV 0x00000020 // supports file receiving
#define PF1_FILE (PF1_FILESEND|PF1_FILERECV)
-#define PF1_MODEMSGSEND 0x00000040 //supports broadcasting away messages
-#define PF1_MODEMSGRECV 0x00000080 //supports reading others' away messages
+#define PF1_MODEMSGSEND 0x00000040 // supports broadcasting away messages
+#define PF1_MODEMSGRECV 0x00000080 // supports reading others' away messages
#define PF1_MODEMSG (PF1_MODEMSGSEND|PF1_MODEMSGRECV)
-#define PF1_SERVERCLIST 0x00000100 //contact lists are stored on the server, not locally. See notes below
-#define PF1_AUTHREQ 0x00000200 //will get authorisation requests for some or all contacts
-#define PF1_ADDED 0x00000400 //will get 'you were added' notifications
-#define PF1_VISLIST 0x00000800 //has an invisible list
-#define PF1_INVISLIST 0x00001000 //has a visible list for when in invisible mode
-#define PF1_INDIVSTATUS 0x00002000 //supports setting different status modes to each contact
-#define PF1_EXTENSIBLE 0x00004000 //the protocol is extensible and supports plugin-defined messages
-#define PF1_PEER2PEER 0x00008000 //supports direct (not server mediated) communication between clients
-#define PF1_NEWUSER 0x00010000 //supports creation of new user IDs
-#define PF1_CHAT 0x00020000 //has a realtime chat capability
-#define PF1_INDIVMODEMSG 0x00040000 //supports replying to a mode message request with different text depending on the contact requesting
-#define PF1_BASICSEARCH 0x00080000 //supports a basic user searching facility
-#define PF1_EXTSEARCH 0x00100000 //supports one or more protocol-specific extended search schemes
-#define PF1_CANRENAMEFILE 0x00200000 //supports renaming of incoming files as they are transferred
-#define PF1_FILERESUME 0x00400000 //can resume broken file transfers, see PS_FILERESUME below
-#define PF1_ADDSEARCHRES 0x00800000 //can add search results to the contact list
-#define PF1_CONTACTSEND 0x01000000 //can send contacts to other users
-#define PF1_CONTACTRECV 0x02000000 //can receive contacts from other users
+#define PF1_SERVERCLIST 0x00000100 // contact lists are stored on the server, not locally. See notes below
+#define PF1_AUTHREQ 0x00000200 // will get authorisation requests for some or all contacts
+#define PF1_ADDED 0x00000400 // will get 'you were added' notifications
+#define PF1_VISLIST 0x00000800 // has an invisible list
+#define PF1_INVISLIST 0x00001000 // has a visible list for when in invisible mode
+#define PF1_INDIVSTATUS 0x00002000 // supports setting different status modes to each contact
+#define PF1_EXTENSIBLE 0x00004000 // the protocol is extensible and supports plugin-defined messages
+#define PF1_PEER2PEER 0x00008000 // supports direct (not server mediated) communication between clients
+#define PF1_NEWUSER 0x00010000 // supports creation of new user IDs
+#define PF1_CHAT 0x00020000 // has a realtime chat capability
+#define PF1_INDIVMODEMSG 0x00040000 // supports replying to a mode message request with different text depending on the contact requesting
+#define PF1_BASICSEARCH 0x00080000 // supports a basic user searching facility
+#define PF1_EXTSEARCH 0x00100000 // supports one or more protocol-specific extended search schemes
+#define PF1_CANRENAMEFILE 0x00200000 // supports renaming of incoming files as they are transferred
+#define PF1_FILERESUME 0x00400000 // can resume broken file transfers, see PS_FILERESUME below
+#define PF1_ADDSEARCHRES 0x00800000 // can add search results to the contact list
+#define PF1_CONTACTSEND 0x01000000 // can send contacts to other users
+#define PF1_CONTACTRECV 0x02000000 // can receive contacts from other users
#define PF1_CONTACT (PF1_CONTACTSEND|PF1_CONTACTRECV)
-#define PF1_CHANGEINFO 0x04000000 //can change our user information stored on server
-#define PF1_SEARCHBYEMAIL 0x08000000 //supports a search by e-mail feature
-#define PF1_USERIDISEMAIL 0x10000000 //set if the uniquely identifying field of the network is the e-mail address
-#define PF1_SEARCHBYNAME 0x20000000 //supports searching by nick/first/last names
-#define PF1_EXTSEARCHUI 0x40000000 //has a dialog box to allow searching all the possible fields
-#define PF1_NUMERICUSERID 0x80000000 //the unique user IDs for this protocol are numeric
-
-#define PFLAGNUM_2 2 //the status modes that the protocol supports
-#define PF2_ONLINE 0x00000001 //an unadorned online mode
+#define PF1_CHANGEINFO 0x04000000 // can change our user information stored on server
+#define PF1_SEARCHBYEMAIL 0x08000000 // supports a search by e-mail feature
+#define PF1_USERIDISEMAIL 0x10000000 // set if the uniquely identifying field of the network is the e-mail address
+#define PF1_SEARCHBYNAME 0x20000000 // supports searching by nick/first/last names
+#define PF1_EXTSEARCHUI 0x40000000 // has a dialog box to allow searching all the possible fields
+#define PF1_NUMERICUSERID 0x80000000 // the unique user IDs for this protocol are numeric
+
+///////////////////////////////////////////////////////////////////////////////
+// the status modes that the protocol supports
+
+#define PFLAGNUM_2 2
+
+#define PF2_ONLINE 0x00000001 // an unadorned online mode
#define PF2_INVISIBLE 0x00000002
-#define PF2_SHORTAWAY 0x00000004 //Away on ICQ, BRB on MSN
-#define PF2_LONGAWAY 0x00000008 //NA on ICQ, Away on MSN
-#define PF2_LIGHTDND 0x00000010 //Occupied on ICQ, Busy on MSN
-#define PF2_HEAVYDND 0x00000020 //DND on ICQ
+#define PF2_SHORTAWAY 0x00000004 // Away on ICQ, BRB on MSN
+#define PF2_LONGAWAY 0x00000008 // NA on ICQ, Away on MSN
+#define PF2_LIGHTDND 0x00000010 // Occupied on ICQ, Busy on MSN
+#define PF2_HEAVYDND 0x00000020 // DND on ICQ
#define PF2_FREECHAT 0x00000040
#define PF2_OUTTOLUNCH 0x00000080
#define PF2_ONTHEPHONE 0x00000100
-#define PF2_IDLE 0x00000200 //added during 0.3.4 (2004/09/13)
+#define PF2_IDLE 0x00000200
-//the status modes that the protocol supports
-//away-style messages for. Uses the PF2_ flags.
+///////////////////////////////////////////////////////////////////////////////
+// the status modes that the protocol supports
+// away-style messages for. Uses the PF2_ flags.
// PFLAGNUM_3 is implemented by protocol services that support away messages
// there may be no support and 0 will be returned, if there is
// support it will consist of a set of PF2_* bits
+
#define PFLAGNUM_3 3
// given a status will return what bit flags to test for
static __inline unsigned long Proto_Status2Flag(int status)
{
- switch(status) {
- case ID_STATUS_ONLINE: return PF2_ONLINE;
- case ID_STATUS_OFFLINE: return 0;
- case ID_STATUS_INVISIBLE: return PF2_INVISIBLE;
+ switch (status) {
+ case ID_STATUS_ONLINE: return PF2_ONLINE;
+ case ID_STATUS_INVISIBLE: return PF2_INVISIBLE;
case ID_STATUS_OUTTOLUNCH: return PF2_OUTTOLUNCH;
case ID_STATUS_ONTHEPHONE: return PF2_ONTHEPHONE;
- case ID_STATUS_AWAY: return PF2_SHORTAWAY;
- case ID_STATUS_NA: return PF2_LONGAWAY;
- case ID_STATUS_OCCUPIED: return PF2_LIGHTDND;
- case ID_STATUS_DND: return PF2_HEAVYDND;
- case ID_STATUS_FREECHAT: return PF2_FREECHAT;
- case ID_STATUS_IDLE: return PF2_IDLE;
+ case ID_STATUS_AWAY: return PF2_SHORTAWAY;
+ case ID_STATUS_NA: return PF2_LONGAWAY;
+ case ID_STATUS_OCCUPIED: return PF2_LIGHTDND;
+ case ID_STATUS_DND: return PF2_HEAVYDND;
+ case ID_STATUS_FREECHAT: return PF2_FREECHAT;
+ case ID_STATUS_IDLE: return PF2_IDLE;
}
return 0;
}
-#define PFLAGNUM_4 4 // another bunch of flags
+///////////////////////////////////////////////////////////////////////////////
+// another bunch of flags
+
+#define PFLAGNUM_4 4
#define PF4_FORCEAUTH 0x00000001 // forces auth requests to be sent when adding users
#define PF4_FORCEADDED 0x00000002 // forces "you were added" requests to be sent
@@ -146,96 +154,101 @@ static __inline unsigned long Proto_Status2Flag(int status)
#define PF4_GROUPCHATFILES 0x00000800 // protocol supports sending files to group chats
#define PF4_SINGLEFILEONLY 0x00001000 // protocol supports sending files one by one only
-#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 //v0.1.2.2+: 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 // 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
- statuses contacts supports, and that PFLAGNUM_5 is for statuses a protocol can SET TO ITSELF,
- if this is not replied to, then PFLAGNUM_2 is alone in telling you which statuses a protocol
- can set to and what statuses a contact can set to as well.
-
- E.g. A protocol might report 'wireless' users but a login of the protocol from Miranda can
- not set itself to 'wireless' so PFLAGNUM_2 would return PF2_ONTHEPHONE and PFLAGNUM_5 would
- return PF2_ONTHEPHONE as well, this means "I will get contacts who are on the phone but you can
- not set on the phone" and so on.
-
- Do note that the reply here is a NEGATION of bitflags reported for PFLAGNUM_2, e.g. returning
- PF2_ONTHEPHONE for PFLAGNUM_2 and returning the same for PFLAGNUM_5 says that you DO NOT SUPPORT
- PF2_ONTHEPHONE for the user to PS_SETSTATUS to, but you will expect other contacts to have
- that status, e.g. you can get onthephone for users but can't go online with onthephone.
+#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
+
+///////////////////////////////////////////////////////////////////////////////
+// A protocol might not support this cap, it allows a protocol to say that
+// PFLAGNUM_2 is for statuses contacts supports, and that PFLAGNUM_5 is for
+// statuses a protocol can SET TO ITSELF, if this is not replied to, then
+// PFLAGNUM_2 is alone in telling you which statuses a protocol can set to and
+// what statuses a contact can set to as well.
+//
+// E.g. A protocol might report 'wireless' users but a login of the protocol
+// from Miranda can not set itself to 'wireless' so PFLAGNUM_2 would return
+// PF2_ONTHEPHONE and PFLAGNUM_5 would return PF2_ONTHEPHONE as well, this
+// means "I will get contacts who are on the phone but you can not set on the
+// phone" and so on.
+//
+// Do note that the reply here is a NEGATION of bitflags reported for
+// PFLAGNUM_2, e.g. returning PF2_ONTHEPHONE for PFLAGNUM_2 and returning the
+// same for PFLAGNUM_5 says that you DO NOT SUPPORT PF2_ONTHEPHONE for the user
+// to PS_SETSTATUS to, but you will expect other contacts to have that status,
+// e.g. you can get onthephone for users but can't go online with onthephone.
+//
+// The same PF2_* status flags are used in the reply.
- The same PF2_* status flags are used in the reply.
-
-Added during 0.3.4 (2004/09/14)
-*/
#define PFLAGNUM_5 5
-/* Deleting contacts from protocols that store the contact list on the server:
-If a contact is deleted while the protocol is online, it is expected that the
-protocol will have hooked me_db_contact_deleted and take the appropriate
-action by itself.
-If a contact is deleted while the protocol is offline, the contact list will
-display a message to the user about the problem, and set the byte setting
-"CList"/"Delete" to 1. Each time such a protocol changes status from offline
-or connecting to online the contact list will check for contacts with this
-flag set and delete them at that time. Your hook for me_db_contact_deleted
-will pick this up and everything will be good.
-*/
+///////////////////////////////////////////////////////////////////////////////
+// Deleting contacts from protocols that store the contact list on the server:
+// If a contact is deleted while the protocol is online, it is expected that the
+// protocol will have hooked me_db_contact_deleted and take the appropriate
+// action by itself.
+// If a contact is deleted while the protocol is offline, the contact list will
+// display a message to the user about the problem, and set the byte setting
+// "CList"/"Delete" to 1. Each time such a protocol changes status from offline
+// or connecting to online the contact list will check for contacts with this
+// flag set and delete them at that time. Your hook for me_db_contact_deleted
+// will pick this up and everything will be good.
+
#define PS_GETCAPS "/GetCaps"
-//Get a human-readable name for the protocol
-//wParam = cchName
-//lParam = (LPARAM)(char*)szName
-//Returns 0 on success, nonzero on failure
-//cchName is the number of characters in the buffer szName
-//This should be translated before being returned
-//Some example strings are:
-//"ICQ", "AIM", "RSA-1024 Encryption"
+///////////////////////////////////////////////////////////////////////////////
+// Get a human-readable name for the protocol
+// wParam = cchName
+// lParam = (LPARAM)(char*)szName
+// Returns 0 on success, nonzero on failure
+// cchName is the number of characters in the buffer szName
+// This should be translated before being returned
+// Some example strings are:
+// "ICQ", "AIM", "RSA-1024 Encryption"
+
#define PS_GETNAME "/GetName"
-//Loads one of the protocol-specific icons
-//wParam = whichIcon
-//lParam = 0
-//Returns the HICON, or NULL on failure
-//The returned HICON must be DestroyIcon()ed.
-//The UI should overlay the online icon with a further UI-specified icon to
-//represent the exact status mode.
-#define PLI_PROTOCOL 1 //An icon representing the protocol (eg the multicoloured flower for ICQ)
-#define PLI_ONLINE 2 //Online state icon for that protocol (eg green flower for ICQ)
-#define PLI_OFFLINE 3 //Offline state icon for that protocol (eg red flower for ICQ)
-#define PLIF_LARGE 0 //OR with one of the above to get the large (32x32 by default) icon
-#define PLIF_SMALL 0x10000 //OR with one of the above to get the small (16x16 by default) icon
-#define PLIF_ICOLIB 0x20000 //the returned HICON is managed by IcoLib, DO NOT DestroyIcon() it
-#define PLIF_ICOLIBHANDLE 0x40000 //the function will return IcoLib handle not HICON
+///////////////////////////////////////////////////////////////////////////////
+// Loads one of the protocol-specific icons
+// wParam = whichIcon
+// lParam = 0
+// Returns the HICON, or NULL on failure
+// The returned HICON must be DestroyIcon()ed.
+// The UI should overlay the online icon with a further UI-specified icon to
+// represent the exact status mode.
+
+#define PLI_PROTOCOL 1 // An icon representing the protocol (eg the multicoloured flower for ICQ)
+#define PLI_ONLINE 2 // Online state icon for that protocol (eg green flower for ICQ)
+#define PLI_OFFLINE 3 // Offline state icon for that protocol (eg red flower for ICQ)
+#define PLIF_LARGE 0 // OR with one of the above to get the large (32x32 by default) icon
+#define PLIF_SMALL 0x10000 // OR with one of the above to get the small (16x16 by default) icon
+#define PLIF_ICOLIB 0x20000 // the returned HICON is managed by IcoLib, DO NOT DestroyIcon() it
+#define PLIF_ICOLIBHANDLE 0x40000 // the function will return IcoLib handle not HICON
+
#define PS_LOADICON "/LoadIcon"
-//Change the protocol's status mode
-//wParam = newMode, from ui/contactlist/statusmodes.h
-//lParam = 0
-//returns 0 on success, nonzero on failure
-//Will send an ack with:
-//type = ACKTYPE_STATUS, result = ACKRESULT_SUCCESS, hProcess = (HANDLE)previousMode, lParam = newMode
-//when the change completes. This ack is sent for all changes, not just ones
-//caused by calling this function.
-//Note that newMode can be ID_STATUS_CONNECTING <= newMode<ID_STATUS_CONNECTING+
-//MAX_CONNECT_RETRIES to signify that it's connecting and it's the nth retry.
-//Protocols are initially always in offline mode.
-//Non-network-level protocol modules do not have the concept of a status and
-//should leave this service unimplemented
-//If a protocol doesn't support the specific status mode, it should pick the
-//closest one that it does support, and change to that.
-//If the new mode requires that the protocol switch from offline to online then
-//it will do so, but errors will be reported in the form of an additional ack:
-//type = ACKTYPE_LOGIN, result = ACKRESULT_FAILURE, hProcess = NULL, lParam = LOGINERR_
+///////////////////////////////////////////////////////////////////////////////
+// Change the protocol's status mode
+// wParam = newMode, from ui/contactlist/statusmodes.h
+// lParam = 0
+// returns 0 on success, nonzero on failure
+// Will send an ack with:
+// type = ACKTYPE_STATUS, result = ACKRESULT_SUCCESS, hProcess = (HANDLE)previousMode, lParam = newMode
+// when the change completes. This ack is sent for all changes, not just ones
+// caused by calling this function.
+// Note that newMode can be ID_STATUS_CONNECTING <= newMode<ID_STATUS_CONNECTING+
+// MAX_CONNECT_RETRIES to signify that it's connecting and it's the nth retry.
+// Protocols are initially always in offline mode.
+// Non-network-level protocol modules do not have the concept of a status and
+// should leave this service unimplemented
+// If a protocol doesn't support the specific status mode, it should pick the
+// closest one that it does support, and change to that.
+// If the new mode requires that the protocol switch from offline to online then
+// it will do so, but errors will be reported in the form of an additional ack:
+// type = ACKTYPE_LOGIN, result = ACKRESULT_FAILURE, hProcess = NULL, lParam = LOGINERR_
// (added during 0.3.4.3) the protocol will send LOGINERR_OTHERLOCATION if the login
// was disconnected because of a login at another location
+
#define LOGINERR_WRONGPASSWORD 1
#define LOGINERR_NONETWORK 2
#define LOGINERR_PROXYFAILURE 3
@@ -244,79 +257,93 @@ will pick this up and everything will be good.
#define LOGINERR_TIMEOUT 6
#define LOGINERR_WRONGPROTOCOL 7
#define LOGINERR_OTHERLOCATION 8
-//protocols may define more error codes starting at 1000
+
+// protocols may define more error codes starting at 1000
#define PS_SETSTATUS "/SetStatus"
-//Sets the status-mode specific message for yourself
-//wParam = status mode
-//lParam = (LPARAM)(const char*)szMessage
-//Returns 0 on success, nonzero on failure
-//Note that this service will not be available unless PF1_MODEMSGSEND is set
-//and PF1_INDIVMODEMSG is *not* set.
-//Protocol modules must support szMessage = NULL. It may either mean to use an
-//empty message, or (preferably) to not reply at all to any requests
+///////////////////////////////////////////////////////////////////////////////
+// Sets the status-mode specific message for yourself
+// wParam = status mode
+// lParam = (LPARAM)(const char*)szMessage
+// Returns 0 on success, nonzero on failure
+// Note that this service will not be available unless PF1_MODEMSGSEND is set
+// and PF1_INDIVMODEMSG is *not* set.
+// Protocol modules must support szMessage = NULL. It may either mean to use an
+// empty message, or (preferably) to not reply at all to any requests
+
#define PS_SETAWAYMSG "/SetAwayMsg"
-#define PS_SETAWAYMSGW "/SetAwayMsgW"
-//Get the status mode that a protocol is currently in
-//wParam = lParam = 0
-//Returns the status mode
-//Non-network-level protocol modules do not have the concept of a status and
-//should leave this service unimplemented
+///////////////////////////////////////////////////////////////////////////////
+// Get the status mode that a protocol is currently in
+// wParam = lParam = 0
+// Returns the status mode
+// Non-network-level protocol modules do not have the concept of a status and
+// should leave this service unimplemented
+
#define PS_GETSTATUS "/GetStatus"
-//Allow somebody to add us to their contact list
-//wParam = (WPARAM)(HANDLE)hDbEvent
-//lParam = 0
-//Returns 0 on success, nonzero on failure
-//Auth requests come in the form of an event added to the database for the NULL
-//user. The form is:
-//DWORD protocolSpecific
-//ASCIIZ nick, firstName, lastName, e-mail, requestReason
-//hDbEvent must be the handle of such an event
-//One or more fields may be empty if the protocol doesn't support them
+///////////////////////////////////////////////////////////////////////////////
+// Allow somebody to add us to their contact list
+// wParam = (WPARAM)(HANDLE)hDbEvent
+// lParam = 0
+// Returns 0 on success, nonzero on failure
+// Auth requests come in the form of an event added to the database for the NULL
+// user. The form is:
+// DWORD protocolSpecific
+// ASCIIZ nick, firstName, lastName, e-mail, requestReason
+// hDbEvent must be the handle of such an event
+// One or more fields may be empty if the protocol doesn't support them
+
#define PS_AUTHALLOW "/Authorize"
-//Deny an authorisation request
-//wParam = (WPARAM)(HANDLE)hDbEvent
-//lParam = (LPARAM)(const TCHAR*)szReason
-//Returns 0 on success, nonzero on failure
-//Protocol modules must be able to cope with szReason = NULL
+///////////////////////////////////////////////////////////////////////////////
+// Deny an authorisation request
+// wParam = (WPARAM)(HANDLE)hDbEvent
+// lParam = (LPARAM)(const TCHAR*)szReason
+// Returns 0 on success, nonzero on failure
+// Protocol modules must be able to cope with szReason = NULL
+
#define PS_AUTHDENY "/AuthDeny"
-#define PS_AUTHDENYW "/AuthDenyW"
+///////////////////////////////////////////////////////////////////////////////
// Send a "You were added" event
// wParam = lParam = 0
// Returns 0 on success, nonzero on failure
+
#define PSS_ADDED "/YouWereAdded"
-//Create account manager UI form
-//wParam = 0
-//lParam = (LPARAM)(HWND)hwndAccMgr
-//Returns handle on newly created form.
-//Size for best fit is 186x134 DLUs, please avoid groupboxes
-//paddind and advanced options. This should provide minimal setup
-//for initial connect.
+///////////////////////////////////////////////////////////////////////////////
+// Create account manager UI form
+// wParam = 0
+// lParam = (LPARAM)(HWND)hwndAccMgr
+// Returns handle on newly created form.
+// Size for best fit is 186x134 DLUs, please avoid groupboxes
+// paddind and advanced options. This should provide minimal setup
+// for initial connect.
+
#define PS_CREATEACCMGRUI "/CreateAccMgrUI"
-//Send a basic search request
-//wParam = 0
-//lParam = (LPARAM)(const TCHAR*)szId
-//Returns a handle for the search, or zero on failure
-//All protocols identify users uniquely by a single field. This service will
-//search by that field.
-//Note that if users are identified by an integer (eg ICQ) szId should be a
-//string containing that integer, not the integer itself.
-//All search replies (even protocol-specific extended searches) are replied by
-//means of a series of acks:
-//result acks, one of more of:
-//type = ACKTYPE_SEARCH, result = ACKRESULT_DATA, lParam = (LPARAM)(PROTOSEARCHRESULT*)&psr
-//ending ack:
-//type = ACKTYPE_SEARCH, result = ACKRESULT_SUCCESS, lParam = 0
-//Note that the pointers in the structure are not guaranteed to be valid after
-//the ack is complete.
-
-#define PSR_UNICODE 1 // return Unicode status
+///////////////////////////////////////////////////////////////////////////////
+// Send a basic search request
+// wParam = 0
+// lParam = (LPARAM)(const TCHAR*)szId
+// Returns a handle for the search, or zero on failure
+// All protocols identify users uniquely by a single field. This service will
+// search by that field.
+// Note that if users are identified by an integer (eg ICQ) szId should be a
+// string containing that integer, not the integer itself.
+// All search replies (even protocol-specific extended searches) are replied by
+// means of a series of acks:
+// result acks, one of more of:
+// type = ACKTYPE_SEARCH, result = ACKRESULT_DATA, lParam = (LPARAM)(PROTOSEARCHRESULT*)&psr
+// ending ack:
+// type = ACKTYPE_SEARCH, result = ACKRESULT_SUCCESS, lParam = 0
+// Note that the pointers in the structure are not guaranteed to be valid after
+// the ack is complete.
+
+#define PSR_UNICODE 0x0001 // all strings go in UTF16-LE
+#define PSR_UTF8 0x0002 // all strings go in UTF8
+
#if defined(_UNICODE)
#define PSR_TCHAR PSR_UNICODE
#else
@@ -332,55 +359,62 @@ typedef struct {
MAllStrings id;
int flags;
} PROTOSEARCHRESULT;
+
#define PS_BASICSEARCH "/BasicSearch"
-#define PS_BASICSEARCHW "/BasicSearchW"
-
-//Search for users by e-mail address v0.1.2.1+
-//wParam = 0
-//lParam = (LPARAM)(TCHAR*)szEmail
-//Returns a HANDLE to the search, or NULL on failure
-//Results are returned as for PS_BASICSEARCH.
-//This function is only available if the PF1_SEARCHBYEMAIL capability is set
-//If the PF1_USERIDISEMAIL capability is set then this function and
-//PS_BASICSEARCH should have the same result (and it's best if they are the
-//same function).
+
+///////////////////////////////////////////////////////////////////////////////
+// Search for users by e-mail address
+// wParam = 0
+// lParam = (LPARAM)(TCHAR*)szEmail
+// Returns a HANDLE to the search, or NULL on failure
+// Results are returned as for PS_BASICSEARCH.
+// This function is only available if the PF1_SEARCHBYEMAIL capability is set
+// If the PF1_USERIDISEMAIL capability is set then this function and
+// PS_BASICSEARCH should have the same result (and it's best if they are the
+// same function).
+
#define PS_SEARCHBYEMAIL "/SearchByEmail"
-#define PS_SEARCHBYEMAILW "/SearchByEmailW"
-
-//Search for users by name v0.1.2.1+
-//wParam = 0
-//lParam = (LPARAM)(PROTOSEARCHBYNAME*)&psbn
-//Returns a HANDLE to the search, or NULL on failure
-//Results are returned as for PS_BASICSEARCH.
-//This function is only available if the PF1_SEARCHBYNAME capability is set
+
+///////////////////////////////////////////////////////////////////////////////
+// Search for users by name
+// wParam = 0
+// lParam = (LPARAM)(PROTOSEARCHBYNAME*)&psbn
+// Returns a HANDLE to the search, or NULL on failure
+// Results are returned as for PS_BASICSEARCH.
+// This function is only available if the PF1_SEARCHBYNAME capability is set
+
typedef struct {
TCHAR *pszNick;
TCHAR *pszFirstName;
TCHAR *pszLastName;
} PROTOSEARCHBYNAME;
+
#define PS_SEARCHBYNAME "/SearchByName"
-#define PS_SEARCHBYNAMEW "/SearchByNameW"
-
-//Create the advanced search dialog box v0.1.2.1+
-//wParam = 0
-//lParam = (HWND)hwndOwner
-//Returns a HWND, or NULL on failure
-//This function is only available if the PF1_EXTSEARCHUI capability is set
-//Advanced search is very protocol-specific so it is left to the protocol
-//itself to supply a dialog containing the options. This dialog should not
-//have a title bar and contain only search fields. The rest of the UI is
-//supplied by Miranda.
-//The dialog should be created with CreateDialog() or its kin and still be
-//hidden when this function returns.
-//The dialog will be destroyed when the find/add dialog is closed.
+
+///////////////////////////////////////////////////////////////////////////////
+// Create the advanced search dialog box
+// wParam = 0
+// lParam = (HWND)hwndOwner
+// Returns a HWND, or NULL on failure
+// This function is only available if the PF1_EXTSEARCHUI capability is set
+// Advanced search is very protocol-specific so it is left to the protocol
+// itself to supply a dialog containing the options. This dialog should not
+// have a title bar and contain only search fields. The rest of the UI is
+// supplied by Miranda.
+// The dialog should be created with CreateDialog() or its kin and still be
+// hidden when this function returns.
+// The dialog will be destroyed when the find/add dialog is closed.
+
#define PS_CREATEADVSEARCHUI "/CreateAdvSearchUI"
-//Search using the advanced search dialog v0.1.2.1+
-//wParam = 0
-//lParam = (LPARAM)(HWND)hwndAdvancedSearchDlg
-//Returns a HANDLE to the search, or NULL on failure
-//Results are returned as for PS_BASICSEARCH.
-//This function is only available if the PF1_EXTSEARCHUI capability is set
+///////////////////////////////////////////////////////////////////////////////
+// Search using the advanced search dialog
+// wParam = 0
+// lParam = (LPARAM)(HWND)hwndAdvancedSearchDlg
+// Returns a HANDLE to the search, or NULL on failure
+// Results are returned as for PS_BASICSEARCH.
+// This function is only available if the PF1_EXTSEARCHUI capability is set
+
#define PS_SEARCHBYADVANCED "/SearchByAdvanced"
typedef struct {
@@ -390,83 +424,98 @@ typedef struct {
PROTOSEARCHRESULT psr;
} CUSTOMSEARCHRESULTS;
-//Adds a search result to the contact list
-//wParam = flags
-//lParam = (LPARAM)(PROTOSEARCHRESULT*)&psr
-//Returns a HANDLE to the new contact, or NULL on failure
-//psr must be a result returned by a search function, since the extended
-//information past the end of the official structure may contain important
-//data required by the protocol.
-//The protocol library should not allow duplicate contacts to be added, but if
-//such a request is received it should return the original hContact, and do the
-//appropriate thing with the temporary flag (ie newflag = (oldflag&thisflag))
-#define PALF_TEMPORARY 1 //add the contact temporarily and invisibly, just to get user info or something
+///////////////////////////////////////////////////////////////////////////////
+// Adds a search result to the contact list
+// wParam = flags
+// lParam = (LPARAM)(PROTOSEARCHRESULT*)&psr
+// Returns a HANDLE to the new contact, or NULL on failure
+// psr must be a result returned by a search function, since the extended
+// information past the end of the official structure may contain important
+// data required by the protocol.
+// The protocol library should not allow duplicate contacts to be added, but if
+// such a request is received it should return the original hContact, and do the
+// appropriate thing with the temporary flag (ie newflag = (oldflag&thisflag))
+
+#define PALF_TEMPORARY 1 // add the contact temporarily and invisibly, just to get user info or something
+
#define PS_ADDTOLIST "/AddToList"
-//Adds a contact to the contact list given an auth, added or contacts event
-//wParam = MAKEWPARAM(flags, iContact)
-//lParam = (LPARAM)(HANDLE)hDbEvent
-//Returns a HANDLE to the new contact, or NULL on failure
-//hDbEvent must be either EVENTTYPE_AUTHREQ or EVENTTYPE_ADDED
-//flags are the same as for PS_ADDTOLIST.
-//iContact is only used for contacts events. It is the 0-based index of the
-//contact in the event to add. There is no way to add two or more contacts at
-//once, you should just do lots of calls.
+///////////////////////////////////////////////////////////////////////////////
+// Adds a contact to the contact list given an auth, added or contacts event
+// wParam = MAKEWPARAM(flags, iContact)
+// lParam = (LPARAM)(HANDLE)hDbEvent
+// Returns a HANDLE to the new contact, or NULL on failure
+// hDbEvent must be either EVENTTYPE_AUTHREQ or EVENTTYPE_ADDED
+// flags are the same as for PS_ADDTOLIST.
+// iContact is only used for contacts events. It is the 0-based index of the
+// contact in the event to add. There is no way to add two or more contacts at
+// once, you should just do lots of calls.
+
#define PS_ADDTOLISTBYEVENT "/AddToListByEvent"
-//Informs the protocol of the users chosen resume behaviour v0.1.2.2+
-//wParam = (WPARAM)(HANDLE)hFileTransfer
-//lParam = (LPARAM)(PROTOFILERESUME*)&pfr
-//Returns 0 on success, nonzero on failure
-//If the protocol supports file resume (PF1_FILERESUME) then before each
-//individual file receive begins (note: not just each file that already exists)
-//it will broadcast an ack with type = ACKTYPE_FILE, result = ACKRESULT_RESUME,
-//hProcess = hFileTransfer, lParam = (LPARAM)(PROTOFILETRANSFERSTATUS*)&fts. If the
-//UI processes this ack it must return nonzero from its hook. If all the hooks
-//complete without returning nonzero then the protocol will assume that no
-//resume UI was available and will continue the file receive with a default
-//behaviour (overwrite for ICQ). If a hook does return nonzero then that UI
-//must call this function, PS_FILERESUME, at some point. When the protocol
-//module receives this call it will proceed with the file receive using the
-//given information.
-//Having said that PS_FILERESUME must be called, it is also acceptable to call
-//PSS_FILECANCEL to completely abort the transfer instead.
+///////////////////////////////////////////////////////////////////////////////
+// Informs the protocol of the users chosen resume behaviour
+// wParam = (WPARAM)(HANDLE)hFileTransfer
+// lParam = (LPARAM)(PROTOFILERESUME*)&pfr
+// Returns 0 on success, nonzero on failure
+// If the protocol supports file resume (PF1_FILERESUME) then before each
+// individual file receive begins (note: not just each file that already exists)
+// it will broadcast an ack with type = ACKTYPE_FILE, result = ACKRESULT_RESUME,
+// hProcess = hFileTransfer, lParam = (LPARAM)(PROTOFILETRANSFERSTATUS*)&fts. If the
+// UI processes this ack it must return nonzero from its hook. If all the hooks
+// complete without returning nonzero then the protocol will assume that no
+// resume UI was available and will continue the file receive with a default
+// behaviour (overwrite for ICQ). If a hook does return nonzero then that UI
+// must call this function, PS_FILERESUME, at some point. When the protocol
+// module receives this call it will proceed with the file receive using the
+// given information.
+// Having said that PS_FILERESUME must be called, it is also acceptable to call
+// PSS_FILECANCEL to completely abort the transfer instead.
+
#define FILERESUME_OVERWRITE 1
#define FILERESUME_RESUME 2
#define FILERESUME_RENAME 3
#define FILERESUME_SKIP 4
+
typedef struct {
- int action; //a FILERESUME_ flag
+ int action; // a FILERESUME_ flag
const TCHAR *szFilename; // full path. Only valid if action == FILERESUME_RENAME
} PROTOFILERESUME;
+
#define PS_FILERESUME "/FileResume"
-#define PS_FILERESUMEW "/FileResumeW"
-//Asks a protocol to join the chatroom from contact v0.8.0+
-//wParam = (MCONTACT)hContact
-//lParam = 0
-//Returns 0 on success, nonzero on failure
+///////////////////////////////////////////////////////////////////////////////
+// Asks a protocol to join the chatroom from contact v0.8.0+
+// wParam = (MCONTACT)hContact
+// lParam = 0
+// Returns 0 on success, nonzero on failure
+
#define PS_JOINCHAT "/JoinChat"
-//Asks a protocol to leave the chatroom from contact v0.8.0+
-//wParam = (MCONTACT)hContact
-//lParam = 0
-//Returns 0 on success, nonzero on failure
+///////////////////////////////////////////////////////////////////////////////
+// Asks a protocol to leave the chatroom from contact v0.8.0+
+// wParam = (MCONTACT)hContact
+// lParam = 0
+// Returns 0 on success, nonzero on failure
+
#define PS_LEAVECHAT "/LeaveChat"
-//Asks a protocol to read contact information and translate them (for a lookup fields) v0.8.0+
-//wParam = (MCONTACT)hContact
-//lParam = (LPARAM)(DBCONTACTGETSETTING*)&dbcgs
-//The flag PF4_INFOSETTINGSVC indicates that a protocol supports this. Basically it should
-//do the same as MS_DB_CONTACT_GETSETTING_STR, except that for a lookup settings (e.g. Language)
-//it returns string instead of an ID stored in the database.
-//Caller is responsible for free()ing dbcgs.pValue->pszVal and pbVal if they are
-//returned. You must **NOT** do this from your version of free() you have to use Miranda's free()
-//you can get a function pointer to Miranda's free() via MS_SYSTEM_GET_MMI, see m_system.h
-//Returns 0 on success or nonzero if the setting name was not found or hContact
-//was invalid
+///////////////////////////////////////////////////////////////////////////////
+// Asks a protocol to read contact information and translate them (for a lookup fields)
+// wParam = (MCONTACT)hContact
+// lParam = (LPARAM)(DBCONTACTGETSETTING*)&dbcgs
+// The flag PF4_INFOSETTINGSVC indicates that a protocol supports this. Basically it should
+// do the same as MS_DB_CONTACT_GETSETTING_STR, except that for a lookup settings (e.g. Language)
+// it returns string instead of an ID stored in the database.
+// Caller is responsible for free()ing dbcgs.pValue->pszVal and pbVal if they are
+// returned. You must **NOT** do this from your version of free() you have to use Miranda's free()
+// you can get a function pointer to Miranda's free() via MS_SYSTEM_GET_MMI, see m_system.h
+// Returns 0 on success or nonzero if the setting name was not found or hContact
+// was invalid
+
#define PS_GETINFOSETTING "/GetInfoSetting"
+///////////////////////////////////////////////////////////////////////////////
// Asks protocol for the status message for a status
// wParam = (WORD) 0 for current status or a status id
// lParam = SGMA_xxx
@@ -483,6 +532,7 @@ typedef struct {
#define PS_GETMYAWAYMSG "/GetMyAwayMsg"
+///////////////////////////////////////////////////////////////////////////////
// Set nickname for the user
// wParam = (WPARAM)SMNN_xxx
// lParam = (LPARAM)(char *) The new nickname for the user
@@ -497,11 +547,13 @@ typedef struct {
#define PS_SETMYNICKNAME "/SetNickname"
+///////////////////////////////////////////////////////////////////////////////
// Get the max allowed length for the user nickname
// Optional, default value is 1024
// wParam = 0
// lParam = 0
// return = <= 0 for error, >0 the max length of the nick
+
#define PS_GETMYNICKNAMEMAXLENGTH "/GetMyNicknameMaxLength"
// WAYD = What are you doing
@@ -512,181 +564,212 @@ typedef struct {
#define WAYD_TCHAR 0
#endif
+///////////////////////////////////////////////////////////////////////////////
// Get the WAYD message for the user
// wParam = (WPARAM)WAYD_xxx
// lParam = 0
// Returns the text or NULL if there is none. Remember to mir_free the return value.
+
#define PS_GETMYWAYD "/GetMyWAYD"
+///////////////////////////////////////////////////////////////////////////////
// Sets the WAYD message for the user
// wParam = (WPARAM)WAYD_xxx
// lParam = (LPARAM)(WCHAR * or char *)The message
// Returns 0 on success, nonzero on failure
+
#define PS_SETMYWAYD "/SetMyWAYD"
+///////////////////////////////////////////////////////////////////////////////
// Get the max allowed length that a WAYD message can have
// Optional, default value is 1024
// wParam = 0
// lParam = 0
// Returns the max length
+
#define PS_GETMYWAYDMAXLENGTH "/GetMyWAYDMaxLength"
+///////////////////////////////////////////////////////////////////////////////
// Get the unread email message count, optional
// wParam = 0
// lParam = 0
// Returns the number of unread emails
+
#define PS_GETUNREADEMAILCOUNT "/GetUnreadEmailCount"
-/****************************** SENDING SERVICES *************************/
-//these should be called with CallContactService()
-
-//Updates a contact's details from the server
-//wParam = flags
-//lParam = 0
-//returns 0 on success, nonzero on failure
-//Will update all the information in the database, and then send acks with
-//type = ACKTYPE_GETINFO, result = ACKRESULT_SUCCESS, hProcess = (HANDLE)(int)nReplies, lParam = thisReply
-//Since some protocols do not allow the library to tell when it has got all
-//the information so it can send a final ack, one ack will be sent after each
-//chunk of data has been received. nReplies contains the number of distinct
-//acks that will be sent to get all the information, thisReply is the zero-
-//based index of this ack. When thisReply = 0 the 'minimal' information has just
-//been received. All other numbering is arbitrary.
-#define SGIF_MINIMAL 1 //get only the most basic information. This should
- //contain at least a Nick and e-mail.
-#define SGIF_ONOPEN 2 //set when the User Info form is being opened
+///////////////////////////////////////////////////////////////////////////////
+// SENDING SERVICES
+// these should be called with CallContactService()
+
+// Updates a contact's details from the server
+// wParam = flags
+// lParam = 0
+// returns 0 on success, nonzero on failure
+// Will update all the information in the database, and then send acks with
+// type = ACKTYPE_GETINFO, result = ACKRESULT_SUCCESS, hProcess = (HANDLE)(int)nReplies, lParam = thisReply
+// Since some protocols do not allow the library to tell when it has got all
+// the information so it can send a final ack, one ack will be sent after each
+// chunk of data has been received. nReplies contains the number of distinct
+// acks that will be sent to get all the information, thisReply is the zero-
+// based index of this ack. When thisReply = 0 the 'minimal' information has just
+// been received. All other numbering is arbitrary.
+
+#define SGIF_MINIMAL 1 // get only the most basic information. This should
+ // contain at least a Nick and e-mail.
+#define SGIF_ONOPEN 2 // set when the User Info form is being opened
#define PSS_GETINFO "/GetInfo"
-//Send an instant message
-//wParam = flags
-//lParam = (LPARAM)(const char*)szMessage
-//returns a hProcess corresponding to the one in the ack event.
-//Will send an ack when the message actually gets sent
-//type = ACKTYPE_MESSAGE, result = success/failure, (char*)lParam = error message or NULL.
-//Protocols modules are free to define flags starting at 0x10000
-//The event will *not* be added to the database automatically.
+///////////////////////////////////////////////////////////////////////////////
+// Send an instant message
+// wParam = flags
+// lParam = (LPARAM)(const char*)szMessage
+// returns a hProcess corresponding to the one in the ack event.
+// Will send an ack when the message actually gets sent
+// type = ACKTYPE_MESSAGE, result = success/failure, (char*)lParam = error message or NULL.
+// Protocols modules are free to define flags starting at 0x10000
+// The event will *not* be added to the database automatically.
+
#define PSS_MESSAGE "/SendMsg"
-//Send an URL message
-//wParam = flags
-//lParam = (LPARAM)(const char*)szMessage
-//returns a hProcess corresponding to the one in the ack event.
-//szMessage should be encoded as the URL followed by the description, the
-//separator being a single nul (\0). If there is no description, do not forget
-//to end the URL with two nuls.
-//Will send an ack when the message actually gets sent
-//type = ACKTYPE_URL, result = success/failure, (char*)lParam = error message or NULL.
-//Protocols modules are free to define flags starting at 0x10000
-//The event will *not* be added to the database automatically.
+///////////////////////////////////////////////////////////////////////////////
+// Send an URL message
+// wParam = flags
+// lParam = (LPARAM)(const char*)szMessage
+// returns a hProcess corresponding to the one in the ack event.
+// szMessage should be encoded as the URL followed by the description, the
+// separator being a single nul (\0). If there is no description, do not forget
+// to end the URL with two nuls.
+// Will send an ack when the message actually gets sent
+// type = ACKTYPE_URL, result = success/failure, (char*)lParam = error message or NULL.
+// Protocols modules are free to define flags starting at 0x10000
+// The event will *not* be added to the database automatically.
+
#define PSS_URL "/SendUrl"
-//Send a set of contacts
-//wParam = MAKEWPARAM(flags, nContacts)
-//lParam = (LPARAM)(HANDLE*)hContactsList
-//returns a hProcess corresponding to the one in the ack event, NULL on
-//failure.
-//hContactsList is an array of nContacts handles to contacts. If this array
-//includes one or more contacts that cannot be transferred using this protocol
-//the function will fail.
-//Will send an ack when the contacts actually get sent
-//type = ACKTYPE_CONTACTS, result = success/failure, (char*)lParam = error message or NULL.
-//No flags have yet been defined.
-//The event will *not* be added to the database automatically.
+///////////////////////////////////////////////////////////////////////////////
+// Send a set of contacts
+// wParam = MAKEWPARAM(flags, nContacts)
+// lParam = (LPARAM)(HANDLE*)hContactsList
+// returns a hProcess corresponding to the one in the ack event, NULL on
+// failure.
+// hContactsList is an array of nContacts handles to contacts. If this array
+// includes one or more contacts that cannot be transferred using this protocol
+// the function will fail.
+// Will send an ack when the contacts actually get sent
+// type = ACKTYPE_CONTACTS, result = success/failure, (char*)lParam = error message or NULL.
+// No flags have yet been defined.
+// The event will *not* be added to the database automatically.
+
#define PSS_CONTACTS "/SendContacts"
-//Send a request to retrieve somebody's mode message.
-//wParam = lParam = 0
-//returns an hProcess identifying the request, or 0 on failure
-//This function will fail if the contact's current status mode doesn't have an
-//associated message
-//The reply will be in the form of an ack:
-//type = ACKTYPE_AWAYMSG, result = success/failure, lParam = (const char*)szMessage
+///////////////////////////////////////////////////////////////////////////////
+// Send a request to retrieve somebody's mode message.
+// wParam = lParam = 0
+// returns an hProcess identifying the request, or 0 on failure
+// This function will fail if the contact's current status mode doesn't have an
+// associated message
+// The reply will be in the form of an ack:
+// type = ACKTYPE_AWAYMSG, result = success/failure, lParam = (const char*)szMessage
+
#define PSS_GETAWAYMSG "/GetAwayMsg"
-//Allows a file transfer to begin
-//wParam = (WPARAM)(HANDLE)hTransfer
-//lParam = (LPARAM)(const TCHAR*)szPath
-//Returns a new handle to the transfer, to be used from now on
-//If szPath does not point to a directory then:
+///////////////////////////////////////////////////////////////////////////////
+// Allows a file transfer to begin
+// wParam = (WPARAM)(HANDLE)hTransfer
+// lParam = (LPARAM)(const TCHAR*)szPath
+// Returns a new handle to the transfer, to be used from now on
+// If szPath does not point to a directory then:
// if a single file is being transferred and the protocol supports file
// renaming (PF1_CANRENAMEFILE) then the file is given this name
// otherwise the filename is removed and the file(s) are placed in the
// resulting directory
-//File transfers are marked by an EVENTTYPE_FILE added to the database. The
-//format is:
-//DWORD hTransfer
-//ASCIIZ filename(s), description
+// File transfers are marked by an EVENTTYPE_FILE added to the database. The
+// format is:
+// DWORD hTransfer
+// ASCIIZ filename(s), description
+
#define PSS_FILEALLOW "/FileAllow"
-#define PSS_FILEALLOWW "/FileAllowW"
-//Refuses a file transfer request
-//wParam = (WPARAM)(HANDLE)hTransfer
-//lParam = (LPARAM)(const TCHAR*)szReason
-//Returns 0 on success, nonzero on failure
+///////////////////////////////////////////////////////////////////////////////
+// Refuses a file transfer request
+// wParam = (WPARAM)(HANDLE)hTransfer
+// lParam = (LPARAM)(const TCHAR*)szReason
+// Returns 0 on success, nonzero on failure
+
#define PSS_FILEDENY "/FileDeny"
-#define PSS_FILEDENYW "/FileDenyW"
-//Cancel an in-progress file transfer
-//wParam = (WPARAM)(HANDLE)hTransfer
-//lParam = 0
-//Returns 0 on success, nonzero on failure
+///////////////////////////////////////////////////////////////////////////////
+// Cancel an in-progress file transfer
+// wParam = (WPARAM)(HANDLE)hTransfer
+// lParam = 0
+// Returns 0 on success, nonzero on failure
+
#define PSS_FILECANCEL "/FileCancel"
-//Initiate a file send
-//wParam = (WPARAM)(const TCHAR*)szDescription
-//lParam = (LPARAM)(TCHAR **)ppszFiles
-//Returns a transfer handle on success, NULL on failure
-//All notification is done through acks, with type = ACKTYPE_FILE
-//If result = ACKRESULT_FAILED then lParam = (LPARAM)(const char*)szReason
+///////////////////////////////////////////////////////////////////////////////
+// Initiate a file send
+// wParam = (WPARAM)(const TCHAR*)szDescription
+// lParam = (LPARAM)(TCHAR **)ppszFiles
+// Returns a transfer handle on success, NULL on failure
+// All notification is done through acks, with type = ACKTYPE_FILE
+// If result = ACKRESULT_FAILED then lParam = (LPARAM)(const char*)szReason
+
#define PSS_FILE "/SendFile"
-#define PSS_FILEW "/SendFileW"
-
-//Set the status mode you will appear in to a user
-//wParam = statusMode
-//lParam = 0
-//Returns 0 on success, nonzero on failure
-//Set statusMode = 0 to revert to normal behaviour for the contact
-//ID_STATUS_ONLINE is possible iff PF1_VISLIST
-//ID_STATUS_OFFLINE is possible iff PF1_INVISLIST
-//Other modes are possible iff PF1_INDIVSTATUS
+
+///////////////////////////////////////////////////////////////////////////////
+// Set the status mode you will appear in to a user
+// wParam = statusMode
+// lParam = 0
+// Returns 0 on success, nonzero on failure
+// Set statusMode = 0 to revert to normal behaviour for the contact
+// ID_STATUS_ONLINE is possible iff PF1_VISLIST
+// ID_STATUS_OFFLINE is possible iff PF1_INVISLIST
+// Other modes are possible iff PF1_INDIVSTATUS
+
#define PSS_SETAPPARENTMODE "/SetApparentMode"
+///////////////////////////////////////////////////////////////////////////////
// Send an auth request
// wParam = 0
// lParam = (const TCHAR *)szMessage
// Returns 0 on success, nonzero on failure
+
#define PSS_AUTHREQUEST "/AuthRequest"
-#define PSS_AUTHREQUESTW "/AuthRequestW"
+///////////////////////////////////////////////////////////////////////////////
// Send "User is Typing" (user is typing a message to the user) v0.3.3+
// wParam = (MCONTACT)hContact
// lParam = (LPARAM)(int)typing type - see PROTOTYPE_SELFTYPING_X defines in m_protocols.h
+
#define PSS_USERISTYPING "/UserIsTyping"
-/**************************** RECEIVING SERVICES *************************/
-//These services are not for calling by general modules. They serve a specific
-//role in communicating through protocol module chains before the whole app is
-//notified that an event has occurred.
-//When the respective event is received over the network, the network-level
-//protocol module initiates the chain by calling MS_PROTO_CHAINRECV with wParam
-//set to zero and lParam pointing to the CCSDATA structure.
-//Protocol modules should continue the message up the chain by calling
-//MS_PROTO_CHAINRECV with the same wParam they received and a modified (or not)
-//lParam (CCSDATA). If they do not do this and return nonzero then all further
-//processing for the event will cease and the event will be ignored.
-//Once all non-network protocol modules have been called (in reverse order),
-//the network protocol module will be called so that it can finish its
-//processing using the modified information.
-//This final processing should consist of the protocol module adding the
-//event to the database, and it is the ME_DB_EVENT_ADDED event that people who
-//just want to know the final result should hook.
-//In all cases, the database should store what the user read/wrote.
-
-//An instant message has been received
-//wParam = 0
-//lParam = (LPARAM)(PROTORECVEVENT*)&pre
-//DB event: EVENTTYPE_MESSAGE, blob contains szMessage without 0 terminator
-//Return 0 - success, other failure
+///////////////////////////////////////////////////////////////////////////////
+// RECEIVING SERVICES
+
+// These services are not for calling by general modules. They serve a specific
+// role in communicating through protocol module chains before the whole app is
+// notified that an event has occurred.
+// When the respective event is received over the network, the network-level
+// protocol module initiates the chain by calling MS_PROTO_CHAINRECV with wParam
+// set to zero and lParam pointing to the CCSDATA structure.
+// Protocol modules should continue the message up the chain by calling
+// MS_PROTO_CHAINRECV with the same wParam they received and a modified (or not)
+// lParam (CCSDATA). If they do not do this and return nonzero then all further
+// processing for the event will cease and the event will be ignored.
+// Once all non-network protocol modules have been called (in reverse order),
+// the network protocol module will be called so that it can finish its
+// processing using the modified information.
+// This final processing should consist of the protocol module adding the
+// event to the database, and it is the ME_DB_EVENT_ADDED event that people who
+// just want to know the final result should hook.
+// In all cases, the database should store what the user read/wrote.
+
+// An instant message has been received
+// wParam = 0
+// lParam = (LPARAM)(PROTORECVEVENT*)&pre
+// DB event: EVENTTYPE_MESSAGE, blob contains szMessage without 0 terminator
+// Return 0 - success, other failure
+
typedef struct {
DWORD flags;
DWORD timestamp; // unix time
@@ -696,16 +779,17 @@ typedef struct {
DWORD cbCustomDataSize;
} PROTORECVEVENT;
-#define PREF_CREATEREAD 1 //create the database event with the 'read' flag set
+#define PREF_CREATEREAD 1 // create the database event with the 'read' flag set
#define PREF_RTL 4 // 0.5+ addition: support for right-to-left messages
#define PREF_SENT 16 // message will be created with the DBEF_SENT flag
-/* Proto/RecvMessage
-Copies a message from a PROTORECVEVENT event into the database
- wParam = 0 (unused)
- lParam = CCSDATA*
-Returns the result of db_event_add()
-*/
+///////////////////////////////////////////////////////////////////////////////
+// Proto/RecvMessage
+// Copies a message from a PROTORECVEVENT event into the database
+// wParam = 0 (unused)
+// lParam = CCSDATA*
+// Returns the result of db_event_add()
+
#define PSR_MESSAGE "/RecvMessage"
#define MS_PROTO_RECVMSG "Proto/RecvMessage"
@@ -713,15 +797,16 @@ Returns the result of db_event_add()
__forceinline INT_PTR Proto_RecvMessage(MCONTACT hContact, PROTORECVEVENT *pcre)
{
CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)pcre };
- return CallService(MS_PROTO_RECVMSG, 0, (LPARAM)&ccs );
+ return CallService(MS_PROTO_RECVMSG, 0, (LPARAM)&ccs);
}
-/* Proto/AuthRecv
-Copies the EVENTTYPE_AUTHREQUEST event from PROTORECVEVENT into DBEVENTINFO and adds it
- wParam = char* : protocol name
- lParam = PROTORECVEVENT*
-Returns the result of db_event_add()
-*/
+///////////////////////////////////////////////////////////////////////////////
+// Proto/AuthRecv
+// Copies the EVENTTYPE_AUTHREQUEST event from PROTORECVEVENT into DBEVENTINFO and adds it
+// wParam = char* : protocol name
+// lParam = PROTORECVEVENT*
+// Returns the result of db_event_add()
+
#define PSR_AUTH "/RecvAuth"
#define MS_PROTO_AUTHRECV "Proto/AuthRecv"
@@ -730,6 +815,7 @@ __forceinline INT_PTR Proto_AuthRecv(const char *szProtoName, PROTORECVEVENT *pc
{ return CallService(MS_PROTO_AUTHRECV, (WPARAM)szProtoName, (LPARAM)pcre);
}
+///////////////////////////////////////////////////////////////////////////////
// File(s) have been received
// wParam = 0
// lParam = (LPARAM)(PROTORECVFILET*)&prf
@@ -742,18 +828,12 @@ __forceinline INT_PTR Proto_AuthRecv(const char *szProtoName, PROTORECVEVENT *pc
#endif
typedef struct {
- DWORD dwFlags; // PRFF_*
- DWORD timestamp; // unix time
- union {
- char *szDescription; // utf8
- TCHAR *tszDescription; // TCHAR*, if PRFF_TCHAR is specified
- };
- int fileCount;
- union {
- char **pszFiles; // utf8
- TCHAR **ptszFiles; // TCHAR*, if PRFF_TCHAR is specified
- };
- LPARAM lParam; // extra space for the network level protocol module
+ DWORD dwFlags; // PRFF_*
+ DWORD timestamp; // unix time
+ MAllStrings descr; // file description
+ int fileCount; // number of files being transferred
+ MAllStringArray files; // array of file names
+ LPARAM lParam; // extra space for the network level protocol module
} PROTORECVFILET;
#define PSR_FILE "/RecvFile"
@@ -763,16 +843,19 @@ typedef struct {
__forceinline INT_PTR Proto_RecvFile(MCONTACT hContact, PROTORECVFILET *pcre)
{
CCSDATA ccs = { hContact, PSR_FILE, 0, (LPARAM)pcre };
- return CallService(MS_PROTO_RECVFILET, 0, ( LPARAM )&ccs);
+ return CallService(MS_PROTO_RECVFILET, 0, (LPARAM)&ccs);
}
+///////////////////////////////////////////////////////////////////////////////
// An URL has been received
// wParam = 0
// lParam = (LPARAM)(PROTORECVEVENT*)&pre
// szMessage is encoded the same as for PSS_URL
// DB event: EVENTTYPE_URL, blob contains szMessage without 0 terminator
+
#define PSR_URL "/RecvUrl"
+///////////////////////////////////////////////////////////////////////////////
// Contacts have been received
// wParam = 0
// lParam = (LPARAM)(PROTORECVEVENT*)&pre
@@ -780,54 +863,28 @@ __forceinline INT_PTR Proto_RecvFile(MCONTACT hContact, PROTORECVFILET *pcre)
// pre.lParam is the number of contacts in that list.
// pre.flags can contain PREF_UTF defining the strings as utf-8 encoded (0.7.0+)
// PS_ADDTOLIST can be used to add the contacts to the contact list.
+
#define PSR_CONTACTS "/RecvContacts"
-/* contacts database event format (EVENTTYPE_CONTACTS)
-repeat {
- ASCIIZ userNick
- ASCIIZ userId
-}
-userNick should be a human-readable description of the user. It need not
-be the nick, or even confined to displaying just one type of
-information. The dbe.flags can contain DBEF_UTF defining userNick as utf-8
-encoded.
-userId should be a machine-readable representation of the unique
-protocol identifying field of the user. Because of the need to be
-zero-terminated, binary data should be converted to text.
-Use PS_ADDTOLISTBYEVENT to add the contacts from one of these to the list.
-*/
+///////////////////////////////////////////////////////////////////////////////
+// contacts database event format (EVENTTYPE_CONTACTS)
+// repeat {
+// ASCIIZ userNick
+// ASCIIZ userId
+// }
+// userNick should be a human-readable description of the user. It need not
+// be the nick, or even confined to displaying just one type of information.
+// The dbe.flags can contain DBEF_UTF defining userNick as utf-8 encoded.
+//
+// userId should be a machine-readable representation of the unique
+// protocol identifying field of the user. Because of the need to be
+// zero-terminated, binary data should be converted to text.
+// Use PS_ADDTOLISTBYEVENT to add the contacts from one of these to the list.
// An away message reply has been received
// wParam = statusMode
// lParam = (LPARAM)(PROTORECVEVENT*)&pre
-#define PSR_AWAYMSG "/RecvAwayMsg"
-#ifdef _UNICODE
-
-#define PS_SETAWAYMSGT PS_SETAWAYMSGW
-#define PSS_FILET PSS_FILEW
-#define PSS_FILEALLOWT PSS_FILEALLOWW
-#define PSS_FILEDENYT PSS_FILEDENYW
-#define PSS_AUTHREQUESTT PSS_AUTHREQUESTW
-#define PS_AUTHDENYT PS_AUTHDENYW
-#define PS_FILERESUMET PS_FILERESUMEW
-#define PS_BASICSEARCHT PS_BASICSEARCHW
-#define PS_SEARCHBYNAMET PS_SEARCHBYNAMEW
-#define PS_SEARCHBYEMAILT PS_SEARCHBYEMAILW
-
-#else
-
-#define PS_SETAWAYMSGT PS_SETAWAYMSG
-#define PSS_FILET PSS_FILE
-#define PSS_FILEALLOWT PSS_FILEALLOW
-#define PSS_FILEDENYT PSS_FILEDENY
-#define PSS_AUTHREQUESTT PSS_AUTHREQUEST
-#define PS_AUTHDENYT PS_AUTHDENY
-#define PS_FILERESUMET PS_FILERESUME
-#define PS_BASICSEARCHT PS_BASICSEARCH
-#define PS_SEARCHBYNAMET PS_SEARCHBYNAME
-#define PS_SEARCHBYEMAILT PS_SEARCHBYEMAIL
-
-#endif
+#define PSR_AWAYMSG "/RecvAwayMsg"
#endif // M_PROTOSVC_H__
diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp
index 723c308338..4e285068a1 100644
--- a/plugins/AddContactPlus/src/addcontact.cpp
+++ b/plugins/AddContactPlus/src/addcontact.cpp
@@ -294,11 +294,11 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM)
if (IsDlgButtonChecked(hdlg, IDC_AUTH)) {
DWORD flags = CallProtoService(acs->proto, PS_GETCAPS, PFLAGNUM_4, 0);
if (flags & PF4_NOCUSTOMAUTH)
- CallContactService(hContact, PSS_AUTHREQUESTT, 0, 0);
+ CallContactService(hContact, PSS_AUTHREQUEST, 0, 0);
else {
TCHAR szReason[512];
GetDlgItemText(hdlg, IDC_AUTHREQ, szReason, SIZEOF(szReason));
- CallContactService(hContact, PSS_AUTHREQUESTT, 0, (LPARAM)szReason);
+ CallContactService(hContact, PSS_AUTHREQUEST, 0, (LPARAM)szReason);
}
}
}
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp
index 97e20e9dc8..4838940312 100644
--- a/plugins/BossKeyPlus/src/BossKey.cpp
+++ b/plugins/BossKeyPlus/src/BossKey.cpp
@@ -202,14 +202,8 @@ TCHAR* GetDefStatusMsg(unsigned uStatus, const char* szProto)
void SetStatus(const char* szProto, unsigned status, TCHAR *tszAwayMsg)
{
if (tszAwayMsg && CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)
- {
- if (CallProtoService(szProto, PS_SETAWAYMSGT, status, (LPARAM)tszAwayMsg) == CALLSERVICE_NOTFOUND)
- {
- char *szAwayMsg = mir_t2a(tszAwayMsg);
- CallProtoService(szProto, PS_SETAWAYMSG, status, (LPARAM)szAwayMsg);
- mir_free(szAwayMsg);
- }
- }
+ CallProtoService(szProto, PS_SETAWAYMSG, status, (LPARAM)tszAwayMsg);
+
CallProtoService(szProto, PS_SETSTATUS, status, 0);
}
diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
index 32eaf32610..387df80cda 100644
--- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp
+++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
@@ -864,33 +864,30 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
hInst = hinstDLL;
return TRUE;
}
+
extern "C" int __declspec(dllexport) Load(void)
{
- char service[100] = { "" };
-
- PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
-
#ifdef _DEBUG
_OutputDebugString(_T("Entering Load dll"));
#endif
mir_getLP(&pluginInfo);
- //hCurrentEditMutex=CreateMutex(NULL,FALSE,_T("CurrentEditMutex"));
hExceptionsMutex = CreateMutex(NULL, FALSE, _T("ExceptionsMutex"));
LoadSettings();
connExceptions = LoadSettingsConnections();
- //create protocol
- //memset(&pd, 0, sizeof(pd));
- //pd.cbSize=sizeof(pd);
+
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = PLUGINNAME;
pd.type = PROTOTYPE_PROTOCOL;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
- //set all contacts to offline
+ //set all contacts to offline
for (MCONTACT hContact = db_find_first(PLUGINNAME); hContact != NULL; hContact = db_find_next(hContact, PLUGINNAME))
db_set_w(hContact, PLUGINNAME, "status", ID_STATUS_OFFLINE);
+ char service[100] = { "" };
mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_GETCAPS);
CreateServiceFunction(service, GetCaps);
mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_GETNAME);
@@ -902,7 +899,6 @@ extern "C" int __declspec(dllexport) Load(void)
mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_GETSTATUS);
CreateServiceFunction(service, GetStatus);
-
SkinAddNewSoundEx(PLUGINNAME_NEWSOUND, PLUGINNAME, LPGEN("New Connection Notification"));
hOptInit = HookEvent(ME_OPT_INITIALISE, ConnectionNotifyOptInit);//register service to hook option call
assert(hOptInit);
diff --git a/plugins/CryptoPP/src/main.cpp b/plugins/CryptoPP/src/main.cpp
index e6dfac13f3..8cb9bfa2b9 100644
--- a/plugins/CryptoPP/src/main.cpp
+++ b/plugins/CryptoPP/src/main.cpp
@@ -53,7 +53,8 @@ extern "C" __declspec(dllexport) int Load()
mir_getLP(&pluginInfoEx);
// register plugin module
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = (char*)szModuleName;
pd.type = PROTOTYPE_ENCRYPTION;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
diff --git a/plugins/CyrTranslit/src/TransliterationProtocol.cpp b/plugins/CyrTranslit/src/TransliterationProtocol.cpp
index f49359cb36..27940f86ac 100644
--- a/plugins/CyrTranslit/src/TransliterationProtocol.cpp
+++ b/plugins/CyrTranslit/src/TransliterationProtocol.cpp
@@ -28,7 +28,8 @@ char *TransliterationProtocol::MODULE_NAME = "ProtoCyrTranslitByIKR";
void TransliterationProtocol::initialize()
{
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = MODULE_NAME;
pd.type = PROTOTYPE_TRANSLATION;
CallService(MS_PROTO_REGISTERMODULE, 0, reinterpret_cast<LPARAM>(&pd));
diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp
index 6f8c84c2f0..75a8f6389e 100644
--- a/plugins/Dropbox/src/dropbox.cpp
+++ b/plugins/Dropbox/src/dropbox.cpp
@@ -2,7 +2,8 @@
CDropbox::CDropbox() : transfers(1, HandleKeySortT)
{
- PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = MODULE;
pd.type = PROTOTYPE_VIRTUAL;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
@@ -19,7 +20,7 @@ CDropbox::CDropbox() : transfers(1, HandleKeySortT)
CreateProtoServiceFunction(MODULE, PS_GETNAME, ProtoGetName);
CreateProtoServiceFunction(MODULE, PS_LOADICON, ProtoLoadIcon);
CreateProtoServiceFunctionObj(PS_GETSTATUS, GlobalService<&CDropbox::ProtoGetStatus>, this);
- CreateProtoServiceFunctionObj(PSS_FILEW, GlobalService<&CDropbox::ProtoSendFile>, this);
+ CreateProtoServiceFunctionObj(PSS_FILE, GlobalService<&CDropbox::ProtoSendFile>, this);
CreateProtoServiceFunctionObj(PSS_FILECANCEL, GlobalService<&CDropbox::ProtoCancelFile>, this);
CreateProtoServiceFunctionObj(PSS_MESSAGE, GlobalService<&CDropbox::ProtoSendMessage>, this);
CreateProtoServiceFunction(MODULE, PSR_MESSAGE, ProtoReceiveMessage);
diff --git a/plugins/Dropbox/src/dropbox_commands.cpp b/plugins/Dropbox/src/dropbox_commands.cpp
index a5e09c6fb7..dc4fad8d76 100644
--- a/plugins/Dropbox/src/dropbox_commands.cpp
+++ b/plugins/Dropbox/src/dropbox_commands.cpp
@@ -49,8 +49,7 @@ void CDropbox::CommandContent(void *arg)
else
{
JSONNode content = root.at("contents").as_array();
- int size = content.size();
- for (int i = 0; i < content.size(); i++)
+ for (size_t i = 0; i < content.size(); i++)
{
JSONNode item = content[i];
if (item.empty())
diff --git a/plugins/FileAsMessage/src/main.cpp b/plugins/FileAsMessage/src/main.cpp
index fc3ce4b1c6..e54c6b8353 100644
--- a/plugins/FileAsMessage/src/main.cpp
+++ b/plugins/FileAsMessage/src/main.cpp
@@ -199,7 +199,8 @@ extern "C" __declspec(dllexport) int Load(void)
CreateServiceFunction(SERVICE_NAME "/FESendFile", OnSendFile);
CreateServiceFunction(SERVICE_NAME "/FERecvFile", OnRecvFile);
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = SERVICE_NAME;
pd.type = PROTOTYPE_FILTER;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp
index 75686cbd18..0e1094cd17 100644
--- a/plugins/ListeningTo/src/listeningto.cpp
+++ b/plugins/ListeningTo/src/listeningto.cpp
@@ -211,7 +211,7 @@ void RebuildMenu()
void RegisterProtocol(char *proto, TCHAR *account)
{
- if (!ProtoServiceExists(proto, PS_SET_LISTENINGTO) && !ProtoServiceExists(proto, PS_SETCUSTOMSTATUSEX) && !ProtoServiceExists(proto, PS_SETAWAYMSGT) && !ProtoServiceExists(proto, PS_SETAWAYMSG))
+ if (!ProtoServiceExists(proto, PS_SET_LISTENINGTO) && !ProtoServiceExists(proto, PS_SETCUSTOMSTATUSEX) && !ProtoServiceExists(proto, PS_SETAWAYMSG))
return;
size_t id = proto_items.size();
@@ -678,28 +678,15 @@ void SetListeningInfo(char *proto, LISTENINGTOINFO *lti = NULL)
mir_free(fr[1]);
}
}
- else if (db_get_b(0,MODULE_NAME,"UseStatusMessage",1) && (ProtoServiceExists(proto, PS_SETAWAYMSGT) || ProtoServiceExists(proto, PS_SETAWAYMSG)))
+ else if (db_get_b(0,MODULE_NAME,"UseStatusMessage",1) && ProtoServiceExists(proto, PS_SETAWAYMSG))
{
int status = CallProtoService(proto, PS_GETSTATUS, 0, 0);
if (lti == NULL)
- {
- INT_PTR ret = CallProtoService(proto, PS_SETAWAYMSGT, (WPARAM) status, 0);
- if(ret == CALLSERVICE_NOTFOUND)
- {
- CallProtoService(proto, PS_SETAWAYMSG, (WPARAM)status, 0);
- }
- }
+ CallProtoService(proto, PS_SETAWAYMSG, status, 0);
else
{
- TCHAR *fr = GetParsedFormat(lti);
- INT_PTR ret = CallProtoService(proto, PS_SETAWAYMSGT, (WPARAM)status, (LPARAM)fr);
- if(ret == CALLSERVICE_NOTFOUND)
- {
- char *info = mir_t2a(fr);
- CallProtoService(proto, PS_SETAWAYMSG, (WPARAM)status, (LPARAM)info);
- mir_free(info);
- }
- mir_free(fr);
+ ptrT fr(GetParsedFormat(lti));
+ CallProtoService(proto, PS_SETAWAYMSG, status, fr);
}
}
}
@@ -713,16 +700,11 @@ INT_PTR EnableListeningTo(char *proto,BOOL enabled)
{
// For all protocols
for (unsigned int i = 1; i < proto_items.size(); ++i)
- {
EnableListeningTo(proto_items[i].proto, enabled);
- }
}
else
{
- if (!ProtoServiceExists(proto, PS_SET_LISTENINGTO) &&
- !ProtoServiceExists(proto, PS_SETCUSTOMSTATUSEX) &&
- !ProtoServiceExists(proto, PS_SETAWAYMSGT) && // by yaho
- !ProtoServiceExists(proto, PS_SETAWAYMSG))
+ if (!ProtoServiceExists(proto, PS_SET_LISTENINGTO) && !ProtoServiceExists(proto, PS_SETCUSTOMSTATUSEX) && !ProtoServiceExists(proto, PS_SETAWAYMSG))
return 0;
char setting[256];
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp
index 10372c0246..177730bb9a 100644
--- a/plugins/LotusNotify/src/LotusNotify.cpp
+++ b/plugins/LotusNotify/src/LotusNotify.cpp
@@ -1630,7 +1630,8 @@ extern "C" int __declspec(dllexport) Load(void)
}
//create protocol
- PROTOCOLDESCRIPTOR pd = {PROTOCOLDESCRIPTOR_V3_SIZE};
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = PLUGINNAME;
pd.type = PROTOTYPE_PROTOCOL;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp
index 91631104cf..202a4589c5 100644
--- a/plugins/MenuItemEx/src/main.cpp
+++ b/plugins/MenuItemEx/src/main.cpp
@@ -402,7 +402,7 @@ INT_PTR CALLBACK AuthReqWndProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpara
{
TCHAR tszReason[256] = { 0 };
GetDlgItemText(hdlg, IDC_REASON, tszReason, SIZEOF(tszReason));
- CallContactService(hcontact, PSS_AUTHREQUESTT, 0, (LPARAM)tszReason);
+ CallContactService(hcontact, PSS_AUTHREQUEST, 0, (LPARAM)tszReason);
} // fall through
case IDCANCEL:
DestroyWindow(hdlg);
diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp
index 737add6ca9..e13f507caa 100644
--- a/plugins/MirFox/src/MirandaUtils.cpp
+++ b/plugins/MirFox/src/MirandaUtils.cpp
@@ -370,20 +370,13 @@ void MirandaUtils::setStatusOnAccount(ActionThreadArgStruct* args)
INT_PTR result = -1;
- if (!(CallProtoService(args->accountSzModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_INDIVMODEMSG)){
- result = CallProtoService(args->accountSzModuleName, PS_SETAWAYMSGW, (WPARAM)status, (LPARAM)args->userActionSelection);
- if (result == CALLSERVICE_NOTFOUND){
- char *szMsg = mir_u2a(args->userActionSelection);
- result = CallProtoService(args->accountSzModuleName, PS_SETAWAYMSG, (WPARAM)status, (LPARAM)szMsg);
- mir_free(szMsg);
- }
- }
+ if (!(CallProtoService(args->accountSzModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_INDIVMODEMSG))
+ result = CallProtoService(args->accountSzModuleName, PS_SETAWAYMSG, (WPARAM)status, (LPARAM)args->userActionSelection);
MirandaAccount* mirandaAccount = args->mirfoxDataPtr->getMirandaAccountPtrBySzModuleName(args->accountSzModuleName);
TCHAR* tszAccountName = NULL;
- if (mirandaAccount){
+ if (mirandaAccount)
tszAccountName = mirandaAccount->tszAccountName;
- }
wchar_t* buffer = new wchar_t[1024 * sizeof(wchar_t)];
if(result == 0){
diff --git a/plugins/MirOTR/src/dllmain.cpp b/plugins/MirOTR/src/dllmain.cpp
index 2b3bd3d31a..b798ccefc3 100644
--- a/plugins/MirOTR/src/dllmain.cpp
+++ b/plugins/MirOTR/src/dllmain.cpp
@@ -73,9 +73,10 @@ extern "C" __declspec(dllexport) int Load(void)
db_set_resident(MODULENAME, "TrustLevel");
- /////////////
- ////// init plugin
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ ////////////////////////////////////////////////////////////////////////////
+ // init plugin
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = MODULENAME;
pd.type = PROTOTYPE_ENCRYPTION;
CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp
index 52111dadcb..b011740b6e 100644
--- a/plugins/MyDetails/src/data.cpp
+++ b/plugins/MyDetails/src/data.cpp
@@ -240,7 +240,7 @@ void Protocol::SetStatusMsg(int aStatus, const TCHAR *message)
if (!CanSetStatusMsg(aStatus))
return;
- CallProtoService(name, PS_SETAWAYMSGT, (WPARAM)aStatus, (LPARAM)message);
+ CallProtoService(name, PS_SETAWAYMSG, (WPARAM)aStatus, (LPARAM)message);
}
bool Protocol::HasAvatar()
diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp
index 803f131970..9c42ba7ae0 100644
--- a/plugins/New_GPG/src/init.cpp
+++ b/plugins/New_GPG/src/init.cpp
@@ -154,7 +154,8 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam)
HookEvent(ME_MSG_WINDOWEVENT, onWindowEvent);
HookEvent(ME_MSG_ICONPRESSED, onIconPressed);
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = szGPGModuleName;
pd.type = PROTOTYPE_ENCRYPTION;
CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
diff --git a/plugins/NewsAggregator/Src/NewsAggregator.cpp b/plugins/NewsAggregator/Src/NewsAggregator.cpp
index cf05a5b469..5fc4edc8cc 100644
--- a/plugins/NewsAggregator/Src/NewsAggregator.cpp
+++ b/plugins/NewsAggregator/Src/NewsAggregator.cpp
@@ -68,7 +68,8 @@ extern "C" __declspec(dllexport) int Load(void)
hChangeFeedDlgList = WindowList_Create();
// register weather protocol
- PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = MODULE;
pd.type = PROTOTYPE_VIRTUAL;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp
index 6d3362a52a..feb7457e77 100644
--- a/plugins/SecureIM/src/main.cpp
+++ b/plugins/SecureIM/src/main.cpp
@@ -344,7 +344,8 @@ extern "C" __declspec(dllexport) int __cdecl Load(void)
}
// register plugin module
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = (char*)MODULENAME;
pd.type = PROTOTYPE_ENCRYPTION;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp
index 090d93f6a5..60a9880d06 100644
--- a/plugins/SendScreenshotPlus/src/CSend.cpp
+++ b/plugins/SendScreenshotPlus/src/CSend.cpp
@@ -296,7 +296,7 @@ void CSend::svcSendFileExit() {
TCHAR* pDesc = mir_tstrdup(m_pszFileDesc);
ppFile[0] = mir_tstrdup (m_pszFile);
ppFile[1] = NULL;
- m_hSend = (HANDLE)CallContactService(m_hContact, PSS_FILET, (WPARAM)pDesc, (LPARAM)ppFile);
+ m_hSend = (HANDLE)CallContactService(m_hContact, PSS_FILE, (WPARAM)pDesc, (LPARAM)ppFile);
mir_free(pDesc);
mir_free(ppFile[0]);
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp
index 9162be6f97..488610a156 100644
--- a/plugins/SimpleStatusMsg/src/main.cpp
+++ b/plugins/SimpleStatusMsg/src/main.cpp
@@ -624,16 +624,7 @@ int CheckProtoSettings(const char *szProto, int iInitialStatus)
static void Proto_SetAwayMsgT(const char *szProto, int iStatus, TCHAR *tszMsg)
{
if (!(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_INDIVMODEMSG))
- {
-
- if (CallProtoService(szProto, PS_SETAWAYMSGW, (WPARAM)iStatus, (LPARAM)tszMsg) == CALLSERVICE_NOTFOUND)
- {
- char *szMsg = mir_u2a(tszMsg);
- CallProtoService(szProto, PS_SETAWAYMSG, (WPARAM)iStatus, (LPARAM)szMsg);
- mir_free(szMsg);
- }
-
- }
+ CallProtoService(szProto, PS_SETAWAYMSG, (WPARAM)iStatus, (LPARAM)tszMsg);
}
static void Proto_SetStatus(const char *szProto, int iInitialStatus, int iStatus, TCHAR *tszMsg)
@@ -644,14 +635,7 @@ static void Proto_SetStatus(const char *szProto, int iInitialStatus, int iStatus
if (!(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_INDIVMODEMSG))
{
int iMsgStatus = CheckProtoSettings(szProto, iInitialStatus);
-
- if (CallProtoService(szProto, PS_SETAWAYMSGW, (WPARAM)iMsgStatus, (LPARAM)tszMsg) == CALLSERVICE_NOTFOUND)
- {
- char *szMsg = mir_u2a(tszMsg);
- CallProtoService(szProto, PS_SETAWAYMSG, (WPARAM)iMsgStatus, (LPARAM)szMsg);
- mir_free(szMsg);
- }
-
+ CallProtoService(szProto, PS_SETAWAYMSG, (WPARAM)iMsgStatus, (LPARAM)tszMsg);
CallProtoService(szProto, PS_SETSTATUS, (WPARAM)iMsgStatus, 0);
}
if (ServiceExists(MS_KS_ANNOUNCESTATUSCHANGE))
diff --git a/plugins/StatusPlugins/commonstatus.cpp b/plugins/StatusPlugins/commonstatus.cpp
index 2f4786f33b..f0423a24cc 100644
--- a/plugins/StatusPlugins/commonstatus.cpp
+++ b/plugins/StatusPlugins/commonstatus.cpp
@@ -196,11 +196,7 @@ static void SetStatusMsg(PROTOCOLSETTINGEX *ps, int newstatus)
}
}
log_debugA("CommonStatus sets status message for %s directly", ps->szName);
- if (CALLSERVICE_NOTFOUND == CallProtoService(ps->szName, PS_SETAWAYMSGT, newstatus, (LPARAM)tszMsg)) {
- char* sMsg = mir_t2a(tszMsg);
- CallProtoService(ps->szName, PS_SETAWAYMSG, newstatus, (LPARAM)sMsg);
- mir_free(sMsg);
- }
+ CallProtoService(ps->szName, PS_SETAWAYMSG, newstatus, (LPARAM)tszMsg);
mir_free(tszMsg);
}
diff --git a/plugins/StopSpamMod/src/stopspam.cpp b/plugins/StopSpamMod/src/stopspam.cpp
index a719850cb1..8d18c14759 100755
--- a/plugins/StopSpamMod/src/stopspam.cpp
+++ b/plugins/StopSpamMod/src/stopspam.cpp
@@ -213,7 +213,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l)
};
// auto auth. reqwest with send congratulation
if(gbAutoReqAuth)
- CallContactService(hContact,PSS_AUTHREQUESTW,0, (LPARAM)variables_parse(gbCongratulation, hContact).c_str());
+ CallContactService(hContact,PSS_AUTHREQUEST,0, (LPARAM)variables_parse(gbCongratulation, hContact).c_str());
}
}
return 0;
diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp
index 2d20cdf3be..eba9346537 100644
--- a/plugins/Weather/src/weather.cpp
+++ b/plugins/Weather/src/weather.cpp
@@ -215,7 +215,8 @@ extern "C" int __declspec(dllexport) Load(void)
hUpdateMutex = CreateMutex(NULL, FALSE, NULL);
// register weather protocol
- PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = WEATHERPROTONAME;
pd.type = (opt.NoProtoCondition) ? PROTOTYPE_VIRTUAL : PROTOTYPE_PROTOCOL;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp
index b485257601..c31e761916 100644
--- a/plugins/Weather/src/weather_svcs.cpp
+++ b/plugins/Weather/src/weather_svcs.cpp
@@ -207,8 +207,8 @@ void InitServices(void)
CreateProtoServiceFunction(WEATHERPROTONAME, PS_LOADICON, WeatherLoadIcon);
CreateProtoServiceFunction(WEATHERPROTONAME, PS_SETSTATUS, WeatherSetStatus);
CreateProtoServiceFunction(WEATHERPROTONAME, PS_GETSTATUS, WeatherGetStatus);
- CreateProtoServiceFunction(WEATHERPROTONAME, PS_BASICSEARCHT, WeatherBasicSearch);
- CreateProtoServiceFunction(WEATHERPROTONAME, PS_SEARCHBYEMAILT, WeatherBasicSearch);
+ CreateProtoServiceFunction(WEATHERPROTONAME, PS_BASICSEARCH, WeatherBasicSearch);
+ CreateProtoServiceFunction(WEATHERPROTONAME, PS_SEARCHBYEMAIL, WeatherBasicSearch);
CreateProtoServiceFunction(WEATHERPROTONAME, PS_ADDTOLIST, WeatherAddToList);
CreateProtoServiceFunction(WEATHERPROTONAME, PSS_GETINFO, WeatherGetInfo);
CreateProtoServiceFunction(WEATHERPROTONAME, PS_GETAVATARINFOT, WeatherGetAvatarInfo);
diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp
index 8cd85bd533..1495f107ff 100644
--- a/plugins/WebView/src/main.cpp
+++ b/plugins/WebView/src/main.cpp
@@ -179,7 +179,8 @@ extern "C" int __declspec(dllexport) Load()
hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) & nlu);
// register webview protocol
- PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = MODULENAME;
pd.type = PROTOTYPE_PROTOCOL;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
diff --git a/protocols/AimOscar/src/aim.cpp b/protocols/AimOscar/src/aim.cpp
index d6904e1d21..f4f0e39df2 100644
--- a/protocols/AimOscar/src/aim.cpp
+++ b/protocols/AimOscar/src/aim.cpp
@@ -103,7 +103,8 @@ extern "C" int __declspec(dllexport) Load(void)
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "AIM";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = protoInit;
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp
index 62d671ee71..5cb097c4ac 100644
--- a/protocols/AimOscar/src/server.cpp
+++ b/protocols/AimOscar/src/server.cpp
@@ -1343,12 +1343,12 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = mir_utf8decodeT(msg_buf);
- pre.ptszFiles = &filenameT;
+ pre.descr.t = mir_utf8decodeT(msg_buf);
+ pre.files.t = &filenameT;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
- mir_free(pre.tszDescription);
+ mir_free(pre.descr.t);
mir_free(filenameT);
char cip[20];
diff --git a/protocols/Dummy/src/main.cpp b/protocols/Dummy/src/main.cpp
index b2837e36af..ec1c2e52eb 100644
--- a/protocols/Dummy/src/main.cpp
+++ b/protocols/Dummy/src/main.cpp
@@ -81,7 +81,8 @@ extern "C" int __declspec(dllexport) Load()
mir_getCLI();
// Register protocol module
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "Dummy";
pd.fnInit = (pfnInitProto)dummyProtoInit;
pd.fnUninit = (pfnUninitProto)dummyProtoUninit;
diff --git a/protocols/FacebookRM/src/main.cpp b/protocols/FacebookRM/src/main.cpp
index e55450b78c..0fa30147f4 100644
--- a/protocols/FacebookRM/src/main.cpp
+++ b/protocols/FacebookRM/src/main.cpp
@@ -92,7 +92,8 @@ extern "C" int __declspec(dllexport) Load(void)
mir_getLP(&pluginInfo);
mir_getCLI();
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = FACEBOOK_NAME;
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = protoInit;
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index c4bc303fa9..5a65872b68 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -776,7 +776,7 @@ retry:
{
// Status was changed by the user simultaneously logged on using different Miranda account or IM client
int iStatus = status_gg2m(e->event.status60.status);
- CallProtoService(m_szModuleName, PS_SETAWAYMSGT, iStatus, (LPARAM)descrT);
+ CallProtoService(m_szModuleName, PS_SETAWAYMSG, iStatus, (LPARAM)descrT);
CallProtoService(m_szModuleName, PS_SETSTATUS, iStatus, 0);
}
@@ -1060,8 +1060,8 @@ retry:
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = filenameT;
- pre.ptszFiles = &filenameT;
+ pre.descr.t = filenameT;
+ pre.files.t = &filenameT;
pre.lParam = (LPARAM)dcc7;
ProtoChainRecvFile((MCONTACT)dcc7->contact, &pre);
diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp
index 3190ac35bb..230784f6c9 100644
--- a/protocols/Gadu-Gadu/src/filetransfer.cpp
+++ b/protocols/Gadu-Gadu/src/filetransfer.cpp
@@ -386,8 +386,8 @@ void __cdecl GGPROTO::dccmainthread(void*)
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = filenameT;
- pre.ptszFiles = &filenameT;
+ pre.descr.t = filenameT;
+ pre.files.t = &filenameT;
pre.lParam = (LPARAM)local_dcc;
gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 7, "ft_mutex", 1);
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index 45fd51745f..0b1aa1d837 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -340,7 +340,8 @@ extern "C" int __declspec(dllexport) Load(void)
hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, gg_modulesloaded);
// Prepare protocol name
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = GGDEF_PROTO;
pd.fnInit = (pfnInitProto)gg_proto_init;
pd.fnUninit = (pfnUninitProto)gg_proto_uninit;
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp
index f4ec6475b2..3c9380a83c 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.cpp
+++ b/protocols/Gadu-Gadu/src/gg_proto.cpp
@@ -57,7 +57,7 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) :
CreateProtoService(PS_SETMYAVATART, &GGPROTO::setmyavatar);
CreateProtoService(PS_GETMYAWAYMSG, &GGPROTO::getmyawaymsg);
- CreateProtoService(PS_SETAWAYMSGT, (MyServiceFunc)&GGPROTO::SetAwayMsg);
+ CreateProtoService(PS_SETAWAYMSG, (MyServiceFunc)&GGPROTO::SetAwayMsg);
CreateProtoService(PS_CREATEACCMGRUI, &GGPROTO::get_acc_mgr_gui);
CreateProtoService(PS_LEAVECHAT, &GGPROTO::leavechat);
diff --git a/protocols/ICQCorp/src/corp.cpp b/protocols/ICQCorp/src/corp.cpp
index 7b27d31966..08619f9d9f 100644
--- a/protocols/ICQCorp/src/corp.cpp
+++ b/protocols/ICQCorp/src/corp.cpp
@@ -61,22 +61,21 @@ extern "C" __declspec(dllexport) int Load()
{
mir_getLP(&pluginInfo);
+ char fileName[MAX_PATH];
+ WIN32_FIND_DATA findData;
+
+ GetModuleFileName(hInstance, fileName, MAX_PATH);
+ FindClose(FindFirstFile(fileName, &findData));
+ findData.cFileName[mir_strlen(findData.cFileName) - 4] = 0;
+ mir_strcpy(protoName, findData.cFileName);
+
PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
pd.szName = protoName;
pd.type = PROTOTYPE_PROTOCOL;
+ CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
- char fileName[MAX_PATH];
- WIN32_FIND_DATA findData;
-
- GetModuleFileName(hInstance, fileName, MAX_PATH);
- FindClose(FindFirstFile(fileName, &findData));
- findData.cFileName[mir_strlen(findData.cFileName) - 4] = 0;
- mir_strcpy(protoName, findData.cFileName);
-
- CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
-
- LoadServices();
- return 0;
+ LoadServices();
+ return 0;
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index 4c2e783f9e..e6cdea96ee 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -1164,7 +1164,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
pre.dwFlags = PRFF_TCHAR;
pre.timestamp = (DWORD)time(NULL);
pre.fileCount = 1;
- pre.ptszFiles = &tszTemp;
+ pre.files.t = &tszTemp;
pre.lParam = (LPARAM)di;
ProtoChainRecvFile(hContact, &pre);
}
diff --git a/protocols/IRCG/src/main.cpp b/protocols/IRCG/src/main.cpp
index 743dbe1741..7f91134cc1 100644
--- a/protocols/IRCG/src/main.cpp
+++ b/protocols/IRCG/src/main.cpp
@@ -95,7 +95,8 @@ extern "C" int __declspec(dllexport) Load()
InitContactMenus();
// register protocol
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "IRC";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = (pfnInitProto)ircProtoInit;
diff --git a/protocols/IcqOscarJ/src/icq_filerequests.cpp b/protocols/IcqOscarJ/src/icq_filerequests.cpp
index 9d6891dfb6..6dd10110d6 100644
--- a/protocols/IcqOscarJ/src/icq_filerequests.cpp
+++ b/protocols/IcqOscarJ/src/icq_filerequests.cpp
@@ -158,12 +158,12 @@ void CIcqProto::handleFileRequest(PBYTE buf, DWORD dwUin, DWORD dwCookie, DWORD
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = mir_utf8decodeT(pszDescription);
- pre.ptszFiles = &ptszFileName;
+ pre.descr.t = mir_utf8decodeT(pszDescription);
+ pre.files.t = &ptszFileName;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
- mir_free(pre.tszDescription);
+ mir_free(pre.descr.t);
mir_free(ptszFileName);
}
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp
index 735b17bf80..a2d005fe47 100644
--- a/protocols/IcqOscarJ/src/init.cpp
+++ b/protocols/IcqOscarJ/src/init.cpp
@@ -102,7 +102,8 @@ extern "C" int __declspec(dllexport) Load(void)
_tzset();
// Register the module
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = ICQ_PROTOCOL_NAME;
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = icqProtoInit;
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
index a229dda6a3..cb070ec4bd 100644
--- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
+++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
@@ -505,12 +505,12 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, size_t wLen, DWORD dwUin, char *
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = mir_utf8decodeT(pszDescription);
- pre.ptszFiles = &ptszFileName;
+ pre.descr.t = mir_utf8decodeT(pszDescription);
+ pre.files.t = &ptszFileName;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
- mir_free(pre.tszDescription);
+ mir_free(pre.descr.t);
mir_free(ptszFileName);
}
else if (wAckType == 2) { // First attempt failed, reverse requested
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp
index 92b8c8872f..97d203b105 100644
--- a/protocols/JabberG/src/jabber.cpp
+++ b/protocols/JabberG/src/jabber.cpp
@@ -206,7 +206,8 @@ extern "C" int __declspec(dllexport) Load()
hDiscoInfoResult = CreateHookableEvent(ME_JABBER_SRVDISCOINFO);
// Register protocol module
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "JABBER";
pd.fnInit = (pfnInitProto)jabberProtoInit;
pd.fnUninit = (pfnUninitProto)jabberProtoUninit;
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp
index 34688fc5eb..9b19832a8c 100644
--- a/protocols/JabberG/src/jabber_ft.cpp
+++ b/protocols/JabberG/src/jabber_ft.cpp
@@ -364,10 +364,10 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode)
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.ptszFiles = (TCHAR**)&filename;
+ pre.files.t = (TCHAR**)&filename;
pre.lParam = (LPARAM)ft;
if ((n = xmlGetChild(fileNode , "desc")) != NULL)
- pre.tszDescription = (TCHAR*)xmlGetText(n);
+ pre.descr.t = (TCHAR*)xmlGetText(n);
ProtoChainRecvFile(ft->std.hContact, &pre);
return;
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp
index 9e6c191168..131a3b0ced 100644
--- a/protocols/JabberG/src/jabber_iq_handlers.cpp
+++ b/protocols/JabberG/src/jabber_iq_handlers.cpp
@@ -675,8 +675,8 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo)
PROTORECVFILET pre;
pre.dwFlags = PRFF_TCHAR;
pre.timestamp = time(NULL);
- pre.tszDescription = desc;
- pre.ptszFiles = &str2;
+ pre.descr.t = desc;
+ pre.files.t = &str2;
pre.fileCount = 1;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp
index 8cca0b3109..06cd7a8fa2 100644
--- a/protocols/JabberG/src/jabber_search.cpp
+++ b/protocols/JabberG/src/jabber_search.cpp
@@ -37,49 +37,49 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static int JabberSearchFrameProc(HWND hwnd, int msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_COMMAND && lParam != 0) {
- HWND hwndDlg=GetParent(hwnd);
- JabberSearchData * dat=(JabberSearchData *)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
+ HWND hwndDlg = GetParent(hwnd);
+ JabberSearchData *dat = (JabberSearchData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (dat && lParam) {
- int pos=dat->curPos;
+ int pos = dat->curPos;
RECT MineRect;
RECT FrameRect;
- GetWindowRect(GetDlgItem(hwndDlg, IDC_FRAME),&FrameRect);
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_FRAME), &FrameRect);
GetWindowRect((HWND)lParam, &MineRect);
- if (MineRect.top-10 < FrameRect.top) {
- pos=dat->curPos+(MineRect.top-14-FrameRect.top);
- if (pos<0) pos=0;
+ if (MineRect.top - 10 < FrameRect.top) {
+ pos = dat->curPos + (MineRect.top - 14 - FrameRect.top);
+ if (pos < 0) pos = 0;
}
else if (MineRect.bottom > FrameRect.bottom) {
- pos=dat->curPos+(MineRect.bottom-FrameRect.bottom);
- if (dat->frameHeight+pos>dat->CurrentHeight)
- pos=dat->CurrentHeight-dat->frameHeight;
+ pos = dat->curPos + (MineRect.bottom - FrameRect.bottom);
+ if (dat->frameHeight + pos > dat->CurrentHeight)
+ pos = dat->CurrentHeight - dat->frameHeight;
}
if (pos != dat->curPos) {
- ScrollWindow(GetDlgItem(hwndDlg, IDC_FRAME), 0, dat->curPos - pos, NULL, &(dat->frameRect));
+ ScrollWindow(GetDlgItem(hwndDlg, IDC_FRAME), 0, dat->curPos - pos, NULL, &(dat->frameRect));
SetScrollPos(GetDlgItem(hwndDlg, IDC_VSCROLL), SB_CTL, pos, TRUE);
- RECT Invalid=dat->frameRect;
- if (dat->curPos - pos >0)
- Invalid.bottom=Invalid.top+(dat->curPos - pos);
+ RECT Invalid = dat->frameRect;
+ if (dat->curPos - pos > 0)
+ Invalid.bottom = Invalid.top + (dat->curPos - pos);
else
- Invalid.top=Invalid.bottom+(dat->curPos - pos);
+ Invalid.top = Invalid.bottom + (dat->curPos - pos);
- RedrawWindow(GetDlgItem(hwndDlg, IDC_FRAME), NULL, NULL, RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW |RDW_ALLCHILDREN);
+ RedrawWindow(GetDlgItem(hwndDlg, IDC_FRAME), NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
dat->curPos = pos;
}
}
- if (HIWORD(wParam)==EN_SETFOCUS) { //Transmit focus set notification to parent window
- PostMessage(GetParent(hwndDlg),WM_COMMAND, MAKEWPARAM(0,EN_SETFOCUS), (LPARAM)hwndDlg);
+ if (HIWORD(wParam) == EN_SETFOCUS) { //Transmit focus set notification to parent window
+ PostMessage(GetParent(hwndDlg), WM_COMMAND, MAKEWPARAM(0, EN_SETFOCUS), (LPARAM)hwndDlg);
}
}
if (msg == WM_PAINT) {
PAINTSTRUCT ps;
- HDC hdc=BeginPaint(hwnd, &ps);
- FillRect(hdc,&(ps.rcPaint),GetSysColorBrush(COLOR_BTNFACE));
+ HDC hdc = BeginPaint(hwnd, &ps);
+ FillRect(hdc, &(ps.rcPaint), GetSysColorBrush(COLOR_BTNFACE));
EndPaint(hwnd, &ps);
}
- return DefWindowProc(hwnd,msg,wParam,lParam);
+ return DefWindowProc(hwnd, msg, wParam, lParam);
}
///////////////////////////////////////////////////////////////////////////////
@@ -91,42 +91,42 @@ static int JabberSearchAddField(HWND hwndDlg, Data* FieldDat)
return FALSE;
HFONT hFont = (HFONT)SendMessage(hwndDlg, WM_GETFONT, 0, 0);
- HWND hwndParent=GetDlgItem(hwndDlg,IDC_FRAME);
+ HWND hwndParent = GetDlgItem(hwndDlg, IDC_FRAME);
LONG_PTR frameExStyle = GetWindowLongPtr(hwndParent, GWL_EXSTYLE);
frameExStyle |= WS_EX_CONTROLPARENT;
SetWindowLongPtr(hwndParent, GWL_EXSTYLE, frameExStyle);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_FRAME),GWLP_WNDPROC,(LONG_PTR)JabberSearchFrameProc);
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FRAME), GWLP_WNDPROC, (LONG_PTR)JabberSearchFrameProc);
- int CornerX=1;
- int CornerY=1;
+ int CornerX = 1;
+ int CornerY = 1;
RECT rect;
- GetClientRect(hwndParent,&rect);
- int width=rect.right-5-CornerX;
+ GetClientRect(hwndParent, &rect);
+ int width = rect.right - 5 - CornerX;
- int Order=(FieldDat->bHidden) ? -1 : FieldDat->Order;
+ int Order = (FieldDat->bHidden) ? -1 : FieldDat->Order;
- HWND hwndLabel=CreateWindowEx(0,_T("STATIC"),(LPCTSTR)TranslateTS(FieldDat->Label),WS_CHILD, CornerX, CornerY + Order*40, width, 13,hwndParent,NULL,hInst,0);
- HWND hwndVar=CreateWindowEx(0|WS_EX_CLIENTEDGE,_T("EDIT"),(LPCTSTR)FieldDat->defValue,WS_CHILD|WS_TABSTOP, CornerX+5, CornerY + Order*40+14, width ,20,hwndParent,NULL,hInst,0);
- SendMessage(hwndLabel, WM_SETFONT, (WPARAM)hFont,0);
- SendMessage(hwndVar, WM_SETFONT, (WPARAM)hFont,0);
+ HWND hwndLabel = CreateWindowEx(0, _T("STATIC"), (LPCTSTR)TranslateTS(FieldDat->Label), WS_CHILD, CornerX, CornerY + Order * 40, width, 13, hwndParent, NULL, hInst, 0);
+ HWND hwndVar = CreateWindowEx(0 | WS_EX_CLIENTEDGE, _T("EDIT"), (LPCTSTR)FieldDat->defValue, WS_CHILD | WS_TABSTOP, CornerX + 5, CornerY + Order * 40 + 14, width, 20, hwndParent, NULL, hInst, 0);
+ SendMessage(hwndLabel, WM_SETFONT, (WPARAM)hFont, 0);
+ SendMessage(hwndVar, WM_SETFONT, (WPARAM)hFont, 0);
if (!FieldDat->bHidden) {
- ShowWindow(hwndLabel,SW_SHOW);
- ShowWindow(hwndVar,SW_SHOW);
- EnableWindow(hwndLabel,!FieldDat->bReadOnly);
- SendMessage(hwndVar, EM_SETREADONLY, (WPARAM)FieldDat->bReadOnly,0);
+ ShowWindow(hwndLabel, SW_SHOW);
+ ShowWindow(hwndVar, SW_SHOW);
+ EnableWindow(hwndLabel, !FieldDat->bReadOnly);
+ SendMessage(hwndVar, EM_SETREADONLY, (WPARAM)FieldDat->bReadOnly, 0);
}
//remade list
//reallocation
- JabberSearchData *dat=(JabberSearchData *)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
+ JabberSearchData *dat = (JabberSearchData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (dat) {
- dat->pJSInf=(JabberSearchFieldsInfo*)realloc(dat->pJSInf, sizeof(JabberSearchFieldsInfo)*(dat->nJSInfCount+1));
- dat->pJSInf[dat->nJSInfCount].hwndCaptionItem=hwndLabel;
- dat->pJSInf[dat->nJSInfCount].hwndValueItem=hwndVar;
- dat->pJSInf[dat->nJSInfCount].szFieldCaption=_tcsdup(FieldDat->Label);
- dat->pJSInf[dat->nJSInfCount].szFieldName=_tcsdup(FieldDat->Var);
+ dat->pJSInf = (JabberSearchFieldsInfo*)realloc(dat->pJSInf, sizeof(JabberSearchFieldsInfo)*(dat->nJSInfCount + 1));
+ dat->pJSInf[dat->nJSInfCount].hwndCaptionItem = hwndLabel;
+ dat->pJSInf[dat->nJSInfCount].hwndValueItem = hwndVar;
+ dat->pJSInf[dat->nJSInfCount].szFieldCaption = _tcsdup(FieldDat->Label);
+ dat->pJSInf[dat->nJSInfCount].szFieldName = _tcsdup(FieldDat->Var);
dat->nJSInfCount++;
}
- return CornerY + Order*40+14 +20;
+ return CornerY + Order * 40 + 14 + 20;
}
////////////////////////////////////////////////////////////////////////////////
@@ -145,33 +145,33 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*)
HXML queryNode = xmlGetNthChild(iqNode, _T("query"), 1);
HXML xNode = xmlGetChildByTag(queryNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS);
- ShowWindow(searchHandleDlg,SW_HIDE);
+ ShowWindow(searchHandleDlg, SW_HIDE);
if (xNode) {
//1. Form
- PostMessage(searchHandleDlg, WM_USER+11, (WPARAM)xi.copyNode(xNode), 0);
+ PostMessage(searchHandleDlg, WM_USER + 11, (WPARAM)xi.copyNode(xNode), 0);
HXML xcNode = xmlGetNthChild(xNode, _T("instructions"), 1);
if (xcNode)
SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, xmlGetText(xcNode));
}
else {
- int Order=0;
- for (int i=0; ; i++) {
+ int Order = 0;
+ for (int i = 0;; i++) {
HXML chNode = xmlGetChild(queryNode, i);
if (!chNode)
break;
if (!mir_tstrcmpi(xmlGetName(chNode), _T("instructions")) && xmlGetText(chNode))
- SetDlgItemText(searchHandleDlg,IDC_INSTRUCTIONS,TranslateTS(xmlGetText(chNode)));
+ SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, TranslateTS(xmlGetText(chNode)));
else if (xmlGetName(chNode)) {
- Data *MyData=(Data*)malloc(sizeof(Data));
- memset(MyData,0,sizeof(Data));
+ Data *MyData = (Data*)malloc(sizeof(Data));
+ memset(MyData, 0, sizeof(Data));
MyData->Label = mir_tstrdup(xmlGetName(chNode));
MyData->Var = mir_tstrdup(xmlGetName(chNode));
MyData->defValue = mir_tstrdup(xmlGetText(chNode));
MyData->Order = Order;
if (MyData->defValue) MyData->bReadOnly = TRUE;
- PostMessage(searchHandleDlg,WM_USER+10,FALSE,(LPARAM)MyData);
+ PostMessage(searchHandleDlg, WM_USER + 10, FALSE, (LPARAM)MyData);
Order++;
}
}
@@ -179,13 +179,13 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*)
const TCHAR *szFrom = xmlGetAttrValue(iqNode, _T("from"));
if (szFrom)
- SearchAddToRecent(szFrom,searchHandleDlg);
- PostMessage(searchHandleDlg,WM_USER+10,0,0);
- ShowWindow(searchHandleDlg,SW_SHOW);
+ SearchAddToRecent(szFrom, searchHandleDlg);
+ PostMessage(searchHandleDlg, WM_USER + 10, 0, 0);
+ ShowWindow(searchHandleDlg, SW_SHOW);
}
else if (!mir_tstrcmp(type, _T("error"))) {
- const TCHAR *code=NULL;
- const TCHAR *description=NULL;
+ const TCHAR *code = NULL;
+ const TCHAR *description = NULL;
TCHAR buff[255];
HXML errorNode = xmlGetChild(iqNode, "error");
if (errorNode) {
@@ -193,7 +193,7 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*)
description = xmlGetText(errorNode);
}
mir_sntprintf(buff, SIZEOF(buff), TranslateT("Error %s %s\r\nPlease select other server"), code ? code : _T(""), description ? description : _T(""));
- SetDlgItemText(searchHandleDlg,IDC_INSTRUCTIONS,buff);
+ SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, buff);
}
else SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, TranslateT("Error: unknown reply received\r\nPlease select other server"));
}
@@ -207,20 +207,21 @@ static TCHAR *nickfields[] = { _T("nick"), _T("nickname"), _T("fullname"), _T("n
void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_MAP * pmAllFields)
{
- LIST<TCHAR> ListOfNonEmptyFields(20,(LIST<TCHAR>::FTSortFunc)TCharKeyCmp);
+ LIST<TCHAR> ListOfNonEmptyFields(20, (LIST<TCHAR>::FTSortFunc)TCharKeyCmp);
LIST<TCHAR> ListOfFields(20);
LIST<void>* plUsersInfo = (LIST<void>*)pvUsersInfo;
int i, nUsersFound = plUsersInfo->getCount();
// lets fill the ListOfNonEmptyFields but in users order
- for (i=0; i < nUsersFound; i++) {
+ for (i = 0; i < nUsersFound; i++) {
U_TCHAR_MAP* pmUserData = (U_TCHAR_MAP*)plUsersInfo->operator [](i);
int nUserFields = pmUserData->getCount();
- for (int j=0; j < nUserFields; j++) {
+ for (int j = 0; j < nUserFields; j++) {
TCHAR *var = pmUserData->getKeyName(j);
if (var && ListOfNonEmptyFields.getIndex(var) < 0)
- ListOfNonEmptyFields.insert(var);
- } }
+ ListOfNonEmptyFields.insert(var);
+ }
+ }
// now fill the ListOfFields but order is from pmAllFields
int nAllCount = pmAllFields->getCount();
@@ -240,27 +241,27 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M
Results.nFieldCount = nFieldCount;
/* Sending Columns Titles */
- for (i=0; i < nFieldCount; i++) {
+ for (i = 0; i < nFieldCount; i++) {
TCHAR *var = ListOfFields[i];
if (var)
Results.pszFields[i] = pmAllFields->operator [](var);
}
Results.psr.cbSize = 0; // sending column names
- ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, id, (LPARAM) &Results);
+ ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, id, (LPARAM)&Results);
/* Sending Users Data */
Results.psr.cbSize = sizeof(Results.psr); // sending user data
- for (i=0; i < nUsersFound; i++) {
+ for (i = 0; i < nUsersFound; i++) {
TCHAR buff[200];
buff[0] = 0;
- U_TCHAR_MAP *pmUserData = (U_TCHAR_MAP *) plUsersInfo->operator [](i);
- for (int j=0; j < nFieldCount; j++) {
+ U_TCHAR_MAP *pmUserData = (U_TCHAR_MAP *)plUsersInfo->operator [](i);
+ for (int j = 0; j < nFieldCount; j++) {
TCHAR *var = ListOfFields[j];
TCHAR *value = pmUserData->operator [](var);
Results.pszFields[j] = value ? value : (TCHAR *)_T(" ");
- if (!mir_tstrcmpi(var,_T("jid")) && value)
+ if (!mir_tstrcmpi(var, _T("jid")) && value)
Results.psr.id.t = value;
}
@@ -279,7 +280,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M
Results.psr.nick.t = nick;
Results.psr.flags = PSR_TCHAR;
- ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, id, (LPARAM) &Results);
+ ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, id, (LPARAM)&Results);
Results.psr.nick.t = NULL;
}
mir_free(Results.pszFields);
@@ -324,9 +325,11 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*)
if (var) {
TCHAR *Label = (TCHAR*)xmlGetAttrValue(fieldNode, _T("label"));
mColumnsNames.insert(var, (Label != NULL) ? Label : var);
- } } }
+ }
+ }
+ }
- int i=1;
+ int i = 1;
HXML itemNode;
while (itemNode = xmlGetNthChild(xNode, _T("item"), i++)) {
U_TCHAR_MAP *pUserColumn = new U_TCHAR_MAP(10);
@@ -335,26 +338,28 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*)
if (TCHAR* var = (TCHAR*)xmlGetAttrValue(fieldNode, _T("var"))) {
if (TCHAR* Text = (TCHAR*)xmlGetText(xmlGetChild(fieldNode, _T("value")))) {
if (!mColumnsNames[var])
- mColumnsNames.insert(var,var);
- pUserColumn->insert(var,Text);
- } } }
+ mColumnsNames.insert(var, var);
+ pUserColumn->insert(var, Text);
+ }
+ }
+ }
SearchResults.insert((void*)pUserColumn);
}
}
else {
//2. Field list search results info
- int i=1;
+ int i = 1;
while (HXML itemNode = xmlGetNthChild(queryNode, _T("item"), i++)) {
- U_TCHAR_MAP *pUserColumn=new U_TCHAR_MAP(10);
+ U_TCHAR_MAP *pUserColumn = new U_TCHAR_MAP(10);
TCHAR *jid = (TCHAR*)xmlGetAttrValue(itemNode, _T("jid"));
TCHAR *keyReturned;
- mColumnsNames.insertCopyKey(_T("jid"),_T("jid"),&keyReturned, CopyKey, DestroyKey);
+ mColumnsNames.insertCopyKey(_T("jid"), _T("jid"), &keyReturned, CopyKey, DestroyKey);
mColumnsNames.insert(_T("jid"), keyReturned);
pUserColumn->insertCopyKey(_T("jid"), jid, NULL, CopyKey, DestroyKey);
- for (int j=0; ; j++) {
+ for (int j = 0;; j++) {
HXML child = xmlGetChild(itemNode, j);
if (!child)
break;
@@ -363,19 +368,22 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*)
if (szColumnName) {
LPCTSTR ptszChild = xmlGetText(child);
if (ptszChild && *ptszChild) {
- mColumnsNames.insertCopyKey((TCHAR*)szColumnName,_T(""),&keyReturned, CopyKey, DestroyKey);
- mColumnsNames.insert((TCHAR*)szColumnName,keyReturned);
+ mColumnsNames.insertCopyKey((TCHAR*)szColumnName, _T(""), &keyReturned, CopyKey, DestroyKey);
+ mColumnsNames.insert((TCHAR*)szColumnName, keyReturned);
pUserColumn->insertCopyKey((TCHAR*)szColumnName, (TCHAR*)ptszChild, NULL, CopyKey, DestroyKey);
- } } }
+ }
+ }
+ }
SearchResults.insert((void*)pUserColumn);
- } }
+ }
+ }
}
else if (!mir_tstrcmp(type, _T("error"))) {
const TCHAR *code = NULL;
const TCHAR *description = NULL;
TCHAR buff[255];
- HXML errorNode = xmlGetChild(iqNode , "error");
+ HXML errorNode = xmlGetChild(iqNode, "error");
if (errorNode) {
code = xmlGetAttrValue(errorNode, _T("code"));
description = xmlGetText(errorNode);
@@ -384,15 +392,15 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*)
mir_sntprintf(buff, SIZEOF(buff), TranslateT("Error %s %s\r\nTry to specify more detailed"), code ? code : _T(""), description ? description : _T(""));
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
if (searchHandleDlg)
- SetDlgItemText(searchHandleDlg,IDC_INSTRUCTIONS,buff);
+ SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, buff);
else
- MessageBox(NULL, buff, TranslateT("Search error"), MB_OK|MB_ICONSTOP);
+ MessageBox(NULL, buff, TranslateT("Search error"), MB_OK | MB_ICONSTOP);
return;
}
SearchReturnResults((HANDLE)id, (void*)&SearchResults, (U_TCHAR_MAP *)&mColumnsNames);
- for (int i=0; i < SearchResults.getCount(); i++)
+ for (int i = 0; i < SearchResults.getCount(); i++)
delete ((U_TCHAR_MAP *)SearchResults[i]);
//send success to finish searching
@@ -407,9 +415,8 @@ static BOOL CALLBACK DeleteChildWindowsProc(HWND hwnd, LPARAM)
static void JabberSearchFreeData(HWND hwndDlg, JabberSearchData * dat)
{
- //lock
if (!dat->fSearchRequestIsXForm && dat->nJSInfCount && dat->pJSInf) {
- for (int i=0; i < dat->nJSInfCount; i++) {
+ for (int i = 0; i < dat->nJSInfCount; i++) {
if (dat->pJSInf[i].hwndValueItem)
DestroyWindow(dat->pJSInf[i].hwndValueItem);
if (dat->pJSInf[i].hwndCaptionItem)
@@ -420,42 +427,41 @@ static void JabberSearchFreeData(HWND hwndDlg, JabberSearchData * dat)
free(dat->pJSInf[i].szFieldName);
}
free(dat->pJSInf);
- dat->pJSInf=NULL;
+ dat->pJSInf = NULL;
}
- else EnumChildWindows(GetDlgItem(hwndDlg,IDC_FRAME),DeleteChildWindowsProc,0);
+ else EnumChildWindows(GetDlgItem(hwndDlg, IDC_FRAME), DeleteChildWindowsProc, 0);
if (dat->xNode)
xi.destroyNode(dat->xNode);
- SendDlgItemMessage(hwndDlg,IDC_FRAME, WM_SETFONT, (WPARAM)SendMessage(hwndDlg, WM_GETFONT, 0, 0),0);
- dat->nJSInfCount=0;
- ShowWindow(GetDlgItem(hwndDlg,IDC_VSCROLL),SW_HIDE);
- SetDlgItemText(hwndDlg,IDC_INSTRUCTIONS,TranslateT("Select/type search service URL above and press <Go>"));
- //unlock
+ SendDlgItemMessage(hwndDlg, IDC_FRAME, WM_SETFONT, (WPARAM)SendMessage(hwndDlg, WM_GETFONT, 0, 0), 0);
+ dat->nJSInfCount = 0;
+ ShowWindow(GetDlgItem(hwndDlg, IDC_VSCROLL), SW_HIDE);
+ SetDlgItemText(hwndDlg, IDC_INSTRUCTIONS, TranslateT("Select/type search service URL above and press <Go>"));
}
-static void JabberSearchRefreshFrameScroll(HWND hwndDlg, JabberSearchData * dat)
+static void JabberSearchRefreshFrameScroll(HWND hwndDlg, JabberSearchData *dat)
{
HWND hFrame = GetDlgItem(hwndDlg, IDC_FRAME);
HWND hwndScroll = GetDlgItem(hwndDlg, IDC_VSCROLL);
RECT rc;
GetClientRect(hFrame, &rc);
GetClientRect(hFrame, &dat->frameRect);
- dat->frameHeight = rc.bottom-rc.top;
+ dat->frameHeight = rc.bottom - rc.top;
if (dat->frameHeight < dat->CurrentHeight) {
ShowWindow(hwndScroll, SW_SHOW);
EnableWindow(hwndScroll, TRUE);
}
else ShowWindow(hwndScroll, SW_HIDE);
- SetScrollRange(hwndScroll, SB_CTL, 0, dat->CurrentHeight-dat->frameHeight, FALSE);
+ SetScrollRange(hwndScroll, SB_CTL, 0, dat->CurrentHeight - dat->frameHeight, FALSE);
}
-int CJabberProto::SearchRenewFields(HWND hwndDlg, JabberSearchData * dat)
+int CJabberProto::SearchRenewFields(HWND hwndDlg, JabberSearchData *dat)
{
TCHAR szServerName[100];
- EnableWindow(GetDlgItem(hwndDlg, IDC_GO),FALSE);
- GetDlgItemText(hwndDlg,IDC_SERVER,szServerName,SIZEOF(szServerName));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_GO), FALSE);
+ GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, SIZEOF(szServerName));
dat->CurrentHeight = 0;
dat->curPos = 0;
SetScrollPos(GetDlgItem(hwndDlg, IDC_VSCROLL), SB_CTL, 0, FALSE);
@@ -463,7 +469,7 @@ int CJabberProto::SearchRenewFields(HWND hwndDlg, JabberSearchData * dat)
JabberSearchFreeData(hwndDlg, dat);
JabberSearchRefreshFrameScroll(hwndDlg, dat);
- SetDlgItemText(hwndDlg,IDC_INSTRUCTIONS,m_bJabberOnline ? TranslateT("Please wait...\r\nConnecting search server...") : TranslateT("You have to be connected to server"));
+ SetDlgItemText(hwndDlg, IDC_INSTRUCTIONS, m_bJabberOnline ? TranslateT("Please wait...\r\nConnecting search server...") : TranslateT("You have to be connected to server"));
if (!m_bJabberOnline)
return 0;
@@ -471,13 +477,13 @@ int CJabberProto::SearchRenewFields(HWND hwndDlg, JabberSearchData * dat)
searchHandleDlg = hwndDlg;
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultGetSearchFields, JABBER_IQ_TYPE_GET, szServerName);
- m_ThreadInfo->send( XmlNodeIq(pInfo) << XQUERY(_T("jabber:iq:search")));
+ m_ThreadInfo->send(XmlNodeIq(pInfo) << XQUERY(_T("jabber:iq:search")));
return pInfo->GetIqId();
}
static void JabberSearchAddUrlToRecentCombo(HWND hwndDlg, const TCHAR *szAddr)
{
- int lResult = SendDlgItemMessage(hwndDlg, IDC_SERVER, (UINT) CB_FINDSTRING, 0, (LPARAM)szAddr);
+ int lResult = SendDlgItemMessage(hwndDlg, IDC_SERVER, (UINT)CB_FINDSTRING, 0, (LPARAM)szAddr);
if (lResult == -1)
SendDlgItemMessage(hwndDlg, IDC_SERVER, CB_ADDSTRING, 0, (LPARAM)szAddr);
}
@@ -485,14 +491,14 @@ static void JabberSearchAddUrlToRecentCombo(HWND hwndDlg, const TCHAR *szAddr)
void CJabberProto::SearchDeleteFromRecent(const TCHAR *szAddr, BOOL deleteLastFromDB)
{
//search in recent
- for (int i=0; i<10; i++) {
+ for (int i = 0; i < 10; i++) {
char key[30];
mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", i);
- ptrT szValue( getTStringA(key));
+ ptrT szValue(getTStringA(key));
if (szValue == NULL || mir_tstrcmpi(szAddr, szValue))
continue;
- for (int j=i; j < 10; j++) {
+ for (int j = i; j < 10; j++) {
mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j + 1);
szValue = getTStringA(key);
if (szValue != NULL) {
@@ -502,25 +508,28 @@ void CJabberProto::SearchDeleteFromRecent(const TCHAR *szAddr, BOOL deleteLastFr
else {
if (deleteLastFromDB) {
mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j);
- delSetting(NULL,key);
+ delSetting(NULL, key);
}
break;
- } }
+ }
+ }
break;
-} }
+ }
+}
void CJabberProto::SearchAddToRecent(const TCHAR *szAddr, HWND hwndDialog)
{
char key[30];
SearchDeleteFromRecent(szAddr);
- for (int j=9; j > 0; j--) {
+ for (int j = 9; j > 0; j--) {
mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j - 1);
- ptrT szValue( getTStringA(key));
+ ptrT szValue(getTStringA(key));
if (szValue != NULL) {
mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j);
setTString(NULL, key, szValue);
- } }
+ }
+ }
mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", 0);
setTString(key, szAddr);
@@ -541,27 +550,27 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR
/* Server Combo box */
ptrA jud(dat->ppro->getStringA("Jud"));
- char *szServerName = (jud == NULL) ? "users.jabber.org": jud;
- SetDlgItemTextA(hwndDlg,IDC_SERVER,szServerName);
- SendDlgItemMessageA(hwndDlg,IDC_SERVER,CB_ADDSTRING,0,(LPARAM)szServerName);
+ char *szServerName = (jud == NULL) ? "users.jabber.org" : jud;
+ SetDlgItemTextA(hwndDlg, IDC_SERVER, szServerName);
+ SendDlgItemMessageA(hwndDlg, IDC_SERVER, CB_ADDSTRING, 0, (LPARAM)szServerName);
//TO DO: Add Transports here
int i, transpCount = dat->ppro->m_lstTransports.getCount();
- for (i=0; i < transpCount; i++) {
+ for (i = 0; i < transpCount; i++) {
TCHAR *szTransp = dat->ppro->m_lstTransports[i];
if (szTransp)
JabberSearchAddUrlToRecentCombo(hwndDlg, szTransp);
}
- for (i=0; i < 10; i++) {
+ for (i = 0; i < 10; i++) {
char key[30];
mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", i);
- ptrT szValue( dat->ppro->getTStringA(key));
+ ptrT szValue(dat->ppro->getTStringA(key));
if (szValue != NULL)
JabberSearchAddUrlToRecentCombo(hwndDlg, szValue);
}
//TO DO: Add 4 recently used
- dat->lastRequestIq = dat->ppro->SearchRenewFields(hwndDlg,dat);
+ dat->lastRequestIq = dat->ppro->SearchRenewFields(hwndDlg, dat);
}
return TRUE;
@@ -569,21 +578,21 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR
if (LOWORD(wParam) == IDC_SERVER) {
switch (HIWORD(wParam)) {
case CBN_SETFOCUS:
- PostMessage(GetParent(hwndDlg),WM_COMMAND, MAKEWPARAM(0,EN_SETFOCUS), (LPARAM)hwndDlg);
+ PostMessage(GetParent(hwndDlg), WM_COMMAND, MAKEWPARAM(0, EN_SETFOCUS), (LPARAM)hwndDlg);
return TRUE;
case CBN_EDITCHANGE:
- EnableWindow(GetDlgItem(hwndDlg, IDC_GO),TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_GO), TRUE);
return TRUE;
case CBN_EDITUPDATE:
JabberSearchFreeData(hwndDlg, dat);
- EnableWindow(GetDlgItem(hwndDlg, IDC_GO),TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_GO), TRUE);
return TRUE;
case CBN_SELENDOK:
- EnableWindow(GetDlgItem(hwndDlg, IDC_GO),TRUE);
- PostMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_GO,BN_CLICKED),0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_GO), TRUE);
+ PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_GO, BN_CLICKED), 0);
return TRUE;
}
}
@@ -597,54 +606,55 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR
{
//Resize IDC_FRAME to take full size
RECT rcForm;
- GetWindowRect(hwndDlg, &rcForm);
+ GetWindowRect(hwndDlg, &rcForm);
RECT rcFrame;
GetWindowRect(GetDlgItem(hwndDlg, IDC_FRAME), &rcFrame);
rcFrame.bottom = rcForm.bottom;
- SetWindowPos(GetDlgItem(hwndDlg,IDC_FRAME),NULL,0,0,rcFrame.right-rcFrame.left,rcFrame.bottom-rcFrame.top,SWP_NOZORDER|SWP_NOMOVE);
- GetWindowRect(GetDlgItem(hwndDlg,IDC_VSCROLL), &rcForm);
- SetWindowPos(GetDlgItem(hwndDlg,IDC_VSCROLL),NULL,0,0,rcForm.right-rcForm.left,rcFrame.bottom-rcFrame.top,SWP_NOZORDER|SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hwndDlg, IDC_FRAME), NULL, 0, 0, rcFrame.right - rcFrame.left, rcFrame.bottom - rcFrame.top, SWP_NOZORDER | SWP_NOMOVE);
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_VSCROLL), &rcForm);
+ SetWindowPos(GetDlgItem(hwndDlg, IDC_VSCROLL), NULL, 0, 0, rcForm.right - rcForm.left, rcFrame.bottom - rcFrame.top, SWP_NOZORDER | SWP_NOMOVE);
JabberSearchRefreshFrameScroll(hwndDlg, dat);
}
return TRUE;
- case WM_USER+11:
+ case WM_USER + 11:
{
- dat->fSearchRequestIsXForm=TRUE;
+ dat->fSearchRequestIsXForm = TRUE;
dat->xNode = (HXML)wParam;
- JabberFormCreateUI(GetDlgItem(hwndDlg, IDC_FRAME), dat->xNode, &dat->CurrentHeight,TRUE);
+ JabberFormCreateUI(GetDlgItem(hwndDlg, IDC_FRAME), dat->xNode, &dat->CurrentHeight, TRUE);
ShowWindow(GetDlgItem(hwndDlg, IDC_FRAME), SW_SHOW);
- dat->nJSInfCount=1;
- return TRUE;
+ dat->nJSInfCount = 1;
}
- case WM_USER+10:
+ return TRUE;
+
+ case WM_USER + 10:
{
- Data* MyDat = (Data*)lParam;
+ Data *MyDat = (Data*)lParam;
if (MyDat) {
dat->fSearchRequestIsXForm = (BOOL)wParam;
- dat->CurrentHeight = JabberSearchAddField(hwndDlg,MyDat);
+ dat->CurrentHeight = JabberSearchAddField(hwndDlg, MyDat);
mir_free(MyDat->Label);
mir_free(MyDat->Var);
mir_free(MyDat->defValue);
free(MyDat);
}
- else
- {
- JabberSearchRefreshFrameScroll(hwndDlg,dat);
- ScrollWindow(GetDlgItem(hwndDlg, IDC_FRAME), 0, dat->curPos - 0, NULL, &(dat->frameRect));
+ else {
+ JabberSearchRefreshFrameScroll(hwndDlg, dat);
+ ScrollWindow(GetDlgItem(hwndDlg, IDC_FRAME), 0, dat->curPos - 0, NULL, &(dat->frameRect));
SetScrollPos(GetDlgItem(hwndDlg, IDC_VSCROLL), SB_CTL, 0, FALSE);
- dat->curPos=0;
+ dat->curPos = 0;
}
- return TRUE;
}
+ return TRUE;
+
case WM_MOUSEWHEEL:
{
short zDelta = GET_WHEEL_DELTA_WPARAM(wParam);
if (zDelta) {
- int nScrollLines=0;
- SystemParametersInfo(SPI_GETWHEELSCROLLLINES,0,(void*)&nScrollLines,0);
- for (int i=0; i<(nScrollLines+1)/2; i++)
- SendMessage(hwndDlg,WM_VSCROLL, (zDelta<0)?SB_LINEDOWN:SB_LINEUP,0);
+ int nScrollLines = 0;
+ SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, (void*)&nScrollLines, 0);
+ for (int i = 0; i < (nScrollLines + 1) / 2; i++)
+ SendMessage(hwndDlg, WM_VSCROLL, (zDelta < 0) ? SB_LINEDOWN : SB_LINEUP, 0);
}
}
return TRUE;
@@ -676,17 +686,19 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR
if (pos < 0)
pos = 0;
if (dat->curPos != pos) {
- ScrollWindow(GetDlgItem(hwndDlg, IDC_FRAME), 0, dat->curPos - pos, NULL , &(dat->frameRect));
+ ScrollWindow(GetDlgItem(hwndDlg, IDC_FRAME), 0, dat->curPos - pos, NULL, &(dat->frameRect));
SetScrollPos(GetDlgItem(hwndDlg, IDC_VSCROLL), SB_CTL, pos, TRUE);
- RECT Invalid=dat->frameRect;
+ RECT Invalid = dat->frameRect;
if (dat->curPos - pos >0)
- Invalid.bottom=Invalid.top+(dat->curPos - pos);
+ Invalid.bottom = Invalid.top + (dat->curPos - pos);
else
- Invalid.top=Invalid.bottom+(dat->curPos - pos);
+ Invalid.top = Invalid.bottom + (dat->curPos - pos);
- RedrawWindow(GetDlgItem(hwndDlg, IDC_FRAME), NULL, NULL, RDW_UPDATENOW |RDW_ALLCHILDREN);
+ RedrawWindow(GetDlgItem(hwndDlg, IDC_FRAME), NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN);
dat->curPos = pos;
- } } }
+ }
+ }
+ }
return TRUE;
case WM_DESTROY:
@@ -702,7 +714,7 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR
HWND __cdecl CJabberProto::CreateExtendedSearchUI(HWND parent)
{
if (parent && hInst) {
- ptrT szServer( getTStringA("LoginServer"));
+ ptrT szServer(getTStringA("LoginServer"));
if (szServer == NULL || mir_tstrcmpi(szServer, _T("S.ms")))
return CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEARCHUSER), parent, JabberSearchAdvancedDlgProc, (LPARAM)this);
}
@@ -718,7 +730,7 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg)
if (!m_bJabberOnline || !hwndDlg)
return 0; //error
- JabberSearchData * dat=(JabberSearchData *)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
+ JabberSearchData * dat = (JabberSearchData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (!dat)
return 0; //error
@@ -727,7 +739,7 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg)
return 0;
// formating request
- BOOL fRequestNotEmpty=FALSE;
+ BOOL fRequestNotEmpty = FALSE;
// get server name
TCHAR szServerName[100];
@@ -744,19 +756,21 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg)
// next can be 2 cases:
// Forms: XEP-0055 Example 7
if (dat->fSearchRequestIsXForm) {
- fRequestNotEmpty=TRUE;
+ fRequestNotEmpty = TRUE;
HXML n = JabberFormGetData(GetDlgItem(hwndDlg, IDC_FRAME), dat->xNode);
xmlAddChild(query, n);
xi.destroyNode(n);
}
else { //and Simple fields: XEP-0055 Example 3
- for (int i=0; i<dat->nJSInfCount; i++) {
+ for (int i = 0; i < dat->nJSInfCount; i++) {
TCHAR szFieldValue[100];
GetWindowText(dat->pJSInf[i].hwndValueItem, szFieldValue, SIZEOF(szFieldValue));
if (szFieldValue[0] != 0) {
xmlAddChild(query, dat->pJSInf[i].szFieldName, szFieldValue);
- fRequestNotEmpty=TRUE;
- } } }
+ fRequestNotEmpty = TRUE;
+ }
+ }
+ }
if (fRequestNotEmpty) {
m_ThreadInfo->send(iq);
diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp
index b86de54e6f..a58b7b23ea 100644
--- a/protocols/MRA/src/Mra.cpp
+++ b/protocols/MRA/src/Mra.cpp
@@ -86,7 +86,8 @@ extern "C" __declspec(dllexport) int Load(void)
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "MRA";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = (pfnInitProto)mraProtoInit;
diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp
index 8ab0e44bb4..c2270d4d16 100644
--- a/protocols/MRA/src/MraFilesQueue.cpp
+++ b/protocols/MRA/src/MraFilesQueue.cpp
@@ -694,9 +694,9 @@ DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hFilesQueueHandle, DWORD dwFlags
PROTORECVFILET prf;
prf.dwFlags = PRFF_UNICODE;
prf.timestamp = _time32(NULL);
- prf.tszDescription = dat->pwszDescription;
- prf.fileCount = 1;//dat->dwFilesCount;
- prf.ptszFiles = &dat->pwszFilesList;
+ prf.descr.w = dat->pwszDescription;
+ prf.fileCount = 1;
+ prf.files.w = &dat->pwszFilesList;
prf.lParam = dwIDRequest;
ProtoChainRecvFile(hContact, &prf);
return NO_ERROR;
diff --git a/protocols/MSN/src/msn.cpp b/protocols/MSN/src/msn.cpp
index de2f5bfb3c..1ddd57cb59 100644
--- a/protocols/MSN/src/msn.cpp
+++ b/protocols/MSN/src/msn.cpp
@@ -115,7 +115,8 @@ extern "C" int __declspec(dllexport) Load(void)
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "MSN";
pd.fnInit = (pfnInitProto)msnProtoInit;
pd.fnUninit = (pfnUninitProto)msnProtoUninit;
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp
index ddbf398deb..b9136e636e 100644
--- a/protocols/MSN/src/msn_commands.cpp
+++ b/protocols/MSN/src/msn_commands.cpp
@@ -487,11 +487,11 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli)
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = (desc = ezxml_child(xmli, "Description"))?mir_utf8decodeT(desc->txt):tComment;
- pre.ptszFiles = &ft->std.tszCurrentFile;
+ pre.descr.t = (desc = ezxml_child(xmli, "Description"))?mir_utf8decodeT(desc->txt):tComment;
+ pre.files.t = &ft->std.tszCurrentFile;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
- if (desc) mir_free(pre.tszDescription);
+ if (desc) mir_free(pre.descr.t);
} else uri=NULL;
}
@@ -1439,8 +1439,8 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email,
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = tComment;
- pre.ptszFiles = &ft->std.tszCurrentFile;
+ pre.descr.t = tComment;
+ pre.files.t = &ft->std.tszCurrentFile;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
return;
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp
index fbaa187a5c..2aa880dd6a 100644
--- a/protocols/MSN/src/msn_p2p.cpp
+++ b/protocols/MSN/src/msn_p2p.cpp
@@ -1232,8 +1232,8 @@ void CMsnProto::p2p_InitFileTransfer(
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = tComment;
- pre.ptszFiles = &ft->std.tszCurrentFile;
+ pre.descr.t = tComment;
+ pre.files.t = &ft->std.tszCurrentFile;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
}
diff --git a/protocols/MinecraftDynmap/src/main.cpp b/protocols/MinecraftDynmap/src/main.cpp
index c69daf0ebd..fd618ed8e9 100644
--- a/protocols/MinecraftDynmap/src/main.cpp
+++ b/protocols/MinecraftDynmap/src/main.cpp
@@ -92,7 +92,8 @@ extern "C" int __declspec(dllexport) Load(void)
mir_getLP(&pluginInfo);
mir_getCLI();
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "MinecraftDynmap";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = protoInit;
diff --git a/protocols/Omegle/src/main.cpp b/protocols/Omegle/src/main.cpp
index 603b1ff1f3..da8afbbcd6 100644
--- a/protocols/Omegle/src/main.cpp
+++ b/protocols/Omegle/src/main.cpp
@@ -94,7 +94,8 @@ extern "C" int __declspec(dllexport) Load(void)
mir_getLP(&pluginInfo);
mir_getCLI();
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "Omegle";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = protoInit;
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp
index c90fd4263a..938753c47c 100644
--- a/protocols/Sametime/src/files.cpp
+++ b/protocols/Sametime/src/files.cpp
@@ -42,8 +42,8 @@ void mwFileTransfer_offered(mwFileTransfer* ft)
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = descriptionT;
- pre.ptszFiles = &filenameT;
+ pre.descr.t = descriptionT;
+ pre.files.t = &filenameT;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp
index 708be8481f..a3824263dd 100644
--- a/protocols/Sametime/src/sametime.cpp
+++ b/protocols/Sametime/src/sametime.cpp
@@ -265,7 +265,8 @@ static int sametime_proto_uninit(PROTO_INTERFACE* ppro)
extern "C" int __declspec(dllexport) Load(void)
{
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.type = PROTOTYPE_PROTOCOL;
pd.szName = "Sametime";
pd.fnInit = (pfnInitProto)sametime_proto_init;
diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp
index 411fdbb0a4..809b3803a3 100644
--- a/protocols/SkypeClassic/src/skype.cpp
+++ b/protocols/SkypeClassic/src/skype.cpp
@@ -2070,8 +2070,8 @@ LRESULT APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam)
*ptr = ' ';
}
else if (strncmp(ptr, " CHATMESSAGES ", 14) == 0) {
- int iLen=mir_strlen(ptr+14)+1;
- char *pParam=(char*)calloc(iLen+1, 1);
+ size_t iLen = mir_strlen(ptr+14)+1;
+ char *pParam = (char*)calloc(iLen+1, 1);
*pParam=TRUE;
memcpy(pParam+1, ptr+14, iLen);
pthread_create((pThreadFunc)MessageListProcessingThread, pParam);
@@ -2127,7 +2127,6 @@ LRESULT APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam)
}
if (!strncmp(szSkypeMsg, "MESSAGES", 8) || !strncmp(szSkypeMsg, "CHATMESSAGES", 12)) {
char *pMsgs;
- int iLen;
if (mir_strlen(szSkypeMsg) <= (UINT)((pMsgs=strchr(szSkypeMsg, ' ')) - szSkypeMsg + 1))
{
LOG(("%s %d %s %d", szSkypeMsg, (UINT)(strchr(szSkypeMsg, ' ') - szSkypeMsg + 1),
@@ -2135,7 +2134,8 @@ LRESULT APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam)
break;
}
LOG(("MessageListProcessingThread launched"));
- char *pParam=(char*)calloc((iLen=mir_strlen(pMsgs)+1)+1, 1);
+ size_t iLen = mir_strlen(pMsgs)+1;
+ char *pParam=(char*)calloc(iLen+1, 1);
memcpy(pParam+1, pMsgs, iLen);
pthread_create((pThreadFunc)MessageListProcessingThread, pParam);
break;
diff --git a/protocols/SkypeClassic/src/skypeapi.cpp b/protocols/SkypeClassic/src/skypeapi.cpp
index ad6bc71967..73bf8d50b3 100644
--- a/protocols/SkypeClassic/src/skypeapi.cpp
+++ b/protocols/SkypeClassic/src/skypeapi.cpp
@@ -1100,21 +1100,8 @@ INT_PTR SkypeSetNick(WPARAM wParam, LPARAM lParam) {
* Returns: 0 - Success
* -1 - Failure
*/
-INT_PTR SkypeSetAwayMessage(WPARAM wParam, LPARAM lParam) {
- int retval = -1;
- char *Mood = NULL;
-
- if (!lParam) lParam=(LPARAM)"";
- if(utf8_encode((const char *)lParam, &Mood) == -1 ) return -1;
- db_set_s(NULL, SKYPE_PROTONAME, "MoodText", (const char *)lParam);
-
- if(AttachStatus == SKYPECONTROLAPI_ATTACH_SUCCESS)
- retval = SkypeSend("SET PROFILE MOOD_TEXT %s", Mood);
- free (Mood);
- return retval;
-}
-INT_PTR SkypeSetAwayMessageW(WPARAM wParam, LPARAM lParam) {
+INT_PTR SkypeSetAwayMessage(WPARAM wParam, LPARAM lParam) {
int retval = -1;
char *Mood = NULL;
diff --git a/protocols/SkypeClassic/src/skypeapi.h b/protocols/SkypeClassic/src/skypeapi.h
index 120b7fb462..63bf26e425 100644
--- a/protocols/SkypeClassic/src/skypeapi.h
+++ b/protocols/SkypeClassic/src/skypeapi.h
@@ -44,7 +44,6 @@ INT_PTR SkypeSendGuiFile(WPARAM wParam, LPARAM);
INT_PTR SkypeBlockContact(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeSetAvatar(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeSetAwayMessage(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeSetAwayMessageW(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeSetNick(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeChatCreate(WPARAM wParam, LPARAM lParam);
int SkypeSetProfile(char *szProperty, char *szValue);
diff --git a/protocols/SkypeClassic/src/skypesvc.cpp b/protocols/SkypeClassic/src/skypesvc.cpp
index fae8b8cd3b..1d1d2821bf 100644
--- a/protocols/SkypeClassic/src/skypesvc.cpp
+++ b/protocols/SkypeClassic/src/skypesvc.cpp
@@ -68,10 +68,10 @@ void CreateServices(void)
CreateProtoService(PS_AUTHDENY, SkypeAuthDeny);
CreateProtoService(PSR_FILE, SkypeRecvFile);
- CreateProtoService(PSS_FILEALLOWT, SkypeFileAllow);
+ CreateProtoService(PSS_FILEALLOW, SkypeFileAllow);
CreateProtoService(PSS_FILEDENY, SkypeFileCancel);
CreateProtoService(PSS_FILECANCEL, SkypeFileCancel);
- CreateProtoService(PSS_FILET, SkypeSendFile);
+ CreateProtoService(PSS_FILE, SkypeSendFile);
CreateProtoService(PS_GETAVATARINFO, SkypeGetAvatarInfo);
CreateProtoService(PS_GETAVATARCAPS, SkypeGetAvatarCaps);
@@ -79,7 +79,6 @@ void CreateServices(void)
CreateProtoService(PS_SETMYAVATAR, SkypeSetAvatar);
CreateProtoService(PS_SETAWAYMSG, SkypeSetAwayMessage);
- CreateProtoService(PS_SETAWAYMSGW, SkypeSetAwayMessageW);
CreateProtoService(PSS_GETAWAYMSG, SkypeGetAwayMessage);
CreateProtoService(PS_SETMYNICKNAME, SkypeSetNick);
diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp
index 73613c972d..ce02a8ea26 100644
--- a/protocols/SkypeWeb/src/main.cpp
+++ b/protocols/SkypeWeb/src/main.cpp
@@ -62,7 +62,8 @@ extern "C" int __declspec(dllexport) Load(void)
CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(g_szMirVer), LPARAM(g_szMirVer));
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "SKYPE";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = (pfnInitProto)CSkypeProto::InitAccount;
diff --git a/protocols/Steam/src/main.cpp b/protocols/Steam/src/main.cpp
index 6fe8317684..fa597983d9 100644
--- a/protocols/Steam/src/main.cpp
+++ b/protocols/Steam/src/main.cpp
@@ -38,7 +38,8 @@ extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "STEAM";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = (pfnInitProto)CSteamProto::InitProtoInstance;
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp
index e87fcac01d..8ec5c7cb06 100644
--- a/protocols/Tlen/src/tlen.cpp
+++ b/protocols/Tlen/src/tlen.cpp
@@ -369,7 +369,8 @@ extern "C" int __declspec(dllexport) Load(void)
TlenRegisterIcons();
// Register protocol module
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "TLEN";
pd.fnInit = ( pfnInitProto )tlenProtoInit;
pd.fnUninit = ( pfnUninitProto )tlenProtoUninit;
diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp
index 71ad60185f..4ab81e9819 100644
--- a/protocols/Tlen/src/tlen_file.cpp
+++ b/protocols/Tlen/src/tlen_file.cpp
@@ -595,8 +595,8 @@ void TlenProcessF(XmlNode *node, ThreadData *info)
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = filenameT;
- pre.ptszFiles = &filenameT;
+ pre.descr.t = filenameT;
+ pre.files.t = &filenameT;
pre.lParam = (LPARAM)ft;
ft->proto->debugLogA("sending chainrecv");
ProtoChainRecvFile(ft->hContact, &pre);
diff --git a/protocols/Tlen/src/tlen_p2p_new.cpp b/protocols/Tlen/src/tlen_p2p_new.cpp
index 5401396e96..3234fa47f0 100644
--- a/protocols/Tlen/src/tlen_p2p_new.cpp
+++ b/protocols/Tlen/src/tlen_p2p_new.cpp
@@ -263,8 +263,8 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) {
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = filenameT;
- pre.ptszFiles = &filenameT;
+ pre.descr.t = filenameT;
+ pre.files.t = &filenameT;
pre.lParam = (LPARAM)ft;
ft->proto->debugLogA("sending chainrecv");
ProtoChainRecvFile(ft->hContact, &pre);
diff --git a/protocols/Tox/src/tox.cpp b/protocols/Tox/src/tox.cpp
index 613c790e24..f6c89d2a00 100644
--- a/protocols/Tox/src/tox.cpp
+++ b/protocols/Tox/src/tox.cpp
@@ -43,7 +43,8 @@ extern "C" int __declspec(dllexport) Load(void)
mir_getCLI();
mir_getLP(&pluginInfo);
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "TOX";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = (pfnInitProto)CToxProto::InitAccount;
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp
index e1460b3d53..2586dcfee4 100644
--- a/protocols/Tox/src/tox_transfer.cpp
+++ b/protocols/Tox/src/tox_transfer.cpp
@@ -48,10 +48,8 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = _T("");
- pre.ptszFiles = (TCHAR**)mir_alloc(sizeof(TCHAR*) * 2);
- pre.ptszFiles[0] = name;
- pre.ptszFiles[1] = NULL;
+ pre.descr.t = _T("");
+ pre.files.t = &name;
pre.lParam = (LPARAM)transfer;
ProtoChainRecvFile(hContact, &pre);
}
diff --git a/protocols/Twitter/src/main.cpp b/protocols/Twitter/src/main.cpp
index 2238b60f10..2503f64da5 100644
--- a/protocols/Twitter/src/main.cpp
+++ b/protocols/Twitter/src/main.cpp
@@ -90,7 +90,8 @@ extern "C" int __declspec(dllexport) Load(void)
mir_getLP(&pluginInfo);
mir_getCLI();
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "Twitter";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = protoInit;
diff --git a/protocols/VKontakte/src/main.cpp b/protocols/VKontakte/src/main.cpp
index 460d2ec5b9..9a690049e0 100644
--- a/protocols/VKontakte/src/main.cpp
+++ b/protocols/VKontakte/src/main.cpp
@@ -83,7 +83,8 @@ extern "C" int __declspec(dllexport) Load()
InitIcons();
// Register protocol module
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "VKontakte";
pd.fnInit = (pfnInitProto)vkProtoInit;
pd.fnUninit = (pfnUninitProto)vkProtoUninit;
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp
index a1c49edf96..c5e2977c73 100644
--- a/protocols/VKontakte/src/vk_thread.cpp
+++ b/protocols/VKontakte/src/vk_thread.cpp
@@ -547,7 +547,7 @@ INT_PTR __cdecl CVkProto::SvcAddAsFriend(WPARAM hContact, LPARAM)
LONG userID = getDword(hContact, "ID", -1);
if (!IsOnline() || userID == -1 || userID == VK_FEED_USER)
return 1;
- CallContactService(hContact, PSS_AUTHREQUESTW, 0, (LPARAM)TranslateT("Please authorize me to add you to my friend list."));
+ CallContactService(hContact, PSS_AUTHREQUEST, 0, (LPARAM)TranslateT("Please authorize me to add you to my friend list."));
return 0;
}
diff --git a/protocols/WhatsApp/src/main.cpp b/protocols/WhatsApp/src/main.cpp
index f199a94d3e..93abf0bbc0 100644
--- a/protocols/WhatsApp/src/main.cpp
+++ b/protocols/WhatsApp/src/main.cpp
@@ -68,7 +68,8 @@ extern "C" int __declspec(dllexport) Load(void)
mir_getLP(&pluginInfo);
mir_getCLI();
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "WhatsApp";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = protoInit;
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp
index f757f81a96..603d7d6442 100644
--- a/protocols/Yahoo/src/file_transfer.cpp
+++ b/protocols/Yahoo/src/file_transfer.cpp
@@ -506,12 +506,12 @@ void CYahooProto::ext_got_file(const char *me, const char *who, const char *url,
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = mir_a2t(msg);
- pre.ptszFiles = &ptszFileName;
+ pre.descr.t = mir_a2t(msg);
+ pre.files.t = &ptszFileName;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
- mir_free(pre.tszDescription);
+ mir_free(pre.descr.t);
mir_free(ptszFileName);
}
@@ -550,8 +550,8 @@ void CYahooProto::ext_got_files(const char *me, const char *who, const char *ft_
PROTORECVFILET pre = {0};
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.szDescription = "";
- pre.pszFiles = (char**)&fn;
+ pre.descr.a = "";
+ pre.files.a = (char**)&fn;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->hContact, &pre);
}
diff --git a/protocols/Yahoo/src/main.cpp b/protocols/Yahoo/src/main.cpp
index feeb9715c6..9789cf760f 100644
--- a/protocols/Yahoo/src/main.cpp
+++ b/protocols/Yahoo/src/main.cpp
@@ -99,7 +99,8 @@ extern "C" int __declspec(dllexport)Load(void)
mir_getLP( &pluginInfo );
mir_getCLI();
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "YAHOO";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = ( pfnInitProto )yahooProtoInit;
diff --git a/src/core/stdauth/src/authdialogs.cpp b/src/core/stdauth/src/authdialogs.cpp
index d1b1e3833d..5de5cb0cf3 100644
--- a/src/core/stdauth/src/authdialogs.cpp
+++ b/src/core/stdauth/src/authdialogs.cpp
@@ -266,9 +266,9 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_DENYREASON))) {
TCHAR szReason[256];
GetDlgItemText(hwndDlg, IDC_DENYREASON, szReason, SIZEOF(szReason));
- CallProtoService(dbei.szModule, PS_AUTHDENYT, (WPARAM)hDbEvent, (LPARAM)szReason);
+ CallProtoService(dbei.szModule, PS_AUTHDENY, (WPARAM)hDbEvent, (LPARAM)szReason);
}
- else CallProtoService(dbei.szModule, PS_AUTHDENYT, (WPARAM)hDbEvent, 0);
+ else CallProtoService(dbei.szModule, PS_AUTHDENY, (WPARAM)hDbEvent, 0);
}
DestroyWindow(hwndDlg);
break;
diff --git a/src/core/stdautoaway/src/autoaway.cpp b/src/core/stdautoaway/src/autoaway.cpp
index a619c831c1..f501ec2bda 100644
--- a/src/core/stdautoaway/src/autoaway.cpp
+++ b/src/core/stdautoaway/src/autoaway.cpp
@@ -49,7 +49,7 @@ static void Proto_SetStatus(const char* szProto, unsigned status)
{
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) {
TCHAR *awayMsg = (TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGW, status, (LPARAM)szProto);
- CallProtoService(szProto, PS_SETAWAYMSGT, status, (LPARAM)awayMsg);
+ CallProtoService(szProto, PS_SETAWAYMSG, status, (LPARAM)awayMsg);
mir_free(awayMsg);
}
diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp
index a86f79f917..4b36e6aa15 100644
--- a/src/core/stdaway/src/sendmsg.cpp
+++ b/src/core/stdaway/src/sendmsg.cpp
@@ -194,10 +194,10 @@ void ChangeAllProtoMessages(char *szProto, int statusMode, TCHAR *msg)
continue;
if ((CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) && !Proto_IsAccountLocked(pa))
- CallProtoService(pa->szModuleName, PS_SETAWAYMSGT, statusMode, (LPARAM)msg);
+ CallProtoService(pa->szModuleName, PS_SETAWAYMSG, statusMode, (LPARAM)msg);
}
}
- else CallProtoService(szProto, PS_SETAWAYMSGT, statusMode, (LPARAM)msg);
+ else CallProtoService(szProto, PS_SETAWAYMSG, statusMode, (LPARAM)msg);
}
struct SetAwayMsgData
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp
index 0b263cf47b..d867dc18f3 100644
--- a/src/core/stdfile/src/file.cpp
+++ b/src/core/stdfile/src/file.cpp
@@ -392,13 +392,13 @@ static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam)
if (bUnicode) {
pszFiles = (char**)alloca(pre->fileCount * sizeof(char*));
for (int i = 0; i < pre->fileCount; i++)
- pszFiles[i] = Utf8EncodeT(pre->ptszFiles[i]);
+ pszFiles[i] = Utf8EncodeT(pre->files.t[i]);
- szDescr = Utf8EncodeT(pre->tszDescription);
+ szDescr = Utf8EncodeT(pre->descr.t);
}
else {
- pszFiles = pre->pszFiles;
- szDescr = pre->szDescription;
+ pszFiles = pre->files.a;
+ szDescr = pre->descr.a;
}
dbei.cbBlob = sizeof(DWORD);
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp
index ccfaa427e2..d49fd5f3db 100644
--- a/src/core/stdfile/src/filerecvdlg.cpp
+++ b/src/core/stdfile/src/filerecvdlg.cpp
@@ -376,7 +376,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
break;
case IDCANCEL:
- if (dat->fs) CallContactService(dat->hContact, PSS_FILEDENYT, (WPARAM)dat->fs, (LPARAM)TranslateT("Canceled"));
+ if (dat->fs) CallContactService(dat->hContact, PSS_FILEDENY, (WPARAM)dat->fs, (LPARAM)TranslateT("Canceled"));
dat->fs = NULL; /* the protocol will free the handle */
DestroyWindow(hwndDlg);
break;
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp
index 507c63ca19..15bfe94d41 100644
--- a/src/core/stdfile/src/filexferdlg.cpp
+++ b/src/core/stdfile/src/filexferdlg.cpp
@@ -236,7 +236,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (dat->send) {
if (db_mc_isMeta(dat->hContact))
dat->hContact = db_mc_getMostOnline(dat->hContact);
- dat->fs = (HANDLE)CallContactService(dat->hContact, PSS_FILET, (WPARAM)dat->szMsg, (LPARAM)dat->files);
+ dat->fs = (HANDLE)CallContactService(dat->hContact, PSS_FILE, (WPARAM)dat->szMsg, (LPARAM)dat->files);
SetFtStatus(hwndDlg, LPGENT("Request sent, waiting for acceptance..."), FTS_TEXT);
SetOpenFileButtonStyle(GetDlgItem(hwndDlg, IDC_OPENFILE), 1);
dat->waitingForAcceptance = 1;
@@ -246,7 +246,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
}
else { //recv
CreateDirectoryTreeT(dat->szSavePath);
- dat->fs = (HANDLE)CallContactService(dat->hContact, PSS_FILEALLOWT, (WPARAM)dat->fs, (LPARAM)dat->szSavePath);
+ dat->fs = (HANDLE)CallContactService(dat->hContact, PSS_FILEALLOW, (WPARAM)dat->fs, (LPARAM)dat->szSavePath);
dat->transferStatus.tszWorkingDir = mir_tstrdup(dat->szSavePath);
if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) dat->resumeBehaviour = FILERESUME_ASK;
else dat->resumeBehaviour = db_get_b(NULL, "SRFile", "IfExists", FILERESUME_ASK);
@@ -491,7 +491,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
break;
}
mir_free(szOriginalFilename);
- CallProtoService(szProto, PS_FILERESUMET, (WPARAM)dat->fs, (LPARAM)pfr);
+ CallProtoService(szProto, PS_FILERESUME, (WPARAM)dat->fs, (LPARAM)pfr);
if (pfr->szFilename) mir_free((char*)pfr->szFilename);
mir_free(pfr);
}
diff --git a/src/modules/addcontact/addcontact.cpp b/src/modules/addcontact/addcontact.cpp
index 0c905b1c52..9379e3f283 100644
--- a/src/modules/addcontact/addcontact.cpp
+++ b/src/modules/addcontact/addcontact.cpp
@@ -215,9 +215,9 @@ public:
if (m_chkAuth.GetState()) {
DWORD flags = CallProtoServiceInt(NULL, m_acs.szProto, PS_GETCAPS, PFLAGNUM_4, 0);
if (flags & PF4_NOCUSTOMAUTH)
- CallContactService(hContact, PSS_AUTHREQUESTT, 0, 0);
+ CallContactService(hContact, PSS_AUTHREQUEST, 0, 0);
else
- CallContactService(hContact, PSS_AUTHREQUESTT, 0, ptrT(m_authReq.GetText()));
+ CallContactService(hContact, PSS_AUTHREQUEST, 0, ptrT(m_authReq.GetText()));
}
if (m_chkOpen.GetState())
diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp
index 82820806e6..2805667212 100644
--- a/src/modules/findadd/findadd.cpp
+++ b/src/modules/findadd/findadd.cpp
@@ -699,7 +699,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (str[0] == 0)
MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_ICONERROR | MB_OK);
else
- BeginSearch(hwndDlg, dat, szProto, PS_BASICSEARCHT, PF1_BASICSEARCH, str);
+ BeginSearch(hwndDlg, dat, szProto, PS_BASICSEARCH, PF1_BASICSEARCH, str);
}
else if (IsDlgButtonChecked(hwndDlg, IDC_BYEMAIL)) {
TCHAR str[256];
@@ -708,7 +708,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (str[0] == 0)
MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_ICONERROR | MB_OK);
else
- BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYEMAILT, PF1_SEARCHBYEMAIL, str);
+ BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYEMAIL, PF1_SEARCHBYEMAIL, str);
}
else if (IsDlgButtonChecked(hwndDlg, IDC_BYNAME)) {
TCHAR nick[256], first[256], last[256];
@@ -722,7 +722,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (nick[0] == 0 && first[0] == 0 && last[0] == 0)
MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_ICONERROR | MB_OK);
else
- BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYNAMET, PF1_SEARCHBYNAME, &psbn);
+ BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYNAME, PF1_SEARCHBYNAME, &psbn);
}
else if (IsDlgButtonChecked(hwndDlg, IDC_BYADVANCED)) {
if (dat->hwndAdvSearch == NULL)
diff --git a/src/modules/metacontacts/meta_main.cpp b/src/modules/metacontacts/meta_main.cpp
index aeb488aad4..8e2cd9c929 100644
--- a/src/modules/metacontacts/meta_main.cpp
+++ b/src/modules/metacontacts/meta_main.cpp
@@ -69,7 +69,8 @@ int LoadMetacontacts(void)
Meta_ReadOptions();
- PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = META_FILTER;
pd.type = PROTOTYPE_FILTER;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp
index b209ce9d38..140efe927b 100644
--- a/src/modules/protocols/protocols.cpp
+++ b/src/modules/protocols/protocols.cpp
@@ -81,28 +81,27 @@ static INT_PTR srvProto_RegisterModule(WPARAM, LPARAM lParam)
if (p == NULL)
return 2;
- if (pd->cbSize == PROTOCOLDESCRIPTOR_V3_SIZE) {
- if (p->type == PROTOTYPE_PROTOCOL || p->type == PROTOTYPE_VIRTUAL) {
- // let's create a new container
- PROTO_INTERFACE* ppi = AddDefaultAccount(pd->szName);
- if (ppi) {
- PROTOACCOUNT *pa = Proto_GetAccount(pd->szName);
- if (pa == NULL) {
- pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
- pa->cbSize = sizeof(PROTOACCOUNT);
- pa->szModuleName = mir_strdup(pd->szName);
- pa->szProtoName = mir_strdup(pd->szName);
- pa->tszAccountName = mir_a2t(pd->szName);
- pa->bIsVisible = pa->bIsEnabled = true;
- pa->iOrder = accounts.getCount();
- accounts.insert(pa);
- }
- pa->bOldProto = true;
- pa->bIsVirtual = (p->type == PROTOTYPE_VIRTUAL);
- pa->ppro = ppi;
- p->fnInit = defInitProto;
- p->fnUninit = FreeDefaultAccount;
+ if (p->fnInit == NULL && (p->type == PROTOTYPE_PROTOCOL || p->type == PROTOTYPE_VIRTUAL)) {
+ // let's create a new container
+ PROTO_INTERFACE* ppi = AddDefaultAccount(pd->szName);
+ if (ppi) {
+ ppi->m_iVersion = (pd->cbSize == PROTOCOLDESCRIPTOR_V3_SIZE) ? 1 : 2;
+ PROTOACCOUNT *pa = Proto_GetAccount(pd->szName);
+ if (pa == NULL) {
+ pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
+ pa->cbSize = sizeof(PROTOACCOUNT);
+ pa->szModuleName = mir_strdup(pd->szName);
+ pa->szProtoName = mir_strdup(pd->szName);
+ pa->tszAccountName = mir_a2t(pd->szName);
+ pa->bIsVisible = pa->bIsEnabled = true;
+ pa->iOrder = accounts.getCount();
+ accounts.insert(pa);
}
+ pa->bOldProto = true;
+ pa->bIsVirtual = (p->type == PROTOTYPE_VIRTUAL);
+ pa->ppro = ppi;
+ p->fnInit = defInitProto;
+ p->fnUninit = FreeDefaultAccount;
}
}
@@ -211,7 +210,7 @@ void Proto_SetStatus(const char *szProto, unsigned status)
{
if (CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) {
TCHAR *awayMsg = (TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, status, (LPARAM)szProto);
- CallProtoServiceInt(NULL, szProto, PS_SETAWAYMSGT, status, (LPARAM)awayMsg);
+ CallProtoServiceInt(NULL, szProto, PS_SETAWAYMSG, status, (LPARAM)awayMsg);
mir_free(awayMsg);
}
CallProtoServiceInt(NULL, szProto, PS_SETSTATUS, status, 0);
@@ -344,7 +343,7 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char
{
PROTOACCOUNT *pa = Proto_GetAccount(szModule);
if (pa && !pa->bOldProto) {
- PROTO_INTERFACE* ppi;
+ PROTO_INTERFACE *ppi;
if ((ppi = pa->ppro) == NULL)
return CALLSERVICE_NOTFOUND;
@@ -392,17 +391,18 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char
if (ppi->m_iVersion > 1)
return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, _A2T((char*)lParam));
return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (PROTOCHAR*)lParam);
- case 11: {
- PROTOFILERESUME* pfr = (PROTOFILERESUME*)lParam;
- if (ppi->m_iVersion > 1) {
- PROTOCHAR* szFname = mir_a2t((char*)pfr->szFilename);
- INT_PTR res = (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const PROTOCHAR**)&szFname);
- mir_free((PROTOCHAR*)pfr->szFilename);
- pfr->szFilename = (PROTOCHAR*)mir_t2a(szFname); mir_free(szFname);
+ case 11:
+ {
+ PROTOFILERESUME* pfr = (PROTOFILERESUME*)lParam;
+ if (ppi->m_iVersion > 1) {
+ PROTOCHAR* szFname = mir_a2t((char*)pfr->szFilename);
+ INT_PTR res = (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const PROTOCHAR**)&szFname);
+ mir_free((PROTOCHAR*)pfr->szFilename);
+ pfr->szFilename = (PROTOCHAR*)mir_t2a(szFname); mir_free(szFname);
+ }
+ else return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const PROTOCHAR**)&pfr->szFilename);
}
- else
- return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const PROTOCHAR**)&pfr->szFilename);
- }
+
case 12: return (INT_PTR)ppi->GetCaps(wParam, lParam);
case 13: return (INT_PTR)Proto_GetIcon(ppi, wParam);
case 14: return (INT_PTR)ppi->GetInfo(hContact, wParam);
@@ -414,13 +414,14 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char
if (ppi->m_iVersion > 1)
return (INT_PTR)ppi->SearchByEmail(_A2T((char*)lParam));
return (INT_PTR)ppi->SearchByEmail((TCHAR*)lParam);
- case 17: {
- PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SearchByName(_A2T((char*)psbn->pszNick), _A2T((char*)psbn->pszFirstName), _A2T((char*)psbn->pszLastName));
- else
- return (INT_PTR)ppi->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
- }
+ case 17:
+ {
+ PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SearchByName(_A2T((char*)psbn->pszNick), _A2T((char*)psbn->pszFirstName), _A2T((char*)psbn->pszLastName));
+ else
+ return (INT_PTR)ppi->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
+ }
case 18: return (INT_PTR)ppi->SearchAdvanced((HWND)lParam);
case 19: return (INT_PTR)ppi->CreateExtendedSearchUI((HWND)lParam);
case 20: return (INT_PTR)ppi->RecvContacts(hContact, (PROTORECVEVENT*)lParam);
@@ -449,126 +450,13 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char
return (INT_PTR)ppi->SetAwayMsg(wParam, (TCHAR*)lParam);
case 34: return (INT_PTR)ppi->UserIsTyping(wParam, lParam);
case 35: mir_strncpy((char*)lParam, ppi->m_szModuleName, wParam); return 0;
- case 36: return ppi->m_iStatus;
-
- case 100:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SetAwayMsg(wParam, (TCHAR*)lParam);
- return (INT_PTR)ppi->SetAwayMsg(wParam, StrConvA((TCHAR*)lParam));
- case 102:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SendFile(hContact, (TCHAR*)wParam, (TCHAR**)lParam);
- else {
- char** files = Proto_FilesMatrixA((TCHAR**)lParam);
- INT_PTR res = (INT_PTR)ppi->SendFile(hContact, StrConvA((TCHAR*)wParam), (TCHAR**)files);
- if (res == 0) FreeFilesMatrix((TCHAR***)&files);
- return res;
- }
- case 103:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, (TCHAR*)lParam);
- return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, StrConvA((TCHAR*)lParam));
- case 104:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (TCHAR*)lParam);
- return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, StrConvA((TCHAR*)lParam));
- case 105: {
- PROTOFILERESUME* pfr = (PROTOFILERESUME*)lParam;
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const PROTOCHAR**)&pfr->szFilename);
- else {
- char* szFname = mir_t2a(pfr->szFilename);
- INT_PTR res = (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action,
- (const PROTOCHAR**)&szFname);
- mir_free(szFname);
- return (INT_PTR) res;
- }
+ case 36:
+ return ppi->m_iStatus;
}
- case 106:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->AuthRequest(hContact, (const TCHAR*)lParam);
- return (INT_PTR)ppi->AuthRequest(hContact, StrConvA((const TCHAR*)lParam));
- case 107:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->AuthDeny((MEVENT)wParam, (const TCHAR*)lParam);
- return (INT_PTR)ppi->AuthDeny((MEVENT)wParam, StrConvA((const TCHAR*)lParam));
- case 108:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SearchBasic((const TCHAR*)lParam);
- return (INT_PTR)ppi->SearchBasic(StrConvA((const TCHAR*)lParam));
- case 109: {
- PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
- return (INT_PTR)ppi->SearchByName(StrConvA((TCHAR*)psbn->pszNick),
- StrConvA((TCHAR*)psbn->pszFirstName), StrConvA((TCHAR*)psbn->pszLastName));
- }
- case 110:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SearchByEmail((const TCHAR*)lParam);
- return (INT_PTR)ppi->SearchByEmail(StrConvA((const TCHAR*)lParam));
- }
- }
- }
-
- if (!mir_strcmp(szService, PS_ADDTOLIST)) {
- PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
- if (!(psr->flags & PSR_UNICODE)) {
- PROTOSEARCHRESULT *psra = (PROTOSEARCHRESULT*)_alloca(psr->cbSize);
- memcpy(psra, psr, psr->cbSize);
- psra->nick.a = mir_u2a(psr->nick.t);
- psra->firstName.a = mir_u2a(psr->firstName.t);
- psra->lastName.a = mir_u2a(psr->lastName.t);
- psra->email.a = mir_u2a(psr->email.t);
-
- INT_PTR res = ProtoCallService(szModule, szService, wParam, (LPARAM)psra);
-
- mir_free(psra->nick.a);
- mir_free(psra->firstName.a);
- mir_free(psra->lastName.a);
- mir_free(psra->email.a);
- return res;
}
}
- INT_PTR res = ProtoCallService(szModule, szService, wParam, lParam);
-
- if (res == CALLSERVICE_NOTFOUND && pa && pa->bOldProto && pa->ppro && strchr(szService, 'W')) {
- TServiceListItem *item = serviceItems.find((TServiceListItem*)&szService);
- if (!item) return res;
-
- CCSDATA *ccs = (CCSDATA*)lParam;
- switch (item->id) {
- case 100:
- return (INT_PTR)pa->ppro->SetAwayMsg(wParam, (TCHAR*)lParam);
- case 102:
- return (INT_PTR)pa->ppro->SendFile(ccs->hContact, (TCHAR*)ccs->wParam, (TCHAR**)ccs->lParam);
- case 103:
- return (INT_PTR)pa->ppro->FileAllow(ccs->hContact, (HANDLE)ccs->wParam, (TCHAR*)ccs->lParam);
- case 104:
- return (INT_PTR)pa->ppro->FileDeny(ccs->hContact, (HANDLE)ccs->wParam, (TCHAR*)ccs->lParam);
- case 105:
- {
- PROTOFILERESUME* pfr = (PROTOFILERESUME*)lParam;
- return (INT_PTR)pa->ppro->FileResume((HANDLE)wParam, &pfr->action, &pfr->szFilename);
- }
- case 106:
- return (INT_PTR)pa->ppro->AuthRequest(ccs->hContact, (const TCHAR*)ccs->lParam);
- case 107:
- return (INT_PTR)pa->ppro->AuthDeny((MEVENT)wParam, (const TCHAR*)lParam);
- case 108:
- return (INT_PTR)pa->ppro->SearchBasic((const TCHAR*)lParam);
- case 109:
- {
- PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
- return (INT_PTR)pa->ppro->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
- }
- case 110:
- return (INT_PTR)pa->ppro->SearchByEmail((const TCHAR*)lParam);
- }
- }
-
- return res;
+ return ProtoCallService(szModule, szService, wParam, lParam);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -623,17 +511,6 @@ int LoadProtocolsModule(void)
InsertServiceListItem(35, PS_GETNAME);
InsertServiceListItem(36, PS_GETSTATUS);
- InsertServiceListItem(100, PS_SETAWAYMSGW);
- InsertServiceListItem(102, PSS_FILEW);
- InsertServiceListItem(103, PSS_FILEALLOWW);
- InsertServiceListItem(104, PSS_FILEDENYW);
- InsertServiceListItem(105, PS_FILERESUMEW);
- InsertServiceListItem(106, PSS_AUTHREQUESTW);
- InsertServiceListItem(107, PS_AUTHDENYW);
- InsertServiceListItem(108, PS_BASICSEARCHW);
- InsertServiceListItem(109, PS_SEARCHBYNAMEW);
- InsertServiceListItem(110, PS_SEARCHBYEMAILW);
-
hTypeEvent = CreateHookableEvent(ME_PROTO_CONTACTISTYPING);
hAccListChanged = CreateHookableEvent(ME_PROTO_ACCLISTCHANGED);
diff --git a/src/modules/protocols/protoint.cpp b/src/modules/protocols/protoint.cpp
index d6b9a9f39f..2252877ce4 100644
--- a/src/modules/protocols/protoint.cpp
+++ b/src/modules/protocols/protoint.cpp
@@ -53,7 +53,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent)
{
- return (MCONTACT)ProtoCallService(m_szModuleName, PS_ADDTOLISTBYEVENT, MAKELONG(flags, iContact), (LPARAM)hDbEvent);
+ return (MCONTACT)ProtoCallService(m_szModuleName, PS_ADDTOLISTBYEVENT, MAKELONG(flags, iContact), hDbEvent);
}
int __cdecl Authorize(MEVENT hDbEvent)
@@ -61,18 +61,21 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return (int)ProtoCallService(m_szModuleName, PS_AUTHALLOW, (WPARAM)hDbEvent, 0);
}
- int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR* szReason)
+ int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR *szReason)
{
- return (int)ProtoCallService(m_szModuleName, PS_AUTHDENY, (WPARAM)hDbEvent, (LPARAM)StrConvA(szReason));
+ if (m_iVersion > 1)
+ return (int)ProtoCallService(m_szModuleName, PS_AUTHDENY, hDbEvent, (LPARAM)szReason);
+
+ return (int)ProtoCallService(m_szModuleName, PS_AUTHDENY, hDbEvent, (LPARAM)StrConvA(szReason));
}
- int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT* evt)
+ int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT *evt)
{
CCSDATA ccs = { hContact, PSR_AUTH, 0, (LPARAM)evt };
return (int)ProtoCallService(m_szModuleName, PSR_AUTH, 0, (LPARAM)&ccs);
}
- int __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage)
+ int __cdecl AuthRequest(MCONTACT hContact, const TCHAR *szMessage)
{
CCSDATA ccs = { hContact, PSS_AUTHREQUEST, 0, (LPARAM)szMessage };
ccs.lParam = (LPARAM)mir_t2a(szMessage);
@@ -134,11 +137,16 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
HANDLE __cdecl SearchBasic(const PROTOCHAR* id)
{
+ if (m_iVersion > 1)
+ return (HANDLE)ProtoCallService(m_szModuleName, PS_BASICSEARCH, 0, (LPARAM)id);
+
return (HANDLE)ProtoCallService(m_szModuleName, PS_BASICSEARCH, 0, (LPARAM)StrConvA(id));
}
HANDLE __cdecl SearchByEmail(const PROTOCHAR* email)
{
+ if (m_iVersion > 1)
+ return (HANDLE)ProtoCallService(m_szModuleName, PS_SEARCHBYEMAIL, 0, (LPARAM)email);
return (HANDLE)ProtoCallService(m_szModuleName, PS_SEARCHBYEMAIL, 0, (LPARAM)StrConvA(email));
}
@@ -245,6 +253,8 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
int __cdecl SetAwayMsg(int iStatus, const TCHAR* msg)
{
+ if (m_iVersion > 1)
+ return (int)ProtoCallService(m_szModuleName, PS_SETAWAYMSG, iStatus, (LPARAM)msg);
return (int)ProtoCallService(m_szModuleName, PS_SETAWAYMSG, iStatus, (LPARAM)StrConvA(msg));
}