From 42680921c5539ed332e3b0191428227ebeb7110e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 14 Jan 2014 12:57:35 +0000 Subject: - added missing ext cap for Nudge; - fixed XEP-0224 support git-svn-id: http://svn.miranda-ng.org/main/trunk@7641 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber_caps.cpp | 3 ++- protocols/JabberG/src/jabber_caps.h | 22 +++++++++++----------- protocols/JabberG/src/jabber_events.cpp | 28 ++++++++++++++-------------- protocols/JabberG/src/jabber_svc.cpp | 3 +-- protocols/JabberG/src/jabber_thread.cpp | 3 +-- 5 files changed, 29 insertions(+), 30 deletions(-) (limited to 'protocols') diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index d4e06cff0a..ee9ec4a01e 100644 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -67,7 +67,6 @@ const JabberFeatCapPair g_JabberFeatCapPairs[] = { { 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") }, @@ -83,11 +82,13 @@ 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_NUDGE), JABBER_CAPS_ATTENTION, "NUDGE/Send" }, { _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_USER_TUNE), JABBER_CAPS_USER_TUNE_NOTIFY, "WATrack/GetFileInfo" }, { _T(JABBER_EXT_MIR_NOTES), JABBER_CAPS_MIRANDA_NOTES }, { szCoreVersion, JABBER_CAPS_MIRANDA_PARTIAL }, { _T(JABBER_EXT_PLATFORMX86), JABBER_CAPS_PLATFORMX86 }, diff --git a/protocols/JabberG/src/jabber_caps.h b/protocols/JabberG/src/jabber_caps.h index 83c18a420d..b2d6e315db 100644 --- a/protocols/JabberG/src/jabber_caps.h +++ b/protocols/JabberG/src/jabber_caps.h @@ -131,24 +131,23 @@ typedef unsigned __int64 JabberCapsBits; #define JABBER_FEAT_CAPTCHA _T("urn:xmpp:captcha") +#define JABBER_FEAT_ATTENTION _T("urn:xmpp:attention:0") +#define JABBER_CAPS_ATTENTION ((JabberCapsBits)1<<36) + // deferred -#define JABBER_FEAT_ATTENTION _T("http://www.xmpp.org/extensions/xep-0224.html#ns") -#define JABBER_CAPS_ATTENTION ((JabberCapsBits)1<<34) #define JABBER_FEAT_USER_ACTIVITY _T("http://jabber.org/protocol/activity") -#define JABBER_CAPS_USER_ACTIVITY ((JabberCapsBits)1<<35) +#define JABBER_CAPS_USER_ACTIVITY ((JabberCapsBits)1<<37) #define JABBER_FEAT_USER_ACTIVITY_NOTIFY _T("http://jabber.org/protocol/activity+notify") -#define JABBER_CAPS_USER_ACTIVITY_NOTIFY ((JabberCapsBits)1<<36) -#define JABBER_FEAT_ATTENTION_0 _T("urn:xmpp:attention:0") -#define JABBER_CAPS_ATTENTION_0 ((JabberCapsBits)1<<37) +#define JABBER_CAPS_USER_ACTIVITY_NOTIFY ((JabberCapsBits)1<<38) #define JABBER_FEAT_MIRANDA_NOTES _T("http://miranda-ng.org/storage#notes") -#define JABBER_CAPS_MIRANDA_NOTES ((JabberCapsBits)1<<38) +#define JABBER_CAPS_MIRANDA_NOTES ((JabberCapsBits)1<<39) #define JABBER_FEAT_JINGLE _T("urn:xmpp:jingle:1") -#define JABBER_CAPS_JINGLE ((JabberCapsBits)1<<39) +#define JABBER_CAPS_JINGLE ((JabberCapsBits)1<<40) #define JABBER_FEAT_ROSTER_EXCHANGE _T("http://jabber.org/protocol/rosterx") -#define JABBER_CAPS_ROSTER_EXCHANGE ((JabberCapsBits)1<<40) +#define JABBER_CAPS_ROSTER_EXCHANGE ((JabberCapsBits)1<<41) #define JABBER_FEAT_DIRECT_MUC_INVITE _T("jabber:x:conference") -#define JABBER_CAPS_DIRECT_MUC_INVITE ((JabberCapsBits)1<<41) +#define JABBER_CAPS_DIRECT_MUC_INVITE ((JabberCapsBits)1<<42) #define JABBER_FEAT_PUBSUB_EVENT _T("http://jabber.org/protocol/pubsub#event") #define JABBER_FEAT_PUBSUB_NODE_CONFIG _T("http://jabber.org/protocol/pubsub#node_config") @@ -161,7 +160,7 @@ 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_ROSTER_EXCHANGE | JABBER_CAPS_DIRECT_MUC_INVITE) + JABBER_CAPS_ROSTER_EXCHANGE | JABBER_CAPS_DIRECT_MUC_INVITE) #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) @@ -171,6 +170,7 @@ typedef unsigned __int64 JabberCapsBits; #define JABBER_EXT_MIROTR "mirotr" #define JABBER_EXT_JINGLE "jingle" #define JABBER_EXT_NEWGPG "new_gpg" +#define JABBER_EXT_NUDGE "nudge" #define JABBER_EXT_COMMANDS "cmds" #define JABBER_EXT_USER_MOOD "mood" #define JABBER_EXT_USER_TUNE "tune" diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index 5d7c113baf..d9a46a9d11 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -37,7 +37,7 @@ int CJabberProto::OnContactDeleted(WPARAM wParam, LPARAM) return 0; HANDLE hContact = (HANDLE)wParam; - ptrT jid( getTStringA(hContact, isChatRoom(hContact) ? "ChatRoomID" : "jid")); + ptrT jid(getTStringA(hContact, isChatRoom(hContact) ? "ChatRoomID" : "jid")); if (jid == NULL) return 0; @@ -47,11 +47,11 @@ int CJabberProto::OnContactDeleted(WPARAM wParam, LPARAM) JabberStripJid(m_ThreadInfo->fullJID, szStrippedJid, SIZEOF(szStrippedJid)); TCHAR *szDog = _tcschr(szStrippedJid, _T('@')); if (szDog && _tcsicmp(szDog + 1, jid)) - m_ThreadInfo->send( XmlNodeIq(_T("set"), SerialNext(), jid) << XQUERY(JABBER_FEAT_REGISTER) << XCHILD(_T("remove"))); + m_ThreadInfo->send(XmlNodeIq(_T("set"), SerialNext(), jid) << XQUERY(JABBER_FEAT_REGISTER) << XCHILD(_T("remove"))); } // Remove from roster, server also handles the presence unsubscription process. - m_ThreadInfo->send( XmlNodeIq(_T("set"), SerialNext()) << XQUERY(JABBER_FEAT_IQ_ROSTER) + m_ThreadInfo->send(XmlNodeIq(_T("set"), SerialNext()) << XQUERY(JABBER_FEAT_IQ_ROSTER) << XCHILD(_T("item")) << XATTR(_T("jid"), jid) << XATTR(_T("subscription"), _T("remove"))); } return 0; @@ -60,9 +60,9 @@ int CJabberProto::OnContactDeleted(WPARAM wParam, LPARAM) ///////////////////////////////////////////////////////////////////////////////////////// // JabberDbSettingChanged - process database changes -static TCHAR* sttSettingToTchar(DBCONTACTWRITESETTING* cws) +static TCHAR* sttSettingToTchar(DBCONTACTWRITESETTING *cws) { - switch(cws->value.type) { + switch (cws->value.type) { case DBVT_ASCIIZ: return mir_a2t(cws->value.pszVal); @@ -75,13 +75,13 @@ static TCHAR* sttSettingToTchar(DBCONTACTWRITESETTING* cws) return NULL; } -void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING* cws, HANDLE hContact) +void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING *cws, HANDLE hContact) { - JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrT( getTStringA(hContact, "jid"))); + JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrT(getTStringA(hContact, "jid"))); if (item == NULL) return; - ptrT tszNick( db_get_tsa(hContact, "CList", "MyHandle")); + ptrT tszNick(db_get_tsa(hContact, "CList", "MyHandle")); if (tszNick == NULL) tszNick = getTStringA(hContact, "Nick"); if (tszNick == NULL) @@ -106,7 +106,7 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING* cws, HANDLE hCon } } -void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING* cws, HANDLE hContact) +void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING *cws, HANDLE hContact) { JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrT( getTStringA(hContact, "jid"))); if (item == NULL) @@ -128,15 +128,15 @@ void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING* cws, HANDLE hC void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING *cws, HANDLE hContact) { - if (cws->value.type != DBVT_DELETED && !(cws->value.type==DBVT_BYTE && cws->value.bVal==0)) + if (cws->value.type != DBVT_DELETED && !(cws->value.type == DBVT_BYTE && cws->value.bVal == 0)) return; - ptrT jid( getTStringA(hContact, "jid")); + ptrT jid(getTStringA(hContact, "jid")); if (jid == NULL) return; debugLogA("Add %S permanently to list", jid); - ptrT nick( db_get_tsa(hContact, "CList", "MyHandle")); + ptrT nick(db_get_tsa(hContact, "CList", "MyHandle")); if (nick == NULL) nick = getTStringA(hContact, "Nick"); if (nick == NULL) @@ -144,10 +144,10 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING *cws, HANDL if (nick == NULL) return; - AddContactToRoster(jid, nick, ptrT( db_get_tsa(hContact, "CList", "Group"))); + AddContactToRoster(jid, nick, ptrT(db_get_tsa(hContact, "CList", "Group"))); XmlNode xPresence(_T("presence")); xPresence << XATTR(_T("to"), LPCTSTR(jid)) << XATTR(_T("type"), _T("subscribe")); - ptrT myNick( getTStringA(NULL, "Nick")); + ptrT myNick(getTStringA(NULL, "Nick")); if (myNick != NULL) xPresence << XCHILD(_T("nick"), LPCTSTR(myNick)) << XATTR(_T("xmlns"), JABBER_FEAT_NICK); m_ThreadInfo->send(xPresence); diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index 582f977e73..ee0b58dc2e 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -553,8 +553,7 @@ INT_PTR __cdecl CJabberProto::JabberSendNudge(WPARAM wParam, LPARAM) JabberCapsBits jcb = GetResourceCapabilites(tszJid, FALSE); m_ThreadInfo->send( XmlNode(_T("message")) << XATTR(_T("type"), _T("headline")) << XATTR(_T("to"), tszJid) - << XCHILDNS(_T("attention"), - (jcb & JABBER_CAPS_ATTENTION) ? JABBER_FEAT_ATTENTION : JABBER_FEAT_ATTENTION_0)); + << XCHILDNS(_T("attention"), JABBER_FEAT_ATTENTION)); return 0; } diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 2d5240d8b1..a4bb4f7cc4 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1197,8 +1197,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info) JabberReadXep203delay(node, msgTime); // XEP-0224 support (Attention/Nudge) - if (xmlGetChildByTag(node, "attention", "xmlns", JABBER_FEAT_ATTENTION) || - xmlGetChildByTag(node, "attention", "xmlns", JABBER_FEAT_ATTENTION_0)) { + if (xmlGetChildByTag(node, "attention", "xmlns", JABBER_FEAT_ATTENTION)) { if (!hContact) hContact = CreateTemporaryContact(from, chatItem); if (hContact) -- cgit v1.2.3