summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-09-28 21:05:24 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-09-28 21:05:24 +0000
commit2954dbdabf126bcfaf956de5ac3d28adb8940c1b (patch)
tree333e3909c63e08a1ca6270a4a46c79c1de0061b0 /protocols/JabberG/src
parent8f0577ab8e8c06fdefd347b9485cb0c212e221e6 (diff)
no more google related code in Jabber
git-svn-id: http://svn.miranda-ng.org/main/trunk@6264 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r--protocols/JabberG/src/jabber.cpp5
-rw-r--r--protocols/JabberG/src/jabber.h6
-rw-r--r--protocols/JabberG/src/jabber_caps.h1
-rw-r--r--protocols/JabberG/src/jabber_disco.h1
-rw-r--r--protocols/JabberG/src/jabber_iq.cpp3
-rw-r--r--protocols/JabberG/src/jabber_iqid.cpp24
-rw-r--r--protocols/JabberG/src/jabber_proto.h7
-rw-r--r--protocols/JabberG/src/jabber_util.cpp92
8 files changed, 18 insertions, 121 deletions
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp
index d72f1b99c3..c040ff5f3a 100644
--- a/protocols/JabberG/src/jabber.cpp
+++ b/protocols/JabberG/src/jabber.cpp
@@ -63,7 +63,7 @@ BOOL jabberChatDllPresent = FALSE;
HANDLE hExtraActivity = NULL;
HANDLE hExtraMood = NULL;
-HANDLE hExtListInit;
+HANDLE hExtListInit, hDiscoInfoResult;
void JabberUserInfoInit(void);
@@ -204,6 +204,7 @@ extern "C" int __declspec(dllexport) Load()
setlocale(LC_ALL, "");
hExtListInit = CreateHookableEvent(ME_JABBER_EXTLISTINIT);
+ hDiscoInfoResult = CreateHookableEvent(ME_JABBER_SRVDISCOINFO);
// Register protocol module
PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
@@ -228,6 +229,8 @@ extern "C" int __declspec(dllexport) Load()
extern "C" int __declspec(dllexport) Unload(void)
{
DestroyHookableEvent(hExtListInit);
+ DestroyHookableEvent(hDiscoInfoResult);
+
g_MenuUninit();
g_Instances.destroy();
diff --git a/protocols/JabberG/src/jabber.h b/protocols/JabberG/src/jabber.h
index 697c8b5c2e..eefd600481 100644
--- a/protocols/JabberG/src/jabber.h
+++ b/protocols/JabberG/src/jabber.h
@@ -386,7 +386,6 @@ struct ThreadData
void shutdown(void);
int recv(char* buf, size_t len);
int send(char* buffer, int bufsize = -1);
-// int send(const char* fmt, ...);
int send(HXML node);
int recvws(char* buffer, size_t bufsize, int flags);
@@ -589,6 +588,10 @@ extern struct CountryListEntry* g_countries;
extern FI_INTERFACE *FIP;
+extern CRITICAL_SECTION mutex;
+extern HANDLE hExtListInit, hDiscoInfoResult;
+extern int bSecureIM, bMirOTR, bNewGPG, bPlatform;
+
/*******************************************************************
* Function declarations
*******************************************************************/
@@ -737,7 +740,6 @@ TCHAR* __stdcall JabberErrorStr(int errorCode);
TCHAR* __stdcall JabberErrorMsg(HXML errorNode, int* errorCode = NULL);
void __stdcall JabberUtfToTchar(const char* str, size_t cbLen, LPTSTR& dest);
time_t __stdcall JabberIsoToUnixTime(const TCHAR *stamp);
-void __stdcall JabberStringAppend(char* *str, int *sizeAlloced, const char* fmt, ...);
TCHAR* __stdcall JabberStripJid(const TCHAR *jid, TCHAR* dest, size_t destLen);
int __stdcall JabberGetPacketID(HXML n);
diff --git a/protocols/JabberG/src/jabber_caps.h b/protocols/JabberG/src/jabber_caps.h
index feb2161513..570463396b 100644
--- a/protocols/JabberG/src/jabber_caps.h
+++ b/protocols/JabberG/src/jabber_caps.h
@@ -182,7 +182,6 @@ typedef unsigned __int64 JabberCapsBits;
#define JABBER_FEAT_IQ_ROSTER _T("jabber:iq:roster")
#define JABBER_FEAT_DELAY _T("jabber:x:delay")
#define JABBER_FEAT_ENTITY_TIME_OLD _T("jabber:iq:time")
-#define JABBER_FEAT_GTALK_SHARED_STATUS _T("google:shared-status")
#define JABBER_FEAT_MUC_ADMIN _T("http://jabber.org/protocol/muc#admin")
#define JABBER_FEAT_MUC_OWNER _T("http://jabber.org/protocol/muc#owner")
diff --git a/protocols/JabberG/src/jabber_disco.h b/protocols/JabberG/src/jabber_disco.h
index 31818912c3..cec8845952 100644
--- a/protocols/JabberG/src/jabber_disco.h
+++ b/protocols/JabberG/src/jabber_disco.h
@@ -32,7 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define JABBER_DISCO_RESULT_ERROR -1
#define JABBER_DISCO_RESULT_OK -2
-class CJabberSDIdentity;
class CJabberSDIdentity
{
protected:
diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp
index acf1c0e6ae..868a293881 100644
--- a/protocols/JabberG/src/jabber_iq.cpp
+++ b/protocols/JabberG/src/jabber_iq.cpp
@@ -111,9 +111,6 @@ void CJabberProto::IqAdd(unsigned int iqId, JABBER_IQ_PROCID procId, JABBER_IQ_P
BOOL CJabberIqManager::FillPermanentHandlers()
{
- // Google Shared Status (http://code.google.com/apis/talk/jep_extensions/shared_status.html)
- AddPermanentHandler(&CJabberProto::OnIqSetGoogleSharedStatus, JABBER_IQ_TYPE_SET, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_TO | JABBER_IQ_PARSE_ID_STR, _T("google:shared-status"), FALSE, _T("query"));
-
// version requests (XEP-0092)
AddPermanentHandler(&CJabberProto::OnIqRequestVersion, JABBER_IQ_TYPE_GET, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_ID_STR, JABBER_FEAT_VERSION, FALSE, _T("query"));
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index f226f5b7af..5ef126bcbd 100644
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -43,26 +43,20 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode)
HXML identity;
for (int i = 1; (identity = xmlGetNthChild(query, _T("identity"), i)) != NULL; i++) {
- const TCHAR *identityCategory = xmlGetAttrValue(identity, _T("category"));
- const TCHAR *identityType = xmlGetAttrValue(identity, _T("type"));
- const TCHAR *identityName = xmlGetAttrValue(identity, _T("name"));
- if (identityCategory && identityType && !_tcscmp(identityCategory, _T("pubsub")) && !_tcscmp(identityType, _T("pep"))) {
+ JABBER_DISCO_FIELD tmp = {
+ xmlGetAttrValue(identity, _T("category")),
+ xmlGetAttrValue(identity, _T("type")),
+ xmlGetAttrValue(identity, _T("name")) };
+
+ if ( !lstrcmp(tmp.category, _T("pubsub")) && !lstrcmp(tmp.type, _T("pep"))) {
m_bPepSupported = TRUE;
EnableMenuItems(TRUE);
RebuildInfoFrame();
+ continue;
}
- else if (identityCategory && identityType && identityName &&
- !_tcscmp(identityCategory, _T("server")) &&
- !_tcscmp(identityType, _T("im")) &&
- !_tcscmp(identityName, _T("Google Talk"))) {
- m_ThreadInfo->jabberServerCaps |= JABBER_CAPS_PING;
-
- // Google Shared Status
- m_ThreadInfo->send(
- XmlNodeIq(m_iqManager.AddHandler(&CJabberProto::OnIqResultGoogleSharedStatus, JABBER_IQ_TYPE_GET))
- << XQUERY(JABBER_FEAT_GTALK_SHARED_STATUS) << XATTR(_T("version"), _T("2")));
- }
+
+ NotifyFastHook(hDiscoInfoResult, (WPARAM)&tmp, (LPARAM)(IJabberInterface*)this);
}
if (m_ThreadInfo) {
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index b1cc88bc0a..a9a994ec6f 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -162,13 +162,6 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
int __cdecl JabberGcEventHook(WPARAM, LPARAM);
int __cdecl JabberGcMenuHook(WPARAM, LPARAM);
- // Google Shared Status
- BOOL m_bGoogleSharedStatus;
- BOOL m_bGoogleSharedStatusLock;
- void OnIqResultGoogleSharedStatus(HXML iqNode, CJabberIqInfo* pInfo);
- BOOL OnIqSetGoogleSharedStatus(HXML iqNode, CJabberIqInfo* pInfo);
- void SendIqGoogleSharedStatus(int status, const TCHAR *msg);
-
//====| Data |========================================================================
ThreadData* m_ThreadInfo;
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index 132395ddd6..84765938a2 100644
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -25,10 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "jabber_caps.h"
-extern CRITICAL_SECTION mutex;
-extern HANDLE hExtListInit;
-extern int bSecureIM, bMirOTR, bNewGPG, bPlatform;
-
int CJabberProto::SerialNext(void)
{
return ::InterlockedIncrement(&m_nSerial);
@@ -681,8 +677,7 @@ void CJabberProto::SendPresenceTo(int status, TCHAR* to, HXML extra, const TCHAR
if (!msg) msg = m_modeMsgs.szOnline;
break;
case ID_STATUS_INVISIBLE:
- if (!m_bGoogleSharedStatus)
- p << XATTR(_T("type"), _T("invisible"));
+ p << XATTR(_T("type"), _T("invisible"));
break;
case ID_STATUS_AWAY:
case ID_STATUS_ONTHEPHONE:
@@ -709,9 +704,6 @@ void CJabberProto::SendPresenceTo(int status, TCHAR* to, HXML extra, const TCHAR
if (msg)
p << XCHILD(_T("status"), msg);
-
- if (m_bGoogleSharedStatus && !to)
- SendIqGoogleSharedStatus(status, msg);
}
m_ThreadInfo->send(p);
@@ -733,88 +725,6 @@ void CJabberProto::SendPresence(int status, bool bSendToAll)
SendPresenceTo(status == ID_STATUS_INVISIBLE ? ID_STATUS_ONLINE : status, text, NULL);
} } } }
-/////////////////////////////////////////////////////////////////////////////////////////
-// Google Shared Status
-
-void CJabberProto::OnIqResultGoogleSharedStatus(HXML iqNode, CJabberIqInfo* pInfo) {
- m_bGoogleSharedStatus = (JABBER_IQ_TYPE_RESULT == pInfo->GetIqType());
- m_bGoogleSharedStatusLock = FALSE;
-}
-
-BOOL CJabberProto::OnIqSetGoogleSharedStatus(HXML iqNode, CJabberIqInfo* pInfo) {
- if (JABBER_IQ_TYPE_SET != pInfo->GetIqType()) return FALSE;
- if (m_bGoogleSharedStatusLock) return TRUE;
-
- int status;
- HXML query = xmlGetChild(iqNode, _T("query"));
- HXML node = xmlGetChild(query, _T("invisible"));
- if (0 == _tcsicmp(_T("true"), xmlGetAttrValue(node, _T("value"))))
- status = ID_STATUS_INVISIBLE;
- else {
- LPCTSTR txt = xmlGetText(xmlGetChild(query, _T("show")));
- if (txt && 0 == _tcsicmp(_T("dnd"), txt))
- status = ID_STATUS_DND;
- else if (m_iStatus == ID_STATUS_DND || m_iStatus == ID_STATUS_INVISIBLE)
- status = ID_STATUS_ONLINE;
- else
- status = m_iStatus;
- }
-
- if (status != m_iStatus) SetStatus(status);
-
- return TRUE;
-}
-
-void CJabberProto::SendIqGoogleSharedStatus(int status, const TCHAR *msg) {
- XmlNodeIq iq(m_iqManager.AddHandler(&CJabberProto::OnIqResultGoogleSharedStatus, JABBER_IQ_TYPE_SET));
- HXML query = iq << XQUERY(JABBER_FEAT_GTALK_SHARED_STATUS) << XATTR(_T("version"), _T("2"));
- query << XCHILD(_T("status"), msg);
- if (status == ID_STATUS_INVISIBLE) {
- query << XCHILD(_T("show"), _T("default"));
- query << XCHILD(_T("invisible")) << XATTR(_T("value"), _T("true"));
- }
- else {
- if (status == ID_STATUS_DND)
- query << XCHILD(_T("show"), _T("dnd"));
- else
- query << XCHILD(_T("show"), _T("default"));
-
- query << XCHILD(_T("invisible")) << XATTR(_T("value"), _T("false"));
- }
- m_bGoogleSharedStatusLock = TRUE;
- m_ThreadInfo->send(iq);
-}
-
-void __stdcall JabberStringAppend(char* *str, int *sizeAlloced, const char* fmt, ...)
-{
- va_list vararg;
- char* p;
- size_t size, len;
-
- if (str == NULL) return;
-
- if (*str == NULL || *sizeAlloced<=0) {
- *sizeAlloced = 2048;
- size = 2048;
- *str = (char*)mir_alloc(size);
- len = 0;
- }
- else {
- len = strlen(*str);
- size = *sizeAlloced - strlen(*str);
- }
-
- p = *str + len;
- va_start(vararg, fmt);
- while (mir_vsnprintf(p, size, fmt, vararg) == -1) {
- size += 2048;
- (*sizeAlloced) += 2048;
- *str = (char*)mir_realloc(*str, *sizeAlloced);
- p = *str + len;
- }
- va_end(vararg);
-}
-
///////////////////////////////////////////////////////////////////////////////
// JabberGetPacketID - converts the xml id attribute into an integer