diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-14 12:33:04 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-14 12:33:04 +0000 |
commit | de9201059a192b8195d7384b1461a751f0040c46 (patch) | |
tree | 091584e36373d438103772cdd05ebd57c372a464 /protocols | |
parent | efc262a863b12a8b0b12f2e356654f11010504f8 (diff) |
fixes #11 (Own jabber capabilities should be reported objectively)
git-svn-id: http://svn.miranda-ng.org/main/trunk@7640 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/JabberG/src/jabber_caps.cpp | 129 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_caps.h | 24 |
2 files changed, 85 insertions, 68 deletions
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index 465a8b6483..d4e06cff0a 100644 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -29,69 +29,70 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "version.h"
const JabberFeatCapPair g_JabberFeatCapPairs[] = {
- { JABBER_FEAT_DISCO_INFO, JABBER_CAPS_DISCO_INFO, LPGENT("Supports Service Discovery info") },
- { JABBER_FEAT_DISCO_ITEMS, JABBER_CAPS_DISCO_ITEMS, LPGENT("Supports Service Discovery items list") },
- { JABBER_FEAT_ENTITY_CAPS, JABBER_CAPS_ENTITY_CAPS, LPGENT("Can inform about its Jabber capabilities") },
- { JABBER_FEAT_SI, JABBER_CAPS_SI, LPGENT("Supports stream initiation (for filetransfers for ex.)") },
- { JABBER_FEAT_SI_FT, JABBER_CAPS_SI_FT, LPGENT("Supports stream initiation for file transfers") },
- { JABBER_FEAT_BYTESTREAMS, JABBER_CAPS_BYTESTREAMS, LPGENT("Supports file transfers via SOCKS5 Bytestreams") },
- { JABBER_FEAT_IBB, JABBER_CAPS_IBB, LPGENT("Supports file transfers via In-Band Bytestreams") },
- { JABBER_FEAT_OOB, JABBER_CAPS_OOB, LPGENT("Supports file transfers via Out-of-Band Bytestreams") },
- { JABBER_FEAT_OOB2, JABBER_CAPS_OOB, LPGENT("Supports file transfers via Out-of-Band Bytestreams") },
- { JABBER_FEAT_COMMANDS, JABBER_CAPS_COMMANDS, LPGENT("Supports execution of Ad-Hoc commands") },
- { JABBER_FEAT_REGISTER, JABBER_CAPS_REGISTER, LPGENT("Supports in-band registration") },
- { JABBER_FEAT_MUC, JABBER_CAPS_MUC, LPGENT("Supports multi-user chat") },
- { JABBER_FEAT_CHATSTATES, JABBER_CAPS_CHATSTATES, LPGENT("Can report chat state in a chat session") },
- { JABBER_FEAT_LAST_ACTIVITY, JABBER_CAPS_LAST_ACTIVITY, LPGENT("Can report information about the last activity of the user") },
- { JABBER_FEAT_VERSION, JABBER_CAPS_VERSION, LPGENT("Can report own version information") },
- { JABBER_FEAT_ENTITY_TIME, JABBER_CAPS_ENTITY_TIME, LPGENT("Can report local time of the user") },
- { JABBER_FEAT_PING, JABBER_CAPS_PING, LPGENT("Can send and receive ping requests") },
- { JABBER_FEAT_DATA_FORMS, JABBER_CAPS_DATA_FORMS, LPGENT("Supports data forms") },
- { JABBER_FEAT_MESSAGE_EVENTS, JABBER_CAPS_MESSAGE_EVENTS, LPGENT("Can request and respond to events relating to the delivery, display, and composition of messages") },
- { JABBER_FEAT_VCARD_TEMP, JABBER_CAPS_VCARD_TEMP, LPGENT("Supports vCard") },
- { JABBER_FEAT_AVATAR, JABBER_CAPS_AVATAR, LPGENT("Supports iq-based avatars") },
- { JABBER_FEAT_XHTML, JABBER_CAPS_XHTML, LPGENT("Supports XHTML formatting of chat messages") },
- { JABBER_FEAT_AGENTS, JABBER_CAPS_AGENTS, LPGENT("Supports Jabber Browsing") },
- { JABBER_FEAT_BROWSE, JABBER_CAPS_BROWSE, LPGENT("Supports Jabber Browsing") },
- { JABBER_FEAT_FEATURE_NEG, JABBER_CAPS_FEATURE_NEG, LPGENT("Can negotiate options for specific features") },
- { JABBER_FEAT_AMP, JABBER_CAPS_AMP, LPGENT("Can request advanced processing of message stanzas") },
- { JABBER_FEAT_USER_MOOD, JABBER_CAPS_USER_MOOD, LPGENT("Can report information about user moods") },
- { JABBER_FEAT_USER_MOOD_NOTIFY, JABBER_CAPS_USER_MOOD_NOTIFY, LPGENT("Receives information about user moods") },
- { JABBER_FEAT_PUBSUB, JABBER_CAPS_PUBSUB, LPGENT("Supports generic publish-subscribe functionality") },
- { JABBER_FEAT_SECUREIM, JABBER_CAPS_SECUREIM, LPGENT("Supports SecureIM plugin for Miranda NG") },
- { JABBER_FEAT_MIROTR, JABBER_CAPS_MIROTR, LPGENT("Supports OTR (Off-the-Record Messaging)") },
- { JABBER_FEAT_NEWGPG, JABBER_CAPS_NEWGPG, LPGENT("Supports New_GPG plugin for Miranda NG") },
- { JABBER_FEAT_PRIVACY_LISTS, JABBER_CAPS_PRIVACY_LISTS, LPGENT("Can block communications from particular other users using Privacy lists") },
- { JABBER_FEAT_MESSAGE_RECEIPTS, JABBER_CAPS_MESSAGE_RECEIPTS, LPGENT("Supports Message Receipts") },
- { JABBER_FEAT_USER_TUNE, JABBER_CAPS_USER_TUNE, LPGENT("Can report information about the music to which a user is listening") },
- { JABBER_FEAT_USER_TUNE_NOTIFY, JABBER_CAPS_USER_TUNE_NOTIFY, LPGENT("Receives information about the music to which a user is listening") },
- { JABBER_FEAT_PRIVATE_STORAGE, JABBER_CAPS_PRIVATE_STORAGE, LPGENT("Supports private XML Storage (for bookmakrs and other)") },
- { JABBER_FEAT_ATTENTION, JABBER_CAPS_ATTENTION, LPGENT("Supports attention requests ('nudge')") },
- { JABBER_FEAT_ATTENTION_0, JABBER_CAPS_ATTENTION_0, LPGENT("Supports attention requests ('nudge')") },
- { JABBER_FEAT_ARCHIVE_AUTO, JABBER_CAPS_ARCHIVE_AUTO, LPGENT("Supports chat history retrieving") },
- { JABBER_FEAT_ARCHIVE_MANAGE, JABBER_CAPS_ARCHIVE_MANAGE, LPGENT("Supports chat history management") },
- { JABBER_FEAT_USER_ACTIVITY, JABBER_CAPS_USER_ACTIVITY, LPGENT("Can report information about user activity") },
- { JABBER_FEAT_USER_ACTIVITY_NOTIFY, JABBER_CAPS_USER_ACTIVITY_NOTIFY, LPGENT("Receives information about user activity") },
- { JABBER_FEAT_MIRANDA_NOTES, JABBER_CAPS_MIRANDA_NOTES, LPGENT("Supports Miranda NG notes extension") },
- { JABBER_FEAT_JINGLE, JABBER_CAPS_JINGLE, LPGENT("Supports Jingle") },
- { JABBER_FEAT_ROSTER_EXCHANGE, JABBER_CAPS_ROSTER_EXCHANGE, LPGENT("Supports Roster Exchange") },
- { JABBER_FEAT_DIRECT_MUC_INVITE, JABBER_CAPS_DIRECT_MUC_INVITE, LPGENT("Supports direct chat invitations (XEP-0249)") },
- { NULL, 0, NULL }
+ { JABBER_FEAT_DISCO_INFO, JABBER_CAPS_DISCO_INFO, LPGENT("Supports Service Discovery info") },
+ { JABBER_FEAT_DISCO_ITEMS, JABBER_CAPS_DISCO_ITEMS, LPGENT("Supports Service Discovery items list") },
+ { JABBER_FEAT_ENTITY_CAPS, JABBER_CAPS_ENTITY_CAPS, LPGENT("Can inform about its Jabber capabilities") },
+ { JABBER_FEAT_SI, JABBER_CAPS_SI, LPGENT("Supports stream initiation (for filetransfers for ex.)") },
+ { JABBER_FEAT_SI_FT, JABBER_CAPS_SI_FT, LPGENT("Supports stream initiation for file transfers") },
+ { JABBER_FEAT_BYTESTREAMS, JABBER_CAPS_BYTESTREAMS, LPGENT("Supports file transfers via SOCKS5 Bytestreams") },
+ { JABBER_FEAT_IBB, JABBER_CAPS_IBB, LPGENT("Supports file transfers via In-Band Bytestreams") },
+ { JABBER_FEAT_OOB, JABBER_CAPS_OOB, LPGENT("Supports file transfers via Out-of-Band Bytestreams") },
+ { JABBER_FEAT_OOB2, JABBER_CAPS_OOB, LPGENT("Supports file transfers via Out-of-Band Bytestreams") },
+ { JABBER_FEAT_COMMANDS, JABBER_CAPS_COMMANDS, LPGENT("Supports execution of Ad-Hoc commands") },
+ { JABBER_FEAT_REGISTER, JABBER_CAPS_REGISTER, LPGENT("Supports in-band registration") },
+ { JABBER_FEAT_MUC, JABBER_CAPS_MUC, LPGENT("Supports multi-user chat") },
+ { JABBER_FEAT_CHATSTATES, JABBER_CAPS_CHATSTATES, LPGENT("Can report chat state in a chat session") },
+ { JABBER_FEAT_LAST_ACTIVITY, JABBER_CAPS_LAST_ACTIVITY, LPGENT("Can report information about the last activity of the user") },
+ { JABBER_FEAT_VERSION, JABBER_CAPS_VERSION, LPGENT("Can report own version information") },
+ { JABBER_FEAT_ENTITY_TIME, JABBER_CAPS_ENTITY_TIME, LPGENT("Can report local time of the user") },
+ { JABBER_FEAT_PING, JABBER_CAPS_PING, LPGENT("Can send and receive ping requests") },
+ { JABBER_FEAT_DATA_FORMS, JABBER_CAPS_DATA_FORMS, LPGENT("Supports data forms") },
+ { JABBER_FEAT_MESSAGE_EVENTS, JABBER_CAPS_MESSAGE_EVENTS, LPGENT("Can request and respond to events relating to the delivery, display, and composition of messages") },
+ { JABBER_FEAT_VCARD_TEMP, JABBER_CAPS_VCARD_TEMP, LPGENT("Supports vCard") },
+ { JABBER_FEAT_AVATAR, JABBER_CAPS_AVATAR, LPGENT("Supports iq-based avatars") },
+ { JABBER_FEAT_XHTML, JABBER_CAPS_XHTML, LPGENT("Supports XHTML formatting of chat messages") },
+ { JABBER_FEAT_AGENTS, JABBER_CAPS_AGENTS, LPGENT("Supports Jabber Browsing") },
+ { JABBER_FEAT_BROWSE, JABBER_CAPS_BROWSE, LPGENT("Supports Jabber Browsing") },
+ { JABBER_FEAT_FEATURE_NEG, JABBER_CAPS_FEATURE_NEG, LPGENT("Can negotiate options for specific features") },
+ { JABBER_FEAT_AMP, JABBER_CAPS_AMP, LPGENT("Can request advanced processing of message stanzas") },
+ { JABBER_FEAT_USER_MOOD, JABBER_CAPS_USER_MOOD, LPGENT("Can report information about user moods") },
+ { JABBER_FEAT_USER_MOOD_NOTIFY, JABBER_CAPS_USER_MOOD_NOTIFY, LPGENT("Receives information about user moods") },
+ { JABBER_FEAT_PUBSUB, JABBER_CAPS_PUBSUB, LPGENT("Supports generic publish-subscribe functionality") },
+ { JABBER_FEAT_SECUREIM, JABBER_CAPS_SECUREIM, LPGENT("Supports SecureIM plugin for Miranda NG") },
+ { JABBER_FEAT_MIROTR, JABBER_CAPS_MIROTR, LPGENT("Supports OTR (Off-the-Record Messaging)") },
+ { JABBER_FEAT_NEWGPG, JABBER_CAPS_NEWGPG, LPGENT("Supports New_GPG plugin for Miranda NG") },
+ { JABBER_FEAT_PRIVACY_LISTS, JABBER_CAPS_PRIVACY_LISTS, LPGENT("Can block communications from particular other users using Privacy lists") },
+ { JABBER_FEAT_MESSAGE_RECEIPTS, JABBER_CAPS_MESSAGE_RECEIPTS, LPGENT("Supports Message Receipts") },
+ { JABBER_FEAT_USER_TUNE, JABBER_CAPS_USER_TUNE, LPGENT("Can report information about the music to which a user is listening") },
+ { JABBER_FEAT_USER_TUNE_NOTIFY, JABBER_CAPS_USER_TUNE_NOTIFY, LPGENT("Receives information about the music to which a user is listening") },
+ { JABBER_FEAT_PRIVATE_STORAGE, JABBER_CAPS_PRIVATE_STORAGE, LPGENT("Supports private XML Storage (for bookmakrs and other)") },
+ { JABBER_FEAT_ATTENTION, JABBER_CAPS_ATTENTION, LPGENT("Supports attention requests ('nudge')") },
+ { JABBER_FEAT_ATTENTION_0, JABBER_CAPS_ATTENTION_0, LPGENT("Supports attention requests ('nudge')") },
+ { JABBER_FEAT_ARCHIVE_AUTO, JABBER_CAPS_ARCHIVE_AUTO, LPGENT("Supports chat history retrieving") },
+ { JABBER_FEAT_ARCHIVE_MANAGE, JABBER_CAPS_ARCHIVE_MANAGE, LPGENT("Supports chat history management") },
+ { JABBER_FEAT_USER_ACTIVITY, JABBER_CAPS_USER_ACTIVITY, LPGENT("Can report information about user activity") },
+ { JABBER_FEAT_USER_ACTIVITY_NOTIFY, JABBER_CAPS_USER_ACTIVITY_NOTIFY, LPGENT("Receives information about user activity") },
+ { JABBER_FEAT_MIRANDA_NOTES, JABBER_CAPS_MIRANDA_NOTES, LPGENT("Supports Miranda NG notes extension") },
+ { JABBER_FEAT_JINGLE, JABBER_CAPS_JINGLE, LPGENT("Supports Jingle") },
+ { JABBER_FEAT_ROSTER_EXCHANGE, JABBER_CAPS_ROSTER_EXCHANGE, LPGENT("Supports Roster Exchange") },
+ { JABBER_FEAT_DIRECT_MUC_INVITE, JABBER_CAPS_DIRECT_MUC_INVITE, LPGENT("Supports direct chat invitations (XEP-0249)") },
+ { NULL }
};
-const JabberFeatCapPair g_JabberFeatCapPairsExt[] = {
- { _T(JABBER_EXT_SECUREIM), JABBER_CAPS_SECUREIM },
- { _T(JABBER_EXT_MIROTR), JABBER_CAPS_MIROTR },
- { _T(JABBER_EXT_NEWGPG), JABBER_CAPS_NEWGPG },
- { _T(JABBER_EXT_COMMANDS), JABBER_CAPS_COMMANDS },
- { _T(JABBER_EXT_USER_MOOD), JABBER_CAPS_USER_MOOD_NOTIFY },
- { _T(JABBER_EXT_USER_TUNE), JABBER_CAPS_USER_TUNE_NOTIFY },
- { _T(JABBER_EXT_USER_ACTIVITY), JABBER_CAPS_USER_ACTIVITY_NOTIFY },
- { _T(JABBER_EXT_MIR_NOTES), JABBER_CAPS_MIRANDA_NOTES, },
- { szCoreVersion, JABBER_CAPS_MIRANDA_PARTIAL },
- { _T(JABBER_EXT_PLATFORMX86), JABBER_CAPS_PLATFORMX86 },
- { _T(JABBER_EXT_PLATFORMX64), JABBER_CAPS_PLATFORMX64 },
- { NULL, 0 }
+const JabberFeatCapPairExt g_JabberFeatCapPairsExt[] = {
+ { _T(JABBER_EXT_SECUREIM), JABBER_CAPS_SECUREIM, "SecureIM/IsContactSecured" },
+ { _T(JABBER_EXT_MIROTR), JABBER_CAPS_MIROTR, "MirOTRMenuCheckService" },
+ { _T(JABBER_EXT_NEWGPG), JABBER_CAPS_NEWGPG, "/ExportGPGKeys" },
+ { _T(JABBER_EXT_JINGLE), JABBER_CAPS_JINGLE, "Jingle/StartSession" },
+ { _T(JABBER_EXT_COMMANDS), JABBER_CAPS_COMMANDS },
+ { _T(JABBER_EXT_USER_ACTIVITY), JABBER_CAPS_USER_ACTIVITY_NOTIFY },
+ { _T(JABBER_EXT_USER_MOOD), JABBER_CAPS_USER_MOOD_NOTIFY },
+ { _T(JABBER_EXT_USER_TUNE), JABBER_CAPS_USER_TUNE_NOTIFY, "ListeningTo/Enabled" },
+ { _T(JABBER_EXT_MIR_NOTES), JABBER_CAPS_MIRANDA_NOTES },
+ { szCoreVersion, JABBER_CAPS_MIRANDA_PARTIAL },
+ { _T(JABBER_EXT_PLATFORMX86), JABBER_CAPS_PLATFORMX86 },
+ { _T(JABBER_EXT_PLATFORMX64), JABBER_CAPS_PLATFORMX64 },
+ { NULL }
};
void CJabberProto::OnIqResultCapsDiscoInfoSI(HXML, CJabberIqInfo *pInfo)
@@ -548,7 +549,8 @@ void CJabberClientCapsManager::AddDefaultCaps() SetClientCaps(JABBER_CAPS_MIRANDA_NODE, szCoreVersion, JABBER_CAPS_MIRANDA_ALL);
for (int i=0; g_JabberFeatCapPairsExt[i].szFeature; i++)
- SetClientCaps(JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature, g_JabberFeatCapPairsExt[i].jcbCap);
+ if (g_JabberFeatCapPairsExt[i].Valid())
+ SetClientCaps(JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature, g_JabberFeatCapPairsExt[i].jcbCap);
}
JabberCapsBits CJabberClientCapsManager::GetClientCaps(TCHAR *szNode, TCHAR *szVer)
@@ -613,6 +615,9 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con if (szNode) {
for (i=0; g_JabberFeatCapPairsExt[i].szFeature; i++) {
+ if (!g_JabberFeatCapPairsExt[i].Valid())
+ continue;
+
TCHAR szExtCap[ 512 ];
mir_sntprintf(szExtCap, SIZEOF(szExtCap), _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature);
if (!_tcscmp(szNode, szExtCap)) {
diff --git a/protocols/JabberG/src/jabber_caps.h b/protocols/JabberG/src/jabber_caps.h index bd304e1afa..83c18a420d 100644 --- a/protocols/JabberG/src/jabber_caps.h +++ b/protocols/JabberG/src/jabber_caps.h @@ -161,14 +161,15 @@ typedef unsigned __int64 JabberCapsBits; JABBER_CAPS_BYTESTREAMS | JABBER_CAPS_IBB | JABBER_CAPS_OOB | JABBER_CAPS_CHATSTATES | JABBER_CAPS_AGENTS | JABBER_CAPS_BROWSE | \
JABBER_CAPS_VERSION | JABBER_CAPS_LAST_ACTIVITY | JABBER_CAPS_DATA_FORMS | JABBER_CAPS_MESSAGE_EVENTS | JABBER_CAPS_VCARD_TEMP | \
JABBER_CAPS_ENTITY_TIME | JABBER_CAPS_PING | JABBER_CAPS_PRIVACY_LISTS | JABBER_CAPS_MESSAGE_RECEIPTS | JABBER_CAPS_PRIVATE_STORAGE | \
- JABBER_CAPS_ATTENTION_0 | JABBER_CAPS_JINGLE | JABBER_CAPS_ROSTER_EXCHANGE | JABBER_CAPS_DIRECT_MUC_INVITE)
+ JABBER_CAPS_ATTENTION_0 | JABBER_CAPS_ROSTER_EXCHANGE | JABBER_CAPS_DIRECT_MUC_INVITE)
-#define JABBER_CAPS_MIRANDA_ALL (JABBER_CAPS_MIRANDA_PARTIAL | JABBER_CAPS_SECUREIM | JABBER_CAPS_MIROTR | JABBER_CAPS_NEWGPG | JABBER_CAPS_COMMANDS | \
+#define JABBER_CAPS_MIRANDA_ALL (JABBER_CAPS_MIRANDA_PARTIAL | JABBER_CAPS_COMMANDS | \
JABBER_CAPS_USER_MOOD_NOTIFY | JABBER_CAPS_USER_TUNE_NOTIFY | JABBER_CAPS_USER_ACTIVITY_NOTIFY | JABBER_CAPS_PLATFORMX86 | JABBER_CAPS_PLATFORMX64)
#define JABBER_EXT_SECUREIM "secureim"
#define JABBER_EXT_MIROTR "mirotr"
+#define JABBER_EXT_JINGLE "jingle"
#define JABBER_EXT_NEWGPG "new_gpg"
#define JABBER_EXT_COMMANDS "cmds"
#define JABBER_EXT_USER_MOOD "mood"
@@ -296,9 +297,20 @@ public: struct JabberFeatCapPair
{
- const TCHAR *szFeature;
+ LPCTSTR szFeature;
JabberCapsBits jcbCap;
- const TCHAR *tszDescription;
+ LPCTSTR tszDescription;
+};
+
+struct JabberFeatCapPairExt
+{
+ LPCTSTR szFeature;
+ JabberCapsBits jcbCap;
+ LPCSTR szService;
+
+ int Valid() const
+ { return (szService == NULL) ? true : ServiceExists(szService);
+ }
};
struct JabberFeatCapPairDynamic
@@ -309,7 +321,7 @@ struct JabberFeatCapPairDynamic TCHAR *szDescription;
};
-extern const JabberFeatCapPair g_JabberFeatCapPairs[];
-extern const JabberFeatCapPair g_JabberFeatCapPairsExt[];
+extern const JabberFeatCapPair g_JabberFeatCapPairs[];
+extern const JabberFeatCapPairExt g_JabberFeatCapPairsExt[];
#endif
|