diff options
author | Szymon Tokarz <wsx22@o2.pl> | 2014-11-11 01:04:07 +0000 |
---|---|---|
committer | Szymon Tokarz <wsx22@o2.pl> | 2014-11-11 01:04:07 +0000 |
commit | eabafdf4b42139ff85a8c8212cd0a9d287171e73 (patch) | |
tree | ef952efd34dddb609a4590f79cdc5e481f647a8e /protocols/Sametime/src | |
parent | b43b7abf33f5b2ab480a85584df0e3ce8c76a8ca (diff) |
Sametime protocol:
- Add more options to client major/minor version settings, add gui combobox (db settings ClientVersionMajor, ClientVersionMinor used and still works if set from db)
Enables connect to more modern servers
- More ClientIDs on combobox list.
- Better list of error codes, now translateable.
- Merge some 3rd party patches to meanwhile lib.
https://gist.github.com/jricesterenator/c67dfbdd0887f7ecc26a
https://github.com/mrcsparker/meanwhile/commit/e2299d3c70a3351ab148f4febdebceb71f7b526d
https://github.com/mrcsparker/meanwhile/commit/2e68651f13aebeab9e71312e59da204d3d72092c
git-svn-id: http://svn.miranda-ng.org/main/trunk@10949 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Sametime/src')
28 files changed, 404 insertions, 102 deletions
diff --git a/protocols/Sametime/src/meanwhile/src/channel.c b/protocols/Sametime/src/meanwhile/src/channel.c index a9dc2836be..07334c18e7 100644 --- a/protocols/Sametime/src/meanwhile/src/channel.c +++ b/protocols/Sametime/src/meanwhile/src/channel.c @@ -19,8 +19,6 @@ */ #include <glib.h> -#include <glib/ghash.h> -#include <glib/glist.h> #include <string.h> #include "mw_channel.h" diff --git a/protocols/Sametime/src/meanwhile/src/error.c b/protocols/Sametime/src/meanwhile/src/error.c index 23c9559802..6005eddbd1 100644 --- a/protocols/Sametime/src/meanwhile/src/error.c +++ b/protocols/Sametime/src/meanwhile/src/error.c @@ -37,6 +37,9 @@ case val: \ m = str; \ break; +/// Miranda NG development start +// LPGEN - don't want depend meanwhile from miranda headers, but want to have translatable strings +#define LPGEN(s) s char* mwError(guint32 code) { const char *m; @@ -44,47 +47,106 @@ char* mwError(guint32 code) { switch(code) { /* 8.3.1.1 General error/success codes */ - CASE(ERR_SUCCESS, "Success"); - CASE(ERR_FAILURE, "General failure"); - CASE(ERR_REQUEST_DELAY, "Request delayed"); - CASE(ERR_REQUEST_INVALID, "Request is invalid"); - CASE(ERR_NOT_AUTHORIZED, "Not authorized"); - CASE(ERR_NO_USER, "User is not online"); - CASE(ERR_CHANNEL_NO_SUPPORT, "Requested channel is not supported"); - CASE(ERR_CHANNEL_EXISTS, "Requested channel already exists"); - CASE(ERR_SERVICE_NO_SUPPORT, "Requested service is not supported"); - CASE(ERR_PROTOCOL_NO_SUPPORT, "Requested protocol is not supported"); - CASE(ERR_VERSION_NO_SUPPORT, "Version is not supported"); - CASE(ERR_USER_SKETCHY, "User is invalid or not trusted"); - CASE(ERR_ALREADY_INITIALIZED, "Already initialized"); - CASE(ERR_ENCRYPT_NO_SUPPORT, "Encryption method not supported"); - CASE(ERR_NO_COMMON_ENCRYPT, "No common encryption method"); - + CASE(ERR_SUCCESS, LPGEN("Success")); + CASE(ERR_FAILURE, LPGEN("General failure")); + CASE(ERR_REQUEST_DELAY, LPGEN("Request delayed")); + CASE(ERR_REQUEST_INVALID, LPGEN("Request is invalid")); + CASE(ERR_NOT_LOGGED_IN, LPGEN("Not logged in")); + CASE(ERR_NOT_AUTHORIZED, LPGEN("Not authorized")); + CASE(ERR_ABORT, LPGEN("Operation aborted")); + CASE(ERR_NO_ELEMENT, LPGEN("No element")); + CASE(ERR_NO_USER, LPGEN("User is not online")); + CASE(ERR_BAD_DATA, LPGEN("Invalid data")); + CASE(ERR_NOT_IMPLEMENTED, LPGEN("Not implemented")); + CASE(ERR_UNKNOWN_ERROR, LPGEN("Unknown error")); + CASE(ERR_STARVING, LPGEN("Not enough resources")); + CASE(ERR_CHANNEL_NO_SUPPORT, LPGEN("Requested channel is not supported")); + CASE(ERR_CHANNEL_EXISTS, LPGEN("Requested channel already exists")); + CASE(ERR_SERVICE_NO_SUPPORT, LPGEN("Requested service is not supported")); + CASE(ERR_PROTOCOL_NO_SUPPORT, LPGEN("Requested protocol is not supported")); + CASE(ERR_PROTOCOL_NO_SUPPORT2, LPGEN("Requested protocol is not supported")); + CASE(ERR_VERSION_NO_SUPPORT, LPGEN("Version is not supported")); + CASE(ERR_USER_SKETCHY, LPGEN("User is invalid or not trusted")); + CASE(ERR_ALREADY_INITIALIZED, LPGEN("Already initialized")); + CASE(ERR_NOT_OWNER, LPGEN("Not an owner")); + CASE(ERR_TOKEN_INVALID, LPGEN("Invalid token")); + CASE(ERR_TOKEN_EXPIRED, LPGEN("Token expired")); + CASE(ERR_TOKEN_IP_MISMATCH, LPGEN("Token mismatch")); + CASE(ERR_PORT_IN_USE, LPGEN("Port in use")); + CASE(ERR_NETWORK_DEAD, LPGEN("Network error")); + CASE(ERR_NO_MASTER_CHANNEL, LPGEN("Master channel error")); + CASE(ERR_ALREADY_SUBSCRIBED, LPGEN("Already subscribed")); + CASE(ERR_NOT_SUBSCRIBED, LPGEN("Not subscribed")); + CASE(ERR_ENCRYPT_NO_SUPPORT, LPGEN("Encryption method not supported")); + CASE(ERR_ENCRYPT_UNINITIALIZED, LPGEN("Encryption not initialized")); + CASE(ERR_ENCRYPT_UNACCEPTABLE, LPGEN("Encryption too low")); + CASE(ERR_ENCRYPT_INVALID, LPGEN("Invalid encrypted data")); + CASE(ERR_NO_COMMON_ENCRYPT, LPGEN("No common encryption method")); + CASE(ERR_CHANNEL_DESTROYED, LPGEN("Channel destroyed")); + CASE(ERR_CHANNEL_REDIRECTED, LPGEN("Channel redirected")); + CASE(ERR_INCORRECT_ENTRY, LPGEN("Incorrect entry")); + /* 8.3.1.2 Connection/disconnection errors */ - CASE(VERSION_MISMATCH, "Version mismatch"); - CASE(FAT_MESSAGE, "Message is too large"); - CASE(CONNECTION_BROKEN, "Connection broken"); - CASE(CONNECTION_ABORTED, "Connection aborted"); - CASE(CONNECTION_REFUSED, "Connection refused"); - CASE(CONNECTION_RESET, "Connection reset"); - CASE(CONNECTION_TIMED, "Connection timed out"); - CASE(CONNECTION_CLOSED, "Connection closed"); - CASE(INCORRECT_LOGIN, "Incorrect Username/Password"); - CASE(VERIFICATION_DOWN, "Login verification down or unavailable"); - CASE(GUEST_IN_USE, "The guest name is currently being used"); - CASE(MULTI_SERVER_LOGIN, "Login to two different servers concurrently"); - CASE(MULTI_SERVER_LOGIN2, "Login to two different servers concurrently"); - CASE(SERVER_BROKEN, "Server misconfiguration"); + CASE(VERSION_MISMATCH, LPGEN("Version mismatch")); + CASE(INSUF_BUFFER, LPGEN("Not enough buffers memory")); + CASE(NOT_IN_USE, LPGEN("Not in use")); + CASE(INSUF_SOCKET, LPGEN("Not enough sockets")); + CASE(HARDWARE_ERROR, LPGEN("Hardware error")); + CASE(NETWORK_DOWN, LPGEN("Network error")); + CASE(HOST_DOWN, LPGEN("Host error")); + CASE(HOST_UNREACHABLE, LPGEN("Host unreachable")); + CASE(TCPIP_ERROR, LPGEN("Internet protocol error")); + CASE(FAT_MESSAGE, LPGEN("Message is too large")); + CASE(PROXY_ERROR, LPGEN("Proxy error")); + CASE(SERVER_FULL, LPGEN("Server full")); + CASE(SERVER_NORESPOND, LPGEN("Server not responding")); + CASE(CANT_CONNECT, LPGEN("Connection error")); + CASE(USER_REMOVED, LPGEN("User removed")); + CASE(PROTOCOL_ERROR, LPGEN("Sametime protocol error")); + CASE(USER_RESTRICTED, LPGEN("User restricted")); + CASE(INCORRECT_LOGIN, LPGEN("Incorrect Username/Password")); + CASE(ENCRYPT_MISMATCH, LPGEN("Encryption mismatch")); + CASE(USER_UNREGISTERED, LPGEN("User unregistered")); + CASE(VERIFICATION_DOWN, LPGEN("Login verification down or unavailable")); + CASE(USER_TOO_IDLE, LPGEN("User too idle")); + CASE(GUEST_IN_USE, LPGEN("The guest name is currently being used")); + CASE(USER_EXISTS, LPGEN("User exists")); + CASE(USER_RE_LOGIN, LPGEN("User relogin")); + CASE(BAD_NAME, LPGEN("Bad name")); + CASE(REG_MODE_NS, LPGEN("Registration error")); + CASE(WRONG_USER_PRIV, LPGEN("Privilage error")); + CASE(NEED_EMAIL, LPGEN("Need email")); + CASE(DNS_ERROR, LPGEN("DNS error")); + CASE(DNS_FATAL_ERROR, LPGEN("DNS fatal error")); + CASE(DNS_NOT_FOUND, LPGEN("DNS not found")); + CASE(CONNECTION_BROKEN, LPGEN("Connection broken")); + CASE(CONNECTION_ABORTED, LPGEN("Connection aborted")); + CASE(CONNECTION_REFUSED, LPGEN("Connection refused")); + CASE(CONNECTION_RESET, LPGEN("Connection reset")); + CASE(CONNECTION_TIMED, LPGEN("Connection timed out")); + CASE(CONNECTION_CLOSED, LPGEN("Connection closed")); + CASE(MULTI_SERVER_LOGIN, LPGEN("Login to two different servers concurrently (1)")); + CASE(MULTI_SERVER_LOGIN2, LPGEN("Login to two different servers concurrently (2)")); + CASE(MULTI_LOGIN_COMP, LPGEN("Already logged on, disconnected")); + CASE(MUTLI_LOGIN_ALREADY, LPGEN("Already logged on")); + CASE(SERVER_BROKEN, LPGEN("Server misconfiguration")); + CASE(SERVER_PATH_OLD, LPGEN("Server needs upgrade")); + CASE(APPLET_LOGOUT, LPGEN("Applet Logout")); /* 8.3.1.3 Client error codes */ - CASE(ERR_CLIENT_USER_GONE, "User is not online"); - CASE(ERR_CLIENT_USER_DND, "User is in Do Not Disturb mode"); - CASE(ERR_CLIENT_USER_ELSEWHERE, "Already logged in elsewhere"); + CASE(ERR_CLIENT_USER_GONE, LPGEN("User is not online")); + CASE(ERR_CLIENT_USER_DND, LPGEN("User is in Do Not Disturb mode")); + CASE(ERR_CLIENT_USER_ELSEWHERE, LPGEN("Already logged in elsewhere")); /* 8.3.1.4 IM error codes */ - CASE(ERR_IM_COULDNT_REGISTER, "Cannot register a reserved type"); - CASE(ERR_IM_ALREADY_REGISTERED, "Requested type is already registered"); - CASE(ERR_IM_NOT_REGISTERED, "Requested type is not registered"); + CASE(ERR_IM_COULDNT_REGISTER, LPGEN("Cannot register a reserved type")); + CASE(ERR_IM_ALREADY_REGISTERED, LPGEN("Requested type is already registered")); + CASE(ERR_IM_NOT_REGISTERED, LPGEN("Requested type is not registered")); + + /* 8.3.1.5 Resolve error codes */ + CASE(ERR_RESOLVE_NOTCOMPLETED, LPGEN("Resolve not completed")); + CASE(ERR_RESOLVE_NAMENOTUNIQUE, LPGEN("Resolve name not unique")); + CASE(ERR_RESOLVE_NAMENOTRESOLVABLE, LPGEN("Resolve name not resolvable")); default: m = err_to_str(code); @@ -93,5 +155,137 @@ char* mwError(guint32 code) { return g_strdup(m); } +char* mwErrorDesc(guint32 code) { + const char *m; + + switch (code) { + + /* 8.3.1.1 General error/success codes */ + CASE(ERR_SUCCESS, LPGEN("Operation succeeded")); + CASE(ERR_FAILURE, LPGEN("Operation failed")); + CASE(ERR_REQUEST_DELAY, LPGEN("Request accepted but will be served later")); + CASE(ERR_REQUEST_INVALID, LPGEN("Request is invalid due to invalid state or parameters ")); + CASE(ERR_NOT_LOGGED_IN, LPGEN("Not logged in to community")); + CASE(ERR_NOT_AUTHORIZED, LPGEN("Unauthorized to perform an action or access a resource")); + CASE(ERR_ABORT, LPGEN("Operation has been aborted")); + CASE(ERR_NO_ELEMENT, LPGEN("The element is non-existent")); + CASE(ERR_NO_USER, LPGEN("The user is non-existent")); + CASE(ERR_BAD_DATA, LPGEN("The data are invalid or corrupted")); + CASE(ERR_NOT_IMPLEMENTED, LPGEN("The requested feature is not implemented")); + CASE(ERR_UNKNOWN_ERROR, LPGEN("Unknown error")); + CASE(ERR_STARVING, LPGEN("Not enough resources to perform the operation")); + CASE(ERR_CHANNEL_NO_SUPPORT, LPGEN("The requested channel is not supported")); + CASE(ERR_CHANNEL_EXISTS, LPGEN("The requested channel already exists")); + CASE(ERR_SERVICE_NO_SUPPORT, LPGEN("The requested service is not supported")); + CASE(ERR_PROTOCOL_NO_SUPPORT, LPGEN("The requested protocol is not supported (1)")); + CASE(ERR_PROTOCOL_NO_SUPPORT2, LPGEN("The requested protocol is not supported (2)")); + CASE(ERR_VERSION_NO_SUPPORT, LPGEN("The version is not supported")); + CASE(ERR_USER_SKETCHY, LPGEN("User is invalid or not trusted")); + CASE(ERR_ALREADY_INITIALIZED, LPGEN("Already initialized")); + CASE(ERR_NOT_OWNER, LPGEN("Not an owner of the requested resource")); + CASE(ERR_TOKEN_INVALID, LPGEN("Invalid token")); + CASE(ERR_TOKEN_EXPIRED, LPGEN("Token has expired")); + CASE(ERR_TOKEN_IP_MISMATCH, LPGEN("Token IP mismatch")); + CASE(ERR_PORT_IN_USE, LPGEN("WK port is in use")); + CASE(ERR_NETWORK_DEAD, LPGEN("Low-level network error occurred")); + CASE(ERR_NO_MASTER_CHANNEL, LPGEN("No master channel exists")); + CASE(ERR_ALREADY_SUBSCRIBED, LPGEN("Already subscribed to object(s) or event(s)")); + CASE(ERR_NOT_SUBSCRIBED, LPGEN("Not subscribed to object(s) or event(s)")); + CASE(ERR_ENCRYPT_NO_SUPPORT, LPGEN("Encryption is not supported or failed unexpectedly")); + CASE(ERR_ENCRYPT_UNINITIALIZED, LPGEN("Encryption mechanism has not been initialized yet")); + CASE(ERR_ENCRYPT_UNACCEPTABLE, LPGEN("The requested encryption level is unacceptably low")); + CASE(ERR_ENCRYPT_INVALID, LPGEN("The encryption data passed are invalid or or corrupted")); + CASE(ERR_NO_COMMON_ENCRYPT, LPGEN("There is no common encryption method")); + CASE(ERR_CHANNEL_DESTROYED, LPGEN("The channel is destroyed after a recommendation is made connect elsewhere")); + CASE(ERR_CHANNEL_REDIRECTED, LPGEN("The channel has been redirected to another destination")); + CASE(ERR_INCORRECT_ENTRY, LPGEN("Incorrect entry for server in cluster document")); + + /* 8.3.1.3 Client error codes */ + CASE(VERSION_MISMATCH, LPGEN("Versions don't match")); + CASE(INSUF_BUFFER, LPGEN("Not enough resources for connection (buffers)")); + CASE(NOT_IN_USE, LPGEN("Not in use")); + CASE(INSUF_SOCKET, LPGEN("Not enough resources for connection (socket id)")); + CASE(HARDWARE_ERROR, LPGEN("Hardware error occurred")); + CASE(NETWORK_DOWN, LPGEN("Network down")); + CASE(HOST_DOWN, LPGEN("Host down")); + CASE(HOST_UNREACHABLE, LPGEN("Host unreachable")); + CASE(TCPIP_ERROR, LPGEN("TCP/IP protocol error")); + CASE(FAT_MESSAGE, LPGEN("The message is too large")); + CASE(PROXY_ERROR, LPGEN("Proxy error")); + CASE(SERVER_FULL, LPGEN("Server is full")); + CASE(SERVER_NORESPOND, LPGEN("Server is not responding")); + CASE(CANT_CONNECT, LPGEN("Cannot connect")); + CASE(USER_REMOVED, LPGEN("User has been removed from the server")); + CASE(PROTOCOL_ERROR, LPGEN("Virtual Places protocol error")); + CASE(USER_RESTRICTED, LPGEN("Cannot connect because user has been restricted")); + CASE(INCORRECT_LOGIN, LPGEN("Incorrect login")); + CASE(ENCRYPT_MISMATCH, LPGEN("Encryption mismatch")); + CASE(USER_UNREGISTERED, LPGEN("User is unregistered")); + CASE(VERIFICATION_DOWN, LPGEN("Verification service down")); + CASE(USER_TOO_IDLE, LPGEN("User has been idle for too long")); + CASE(GUEST_IN_USE, LPGEN("The guest name is currently being used")); + CASE(USER_EXISTS, LPGEN("The user is already signed on")); + CASE(USER_RE_LOGIN, LPGEN("The user has signed on again")); + CASE(BAD_NAME, LPGEN("The name cannot be used")); + CASE(REG_MODE_NS, LPGEN("The registration mode is not supported")); + CASE(WRONG_USER_PRIV, LPGEN("User does not have appropriate privilege level")); + CASE(NEED_EMAIL, LPGEN("Email address must be used")); + CASE(DNS_ERROR, LPGEN("Error in DNS")); + CASE(DNS_FATAL_ERROR, LPGEN("Fatal error in DNS")); + CASE(DNS_NOT_FOUND, LPGEN("Server name not found")); + CASE(CONNECTION_BROKEN, LPGEN("The connection has been broken")); + CASE(CONNECTION_ABORTED, LPGEN("An established connection was aborted by the software in the host machine")); + CASE(CONNECTION_REFUSED, LPGEN("The connection has been refused")); + CASE(CONNECTION_RESET, LPGEN("The connection has been reset")); + CASE(CONNECTION_TIMED, LPGEN("The connection has timed out")); + CASE(CONNECTION_CLOSED, LPGEN("The connection has been closed")); + CASE(MULTI_SERVER_LOGIN, LPGEN("Disconnected due to login in two Sametime servers concurrently (1)")); + CASE(MULTI_SERVER_LOGIN2, LPGEN("Disconnected due to login in two Sametime servers concurrently (2)")); + CASE(MULTI_LOGIN_COMP, LPGEN("Disconnected due to login from another computer.")); + CASE(MUTLI_LOGIN_ALREADY, LPGEN("Unable to log in because you are already logged on from another computer")); + CASE(SERVER_BROKEN, LPGEN("Unable to log in because the server is eother unreachable, or not configured properly.")); + CASE(SERVER_PATH_OLD, LPGEN("Unable to log in to home Sametime server through the requested server, since your home server needs to be upgraded.")); + CASE(APPLET_LOGOUT, LPGEN("The applet was logged out with this reason. Perform relogin and you will return to the former state.")); + + /* 8.3.1.3 Client error codes */ + CASE(ERR_CLIENT_USER_GONE, LPGEN("The user is not online")); + CASE(ERR_CLIENT_USER_DND, LPGEN("The user is in do not disturb mode")); + CASE(ERR_CLIENT_USER_ELSEWHERE, LPGEN("Can not login because already logged in with a different user name (Java only)")); + + /* 8.3.1.4 IM error codes */ + CASE(ERR_IM_COULDNT_REGISTER, LPGEN("Cannot register a reserved type")); + CASE(ERR_IM_ALREADY_REGISTERED, LPGEN("The requested type is already registered")); + CASE(ERR_IM_NOT_REGISTERED, LPGEN("The requested type is not registered")); + + /* 8.3.1.5 Resolve error codes */ + CASE(ERR_RESOLVE_NOTCOMPLETED, LPGEN("The resolve process was not completed, but a partial response is available")); + CASE(ERR_RESOLVE_NAMENOTUNIQUE, LPGEN("The name was found, but is not unique (request was for unique only)")); + CASE(ERR_RESOLVE_NAMENOTRESOLVABLE, LPGEN("The name is not resolvable due to its format, for example an Internet email address")); + + default: + m = LPGEN("Unknown error code"); + break; + } + + return g_strdup(m); +} + +struct mwReturnCodeDesc *mwGetReturnCodeDesc(guint32 code) { + struct mwReturnCodeDesc *rcDesc = g_new(struct mwReturnCodeDesc, 1); + + if (code & ERR_FAILURE) + rcDesc->type = mwReturnCodeError; + else + rcDesc->type = mwReturnCodeInfo; + + rcDesc->codeString = g_strdup(err_to_str(code)); + rcDesc->name = mwError(code); + rcDesc->description = mwErrorDesc(code); + + return rcDesc; +} +/// Miranda NG development end + + #undef CASE diff --git a/protocols/Sametime/src/meanwhile/src/mw_debug.c b/protocols/Sametime/src/meanwhile/src/mw_debug.c index cf47a38e38..d22d2876eb 100644 --- a/protocols/Sametime/src/meanwhile/src/mw_debug.c +++ b/protocols/Sametime/src/meanwhile/src/mw_debug.c @@ -19,7 +19,7 @@ */ -#include <glib/gstring.h> +#include <glib.h> #include "mw_debug.h" diff --git a/protocols/Sametime/src/meanwhile/src/mw_error.h b/protocols/Sametime/src/meanwhile/src/mw_error.h index 6345358561..e53cc0c996 100644 --- a/protocols/Sametime/src/meanwhile/src/mw_error.h +++ b/protocols/Sametime/src/meanwhile/src/mw_error.h @@ -40,6 +40,22 @@ extern "C" { #endif +/// Miranda NG development start +enum mwReturnCodeType { + mwReturnCodeInfo = 0x1000, + mwReturnCodeError = 0x2000 +}; + +struct mwReturnCodeDesc { + guint16 type; /**< @see mwReturnCodeType */ + char *codeString; /**< return code hex as string */ + char *name; /**< return code name */ + char *description; /**< return code description */ +}; + +struct mwReturnCodeDesc *mwGetReturnCodeDesc(guint32 code); +/// Miranda NG development end + /** reference to a new string appropriate for the given error code.*/ char* mwError(guint32 code); @@ -87,7 +103,11 @@ enum ERR_GENERAL { ERR_ENCRYPT_INVALID = 0x80000020, ERR_NO_COMMON_ENCRYPT = 0x80000021, ERR_CHANNEL_DESTROYED = 0x80000022, - ERR_CHANNEL_REDIRECTED = 0x80000023 + /// Miranda NG development start + //ERR_CHANNEL_REDIRECTED = 0x80000023 + ERR_CHANNEL_REDIRECTED = 0x00000023, + ERR_INCORRECT_ENTRY = 0x80000239
+ /// Miranda NG development end }; @@ -166,6 +186,18 @@ enum ERR_IM { }; +/// Miranda NG development start +/* 8.3.1.5 Resolve error codes */ + +/** @enum ERR_RESOLVE +Resolve error codes */ +enum ERR_RESOLVE { + ERR_RESOLVE_NOTCOMPLETED = 0x00010000, + ERR_RESOLVE_NAMENOTUNIQUE = 0x80020000, + ERR_RESOLVE_NAMENOTRESOLVABLE = 0x80030000
+}; +/// Miranda NG development end + #ifdef __cplusplus } #endif diff --git a/protocols/Sametime/src/meanwhile/src/mw_message.h b/protocols/Sametime/src/meanwhile/src/mw_message.h index 8402b8b7ee..a825ec271b 100644 --- a/protocols/Sametime/src/meanwhile/src/mw_message.h +++ b/protocols/Sametime/src/meanwhile/src/mw_message.h @@ -22,7 +22,7 @@ #define _MW_MESSAGE_H -#include <glib/glist.h> +#include <glib.h> #include "mw_common.h" diff --git a/protocols/Sametime/src/meanwhile/src/mw_srvc_conf.h b/protocols/Sametime/src/meanwhile/src/mw_srvc_conf.h index 1447fd3830..ea162e6e73 100644 --- a/protocols/Sametime/src/meanwhile/src/mw_srvc_conf.h +++ b/protocols/Sametime/src/meanwhile/src/mw_srvc_conf.h @@ -22,7 +22,7 @@ #define _MW_SRVC_CONF_H -#include <glib/glist.h> +#include <glib.h> #include "mw_common.h" diff --git a/protocols/Sametime/src/meanwhile/src/mw_srvc_dir.h b/protocols/Sametime/src/meanwhile/src/mw_srvc_dir.h index b9230bbf08..c45e850232 100644 --- a/protocols/Sametime/src/meanwhile/src/mw_srvc_dir.h +++ b/protocols/Sametime/src/meanwhile/src/mw_srvc_dir.h @@ -22,7 +22,6 @@ #include <glib.h> -#include <glib/glist.h> #ifdef __cplusplus diff --git a/protocols/Sametime/src/meanwhile/src/mw_srvc_place.h b/protocols/Sametime/src/meanwhile/src/mw_srvc_place.h index e17aa711c5..bba97b61e9 100644 --- a/protocols/Sametime/src/meanwhile/src/mw_srvc_place.h +++ b/protocols/Sametime/src/meanwhile/src/mw_srvc_place.h @@ -22,7 +22,7 @@ #define _MW_SRVC_PLACE_H -#include <glib/glist.h> +#include <glib.h> #include "mw_common.h" diff --git a/protocols/Sametime/src/meanwhile/src/mw_srvc_resolve.h b/protocols/Sametime/src/meanwhile/src/mw_srvc_resolve.h index 436b20a5d5..5429640a1e 100644 --- a/protocols/Sametime/src/meanwhile/src/mw_srvc_resolve.h +++ b/protocols/Sametime/src/meanwhile/src/mw_srvc_resolve.h @@ -23,7 +23,6 @@ #include <glib.h> -#include <glib/glist.h> #ifdef __cplusplus diff --git a/protocols/Sametime/src/meanwhile/src/mw_st_list.h b/protocols/Sametime/src/meanwhile/src/mw_st_list.h index 39e1cbf84b..d54de15bac 100644 --- a/protocols/Sametime/src/meanwhile/src/mw_st_list.h +++ b/protocols/Sametime/src/meanwhile/src/mw_st_list.h @@ -30,7 +30,6 @@ #include <glib.h> -#include <glib/glist.h> #include "mw_common.h" diff --git a/protocols/Sametime/src/meanwhile/src/mw_util.h b/protocols/Sametime/src/meanwhile/src/mw_util.h index b8e0b7e968..a94b85131f 100644 --- a/protocols/Sametime/src/meanwhile/src/mw_util.h +++ b/protocols/Sametime/src/meanwhile/src/mw_util.h @@ -23,8 +23,6 @@ #include <glib.h> -#include <glib/ghash.h> -#include <glib/glist.h> #define map_guint_new() \ diff --git a/protocols/Sametime/src/meanwhile/src/session.c b/protocols/Sametime/src/meanwhile/src/session.c index 6c116b7a58..d02d3a09bd 100644 --- a/protocols/Sametime/src/meanwhile/src/session.c +++ b/protocols/Sametime/src/meanwhile/src/session.c @@ -450,6 +450,8 @@ static void HANDSHAKE_ACK_recv(struct mwSession *s, property_set(s, mwSession_SERVER_VER_MAJOR, GPOINTER(msg->major), NULL); property_set(s, mwSession_SERVER_VER_MINOR, GPOINTER(msg->minor), NULL); + g_message("Sametime server version (major/minor): 0x%x / 0x%x", msg->major, msg->minor); + /* compose the login message */ log = (struct mwMsgLogin *) mwMessage_new(mwMessage_LOGIN); log->login_type = GUINT(property_get(s, mwSession_CLIENT_TYPE_ID)); diff --git a/protocols/Sametime/src/meanwhile/src/srvc_aware.c b/protocols/Sametime/src/meanwhile/src/srvc_aware.c index 8c11be229f..8c399b9832 100644 --- a/protocols/Sametime/src/meanwhile/src/srvc_aware.c +++ b/protocols/Sametime/src/meanwhile/src/srvc_aware.c @@ -19,8 +19,6 @@ */ #include <glib.h> -#include <glib/ghash.h> -#include <glib/glist.h> #include <string.h> #include "mw_channel.h" diff --git a/protocols/Sametime/src/meanwhile/src/srvc_conf.c b/protocols/Sametime/src/meanwhile/src/srvc_conf.c index f302a706f8..46d12fd849 100644 --- a/protocols/Sametime/src/meanwhile/src/srvc_conf.c +++ b/protocols/Sametime/src/meanwhile/src/srvc_conf.c @@ -19,8 +19,6 @@ */ #include <glib.h> -#include <glib/ghash.h> -#include <glib/glist.h> #include <stdio.h> #include <stdlib.h> diff --git a/protocols/Sametime/src/meanwhile/src/srvc_dir.c b/protocols/Sametime/src/meanwhile/src/srvc_dir.c index 1505f69c53..be944429cf 100644 --- a/protocols/Sametime/src/meanwhile/src/srvc_dir.c +++ b/protocols/Sametime/src/meanwhile/src/srvc_dir.c @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <glib/ghash.h> +#include <glib.h> #include "mw_channel.h" #include "mw_common.h" diff --git a/protocols/Sametime/src/meanwhile/src/srvc_ft.c b/protocols/Sametime/src/meanwhile/src/srvc_ft.c index 38479e3452..df623e5181 100644 --- a/protocols/Sametime/src/meanwhile/src/srvc_ft.c +++ b/protocols/Sametime/src/meanwhile/src/srvc_ft.c @@ -19,7 +19,7 @@ */ -#include <glib/glist.h> +#include <glib.h> #include "mw_channel.h" #include "mw_common.h" diff --git a/protocols/Sametime/src/meanwhile/src/srvc_im.c b/protocols/Sametime/src/meanwhile/src/srvc_im.c index b03991d3b9..c200487812 100644 --- a/protocols/Sametime/src/meanwhile/src/srvc_im.c +++ b/protocols/Sametime/src/meanwhile/src/srvc_im.c @@ -19,7 +19,6 @@ */ #include <glib.h> -#include <glib/glist.h> #include <string.h> #include "mw_channel.h" diff --git a/protocols/Sametime/src/meanwhile/src/srvc_place.c b/protocols/Sametime/src/meanwhile/src/srvc_place.c index 5029dffbb8..d07e886bc9 100644 --- a/protocols/Sametime/src/meanwhile/src/srvc_place.c +++ b/protocols/Sametime/src/meanwhile/src/srvc_place.c @@ -19,8 +19,6 @@ */ #include <glib.h> -#include <glib/ghash.h> -#include <glib/glist.h> #include <stdio.h> #include <stdlib.h> diff --git a/protocols/Sametime/src/meanwhile/src/srvc_resolve.c b/protocols/Sametime/src/meanwhile/src/srvc_resolve.c index bb4c536be8..3a282291cc 100644 --- a/protocols/Sametime/src/meanwhile/src/srvc_resolve.c +++ b/protocols/Sametime/src/meanwhile/src/srvc_resolve.c @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <glib/ghash.h> +#include <glib.h> #include "mw_channel.h" #include "mw_common.h" diff --git a/protocols/Sametime/src/meanwhile/src/srvc_store.c b/protocols/Sametime/src/meanwhile/src/srvc_store.c index f537195e08..edfd0281ef 100644 --- a/protocols/Sametime/src/meanwhile/src/srvc_store.c +++ b/protocols/Sametime/src/meanwhile/src/srvc_store.c @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <glib/glist.h> +#include <glib.h> #include "mw_channel.h" #include "mw_debug.h" diff --git a/protocols/Sametime/src/meanwhile/src/st_list.c b/protocols/Sametime/src/meanwhile/src/st_list.c index 949696a4a1..186d5a39a3 100644 --- a/protocols/Sametime/src/meanwhile/src/st_list.c +++ b/protocols/Sametime/src/meanwhile/src/st_list.c @@ -20,7 +20,7 @@ #include <stdio.h> #include <string.h> -#include <glib/gstring.h> +#include <glib.h> #include "mw_debug.h" #include "mw_util.h" @@ -662,7 +662,9 @@ void mwSametimeList_get(struct mwGetBuffer *b, struct mwSametimeList *l) { g_return_if_fail(b != NULL); mwString_get(b, &str); - list_get(str, l); - g_free(str); + if (str) { + list_get(str, l); + g_free(str); + } } diff --git a/protocols/Sametime/src/messaging.cpp b/protocols/Sametime/src/messaging.cpp index a82a574f82..55f49ea16f 100644 --- a/protocols/Sametime/src/messaging.cpp +++ b/protocols/Sametime/src/messaging.cpp @@ -49,9 +49,7 @@ void mwIm_conversation_closed(mwConversation* conv, guint32 err) proto->debugLog(_T("mwIm_conversation_closed() start err=[%d]"), err);
if (err & ERR_FAILURE && err != CONNECTION_RESET) {
- char* msg = mwError(err);
- proto->showPopup(TranslateTS(_A2T(msg)), SAMETIME_POPUP_ERROR);
- g_free(msg);
+ proto->showPopup(err);
if (err == ERR_NO_COMMON_ENCRYPT && !(proto->options.encrypt_session))
proto->showPopup(TranslateT("No common encryption method. Try to enable encryption in protocol options."), SAMETIME_POPUP_INFO);
}
diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp index fccb78c0e5..0b97f27906 100644 --- a/protocols/Sametime/src/options.cpp +++ b/protocols/Sametime/src/options.cpp @@ -4,18 +4,22 @@ #define DEFAULT_ID (0x1800)
-#define NUM_IDS 20
+#define NUM_IDS 24
TCHAR* client_names[NUM_IDS] = {
_T("Official Binary Library"),
_T("Official Java Applet"),
_T("Official Binary Application"),
_T("Official Java Application"),
- _T("Notes v6.5"),
- _T("Notes v7.0"),
+ _T("Notes 6.5"),
+ _T("Notes 7.0"),
+ _T("Notes 8.0 Basic"),
+ _T("Notes 8.5.2"),
+ _T("Sametime Connect 8.0"),
+ _T("Sametime Connect 8.5.2"),
_T("ICT"),
_T("NotesBuddy"),
- _T("NotesBuddy v4.15"),
+ _T("NotesBuddy 4.15"),
_T("Sanity"),
_T("Perl"),
_T("PMR Alert"),
@@ -35,6 +39,10 @@ int client_ids[NUM_IDS] = { 0x1003,
0x1200,
0x1210,
+ 0x1215,
+ 0x1240,
+ 0x1306,
+ 0x130D,
0x1300,
0x1400,
0x1405,
@@ -51,6 +59,36 @@ int client_ids[NUM_IDS] = { 0xFFFF
};
+
+#define DEFAULT_CV_MAJOR (0x001e)
+#define DEFAULT_CV_MINOR (0x1f4b)
+
+#define NUM_CVS 5
+
+TCHAR* CV_names[NUM_CVS] = {
+ _T("Sametime (Use old client version)"),
+ _T("Sametime (Miranda default)"),
+ _T("Sametime 8"),
+ _T("Sametime 8.5.1"),
+ _T("Sametime 8.5.2")
+};
+int CV_major[NUM_CVS] = {
+ MW_PROTOCOL_VERSION_MAJOR,
+ 0x001e,
+ 0x001e,
+ 0x001e,
+ 0x001e
+};
+int CV_minor[NUM_CVS] = {
+ MW_PROTOCOL_VERSION_MINOR,
+ 0x196f,
+ 0x1f4b,
+ 0x213f,
+ 0x2149
+};
+
+
+
static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
CSametimeProto* proto = (CSametimeProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -84,7 +122,6 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA CheckDlgButton(hwndDlg, IDC_CHK_GETSERVERCONTACTS, proto->options.get_server_contacts ? TRUE : FALSE);
CheckDlgButton(hwndDlg, IDC_CHK_ADDCONTACTS, proto->options.add_contacts ? TRUE : FALSE);
CheckDlgButton(hwndDlg, IDC_CHK_IDLEAWAY, proto->options.idle_as_away ? TRUE : FALSE);
- CheckDlgButton(hwndDlg, IDC_CHK_OLDDEFAULTVER, proto->options.use_old_default_client_ver ? TRUE : FALSE);
SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENT, CB_RESETCONTENT, 0, 0);
int pos = 0;
@@ -109,6 +146,20 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA SetDlgItemInt(hwndDlg, IDC_ED_CLIENTID, proto->options.client_id, FALSE);
}
+
+ SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENTVN, CB_RESETCONTENT, 0, 0);
+ pos = 0;
+
+ for (int i = 0; i < NUM_CVS; i++) {
+ pos = SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENTVN, CB_ADDSTRING, -1, (LPARAM)CV_names[i]);
+ SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENTVN, CB_SETITEMDATA, pos, i);
+ if (CV_major[i] == proto->options.client_versionMajor && CV_minor[i] == proto->options.client_versionMinor) {
+ found = true;
+ SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENTVN, CB_SETCURSEL, pos, 0);
+ }
+ }
+
+
if (!ServiceExists(MS_POPUP_ADDPOPUPT)) {
HWND hw = GetDlgItem(hwndDlg, IDC_RAD_ERRPOP);
EnableWindow(hw, FALSE);
@@ -138,19 +189,30 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
if (HIWORD(wParam) == CBN_SELCHANGE) {
- int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENT, CB_GETCURSEL, 0, 0);
- int id = SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENT, CB_GETITEMDATA, sel, 0);
- bool custom = (id == client_ids[sizeof(client_ids) / sizeof(int)-1]);
+ switch (LOWORD(wParam)) {
+ case IDC_CMB_CLIENT:
+ {
+ int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENT, CB_GETCURSEL, 0, 0);
+ int id = SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENT, CB_GETITEMDATA, sel, 0);
+ bool custom = (id == client_ids[sizeof(client_ids) / sizeof(int)-1]);
- if (!custom)
- SetDlgItemInt(hwndDlg, IDC_ED_CLIENTID, id, FALSE);
- else
- SetDlgItemInt(hwndDlg, IDC_ED_CLIENTID, DEFAULT_ID, FALSE);
+ if (!custom)
+ SetDlgItemInt(hwndDlg, IDC_ED_CLIENTID, id, FALSE);
+ else
+ SetDlgItemInt(hwndDlg, IDC_ED_CLIENTID, DEFAULT_ID, FALSE);
- HWND hw = GetDlgItem(hwndDlg, IDC_ED_CLIENTID);
- EnableWindow(hw, custom);
+ HWND hw = GetDlgItem(hwndDlg, IDC_ED_CLIENTID);
+ EnableWindow(hw, custom);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ return TRUE;
+ }
+ case IDC_CMB_CLIENTVN:
+ {
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ return TRUE;
+ }
+ }
}
if (HIWORD(wParam) == BN_CLICKED) {
@@ -204,7 +266,6 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case IDC_CHK_USERCP:
case IDC_CHK_ADDCONTACTS:
case IDC_CHK_IDLEAWAY:
- case IDC_CHK_OLDDEFAULTVER:
case IDC_RAD_ENC:
case IDC_RAD_NOENC:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -258,6 +319,11 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA }
else proto->options.client_id = id;
+ sel = SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENTVN, CB_GETCURSEL, 0, 0);
+ int CVpos = SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENTVN, CB_GETITEMDATA, sel, 0);
+ proto->options.client_versionMajor = CV_major[CVpos];
+ proto->options.client_versionMinor = CV_minor[CVpos];
+
if (IsDlgButtonChecked(hwndDlg, IDC_RAD_ERRMB)) proto->options.err_method = ED_MB;
else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_ERRBAL)) proto->options.err_method = ED_BAL;
else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_ERRPOP)) proto->options.err_method = ED_POP;
@@ -266,8 +332,6 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA proto->options.encrypt_session = (IsDlgButtonChecked(hwndDlg, IDC_RAD_ENC) != FALSE);
proto->options.idle_as_away = (IsDlgButtonChecked(hwndDlg, IDC_CHK_IDLEAWAY) != FALSE);
- proto->options.use_old_default_client_ver = (IsDlgButtonChecked(hwndDlg, IDC_CHK_OLDDEFAULTVER) != FALSE);
-
proto->SaveOptions();
return TRUE;
@@ -316,7 +380,22 @@ void CSametimeProto::LoadOptions() options.encrypt_session = (db_get_b(0, m_szModuleName, "EncryptSession", 0) == 1);
options.client_id = db_get_dw(0, m_szModuleName, "ClientID", DEFAULT_ID);
- options.use_old_default_client_ver = (db_get_b(0, m_szModuleName, "UseOldClientVer", 0) == 1);
+ options.client_versionMajor = db_get_dw(0, m_szModuleName, "ClientVersionMajor", DEFAULT_CV_MAJOR);
+ DWORD defaultCVMinor;
+ if (db_get_b(0, m_szModuleName, "UseOldClientVer", 0) == 1){
+ // if sb have checked old deprecated option 'Use old client version' respect it
+ defaultCVMinor = 0x001d;
+ } else {
+ defaultCVMinor = DEFAULT_CV_MINOR;
+ }
+ options.client_versionMinor = db_get_dw(0, m_szModuleName, "ClientVersionMinor", defaultCVMinor);
+
+ // one time options conversion
+ if (db_get_b(0, m_szModuleName, "UseOldClientVer", -1) != -1){
+ db_unset(0, m_szModuleName, "UseOldClientVer");
+ db_set_dw(0, m_szModuleName, "ClientVersionMajor", options.client_versionMajor);
+ db_set_dw(0, m_szModuleName, "ClientVersionMinor", options.client_versionMinor);
+ }
options.get_server_contacts = (db_get_b(0, m_szModuleName, "GetServerContacts", 1) == 1);
options.add_contacts = (db_get_b(0, m_szModuleName, "AutoAddContacts", 0) == 1);
@@ -333,7 +412,7 @@ void CSametimeProto::LoadOptions() if (options.err_method == ED_BAL && !ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) options.err_method = ED_MB;
debugLog(_T("LoadOptions() loaded: ServerName:len=[%d], id:len=[%d], pword:len=[%d]"), options.server_name == NULL ? -1 : strlen(options.server_name), options.id == NULL ? -1 : strlen(options.id), options.pword == NULL ? -1 : strlen(options.pword));
- debugLog(_T("LoadOptions() loaded: port=[%d], encrypt_session=[%d], client_id=[%d], use_old_default_client_ver=[%d]"), options.port, options.encrypt_session, options.client_id, options.use_old_default_client_ver);
+ debugLog(_T("LoadOptions() loaded: port=[%d], encrypt_session=[%d], ClientID=[%d], ClientVersionMajor=[%d], ClientVersionMinor=[%d]"), options.port, options.encrypt_session, options.client_id, options.client_versionMajor, options.client_versionMinor);
debugLog(_T("LoadOptions() loaded: get_server_contacts=[%d], add_contacts=[%d], idle_as_away=[%d], err_method=[%d]"), options.get_server_contacts, options.add_contacts, options.idle_as_away, options.err_method);
}
@@ -349,11 +428,11 @@ void CSametimeProto::SaveOptions() db_set_dw(0, m_szModuleName, "ServerPort", options.port);
db_set_b(0, m_szModuleName, "GetServerContacts", options.get_server_contacts ? 1 : 0);
db_set_dw(0, m_szModuleName, "ClientID", options.client_id);
+ db_set_dw(0, m_szModuleName, "ClientVersionMajor", options.client_versionMajor);
+ db_set_dw(0, m_szModuleName, "ClientVersionMinor", options.client_versionMinor);
db_set_b(0, m_szModuleName, "ErrorDisplay", options.err_method);
db_set_b(0, m_szModuleName, "AutoAddContacts", options.add_contacts ? 1 : 0);
db_set_b(0, m_szModuleName, "EncryptSession", options.encrypt_session ? 1 : 0);
db_set_b(0, m_szModuleName, "IdleAsAway", options.idle_as_away ? 1 : 0);
-
- db_set_b(0, m_szModuleName, "UseOldClientVer", options.use_old_default_client_ver ? 1 : 0);
}
diff --git a/protocols/Sametime/src/resource.h b/protocols/Sametime/src/resource.h index 3ca8cba566..761b400d0d 100644 --- a/protocols/Sametime/src/resource.h +++ b/protocols/Sametime/src/resource.h @@ -24,12 +24,12 @@ #define IDC_CHK_ADDCONTACTS 1008
#define IDC_CHK_IDLEAWAY 1009
#define IDC_CMB_CLIENT 1010
+#define IDC_CMB_CLIENTVN 1016
#define IDC_ED_CLIENTID 1011
#define IDC_RAD_ERRMB 1012
#define IDC_RAD_ERRPOP 1013
#define IDC_RAD_ERRBAL 1014
#define IDC_RAD_ANSI 1015
-#define IDC_CHK_OLDDEFAULTVER 1016
#define IDC_RAD_UTF8 1017
#define IDC_CHK_USERCP 1018
#define IDC_RAD_OEM 1019
diff --git a/protocols/Sametime/src/sametime.h b/protocols/Sametime/src/sametime.h index 7554a5d78d..d1a6f96a1a 100644 --- a/protocols/Sametime/src/sametime.h +++ b/protocols/Sametime/src/sametime.h @@ -62,11 +62,12 @@ typedef struct Options_tag { int port;
bool get_server_contacts;
int client_id;
+ int client_versionMajor;
+ int client_versionMinor;
ErrorDisplay err_method;
bool add_contacts;
bool encrypt_session;
bool idle_as_away;
- bool use_old_default_client_ver;
} SametimeOptions;
typedef struct {
diff --git a/protocols/Sametime/src/sametime_proto.h b/protocols/Sametime/src/sametime_proto.h index fd4e3a43c8..67c036fbf1 100644 --- a/protocols/Sametime/src/sametime_proto.h +++ b/protocols/Sametime/src/sametime_proto.h @@ -149,6 +149,7 @@ struct CSametimeProto : public PROTO<CSametimeProto> // utils.cpp
void showPopup(const TCHAR* msg, SametimePopupEnum flag);
+ void showPopup(guint32 code);
void RegisterPopups();
void UnregisterPopups();
void RegisterGLibLogger();
diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp index 5abc64a675..64b5894f28 100644 --- a/protocols/Sametime/src/sametime_session.cpp +++ b/protocols/Sametime/src/sametime_session.cpp @@ -69,14 +69,9 @@ void CSametimeProto::InitMeanwhileServices() mwSession_setProperty(session, mwSession_AUTH_PASSWORD, options.pword, NULL);
mwSession_setProperty(session, mwSession_CLIENT_TYPE_ID, (void*)options.client_id, NULL);
- if (options.use_old_default_client_ver) {
- mwSession_setProperty(session, mwSession_CLIENT_VER_MAJOR, GUINT_TO_POINTER(db_get_w(0, m_szModuleName, "ClientVersionMajor", MW_PROTOCOL_VERSION_MAJOR)), 0);
- mwSession_setProperty(session, mwSession_CLIENT_VER_MINOR, GUINT_TO_POINTER(db_get_w(0, m_szModuleName, "ClientVersionMinor", MW_PROTOCOL_VERSION_MINOR)), 0);
- }
- else {
- mwSession_setProperty(session, mwSession_CLIENT_VER_MAJOR, GUINT_TO_POINTER(db_get_w(0, m_szModuleName, "ClientVersionMajor", 0x001e)), 0);
- mwSession_setProperty(session, mwSession_CLIENT_VER_MINOR, GUINT_TO_POINTER(db_get_w(0, m_szModuleName, "ClientVersionMinor", 0x196f)), 0);
- }
+ mwSession_setProperty(session, mwSession_CLIENT_VER_MAJOR, (void*)options.client_versionMajor, NULL);
+ mwSession_setProperty(session, mwSession_CLIENT_VER_MINOR, (void*)options.client_versionMinor, NULL);
+
}
void CSametimeProto::DeinitMeanwhileServices()
@@ -111,11 +106,7 @@ void __cdecl SessionStateChange(mwSession* session, mwSessionState state, gpoint case mwSession_STOPPING:
if ((int)info) {// & ERR_FAILURE) {
- char *msg = mwError((int)info);
- TCHAR *msgT = mir_utf8decodeT(msg);
- proto->showPopup(TranslateTS(msgT), SAMETIME_POPUP_ERROR);
- mir_free(msgT);
- g_free(msg);
+ proto->showPopup((int)info);
}
proto->SessionStopping();
break;
diff --git a/protocols/Sametime/src/utils.cpp b/protocols/Sametime/src/utils.cpp index 6c8964e8a0..eeccb5a661 100644 --- a/protocols/Sametime/src/utils.cpp +++ b/protocols/Sametime/src/utils.cpp @@ -138,6 +138,22 @@ void CSametimeProto::showPopup(const TCHAR* msg, SametimePopupEnum flag) CallFunctionAsync(sttMainThreadCallback, puData);
}
+void CSametimeProto::showPopup(guint32 code)
+{
+ struct mwReturnCodeDesc *rcDesc = mwGetReturnCodeDesc(code);
+
+ SametimePopupEnum flag = (rcDesc->type == mwReturnCodeError ? SAMETIME_POPUP_ERROR : SAMETIME_POPUP_INFO);
+ TCHAR buff[512];
+ mir_sntprintf(buff, SIZEOF(buff), TranslateT("%s\n\nSametime error %S\n%s"), TranslateTS(_A2T(rcDesc->name)), rcDesc->codeString, TranslateTS(_A2T(rcDesc->description)));
+
+ showPopup(buff, flag);
+ debugLog(buff);
+
+ g_free(rcDesc->codeString); + g_free(rcDesc->name); + g_free(rcDesc->description);
+ g_free(rcDesc);
+}
void LogFromGLib(const gchar* log_domain, GLogLevelFlags log_level, const gchar* message, gpointer user_data)
{
|