diff options
author | George Hazan <george.hazan@gmail.com> | 2013-09-28 18:22:40 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-09-28 18:22:40 +0000 |
commit | 56ac6b6b49cd5785ce5fb14dc63e776b4b3da07a (patch) | |
tree | 7f0b1eeaa437cf2ecd31f69add3242007f46ae3b /protocols/JabberG | |
parent | 00c6c10291bf7f86e871b648e8dd003a0a16c8e5 (diff) |
- Google specific functionality got moved to GTalkExt, part I;
- new event for extensions list creation, ME_JABBER_EXTLISTINIT
git-svn-id: http://svn.miranda-ng.org/main/trunk@6260 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG')
-rw-r--r-- | protocols/JabberG/src/jabber.cpp | 4 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_api.cpp | 11 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_caps.h | 1 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_iqid.cpp | 80 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_menu.cpp | 8 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.h | 1 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_util.cpp | 7 |
7 files changed, 55 insertions, 57 deletions
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index 83b90a0e95..d72f1b99c3 100644 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.cpp @@ -63,6 +63,7 @@ BOOL jabberChatDllPresent = FALSE; HANDLE hExtraActivity = NULL;
HANDLE hExtraMood = NULL;
+HANDLE hExtListInit;
void JabberUserInfoInit(void);
@@ -202,6 +203,8 @@ extern "C" int __declspec(dllexport) Load() setlocale(LC_ALL, "");
+ hExtListInit = CreateHookableEvent(ME_JABBER_EXTLISTINIT);
+
// Register protocol module
PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = "JABBER";
@@ -224,6 +227,7 @@ extern "C" int __declspec(dllexport) Load() extern "C" int __declspec(dllexport) Unload(void)
{
+ DestroyHookableEvent(hExtListInit);
g_MenuUninit();
g_Instances.destroy();
diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp index 0528643c5e..03dbf8b276 100644 --- a/protocols/JabberG/src/jabber_api.cpp +++ b/protocols/JabberG/src/jabber_api.cpp @@ -204,28 +204,23 @@ int CJabberProto::RemoveHandler(HJHANDLER hHandler) JabberFeatCapPairDynamic *CJabberProto::FindFeature(LPCTSTR szFeature)
{
- int i;
- for (i=0; i < m_lstJabberFeatCapPairsDynamic.getCount(); i++)
+ for (int i=0; i < m_lstJabberFeatCapPairsDynamic.getCount(); i++)
if ( !lstrcmp(m_lstJabberFeatCapPairsDynamic[i]->szFeature, szFeature))
return m_lstJabberFeatCapPairsDynamic[i];
+
return NULL;
}
int CJabberProto::RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription)
{
- if ( !szFeature) {
+ if ( !szFeature)
return false;
- }
// check for this feature in core features, and return false if it's present, to prevent re-registering a core feature
int i;
for (i=0; g_JabberFeatCapPairs[i].szFeature; i++)
- {
if ( !lstrcmp(g_JabberFeatCapPairs[i].szFeature, szFeature))
- {
return false;
- }
- }
mir_cslock lck(m_csLists);
JabberFeatCapPairDynamic *fcp = FindFeature(szFeature);
diff --git a/protocols/JabberG/src/jabber_caps.h b/protocols/JabberG/src/jabber_caps.h index 6322fd4170..5c5bc8199b 100644 --- a/protocols/JabberG/src/jabber_caps.h +++ b/protocols/JabberG/src/jabber_caps.h @@ -166,7 +166,6 @@ typedef unsigned __int64 JabberCapsBits; #define JABBER_EXT_USER_MOOD "mood"
#define JABBER_EXT_USER_TUNE "tune"
#define JABBER_EXT_USER_ACTIVITY "activity"
-#define JABBER_EXT_GTALK_PMUC "pmuc-v1"
#define JABBER_EXT_MIR_NOTES "mir_notes"
#define JABBER_EXT_PLATFORMX86 "x86"
#define JABBER_EXT_PLATFORMX64 "x64"
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 567c762869..f226f5b7af 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -34,55 +34,55 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode) return;
const TCHAR *type = xmlGetAttrValue(iqNode, _T("type"));
- int i;
+ if ( _tcscmp(type, _T("result")))
+ return;
- if ( !_tcscmp(type, _T("result"))) {
- HXML query = xmlGetChildByTag(iqNode, "query", "xmlns", JABBER_FEAT_DISCO_INFO);
- if ( !query)
- return;
+ HXML query = xmlGetChildByTag(iqNode, "query", "xmlns", JABBER_FEAT_DISCO_INFO);
+ if ( !query)
+ return;
- HXML identity;
- for (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"))) {
- m_bPepSupported = TRUE;
+ 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"))) {
+ m_bPepSupported = TRUE;
- EnableMenuItems(TRUE);
- RebuildInfoFrame();
- }
- else if (identityCategory && identityType && identityName &&
- !_tcscmp(identityCategory, _T("server")) &&
- !_tcscmp(identityType, _T("im")) &&
- !_tcscmp(identityName, _T("Google Talk"))) {
- m_ThreadInfo->jabberServerCaps |= JABBER_CAPS_PING;
- m_bGoogleTalk = true;
-
- // 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")));
- }
+ EnableMenuItems(TRUE);
+ RebuildInfoFrame();
}
+ 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")));
+ }
+ }
- if (m_ThreadInfo) {
- HXML feature;
- for (i = 1; (feature = xmlGetNthChild(query, _T("feature"), i)) != NULL; i++) {
- const TCHAR *featureName = xmlGetAttrValue(feature, _T("var"));
- if (!featureName)
- continue;
+ if (m_ThreadInfo) {
+ HXML feature;
+ for (int i = 1; (feature = xmlGetNthChild(query, _T("feature"), i)) != NULL; i++) {
+ const TCHAR *featureName = xmlGetAttrValue(feature, _T("var"));
+ if (!featureName)
+ continue;
- for (int j = 0; g_JabberFeatCapPairs[j].szFeature; j++)
- if ( !_tcscmp(g_JabberFeatCapPairs[j].szFeature, featureName)) {
- m_ThreadInfo->jabberServerCaps |= g_JabberFeatCapPairs[j].jcbCap;
- break;
- }
+ for (int j = 0; g_JabberFeatCapPairs[j].szFeature; j++) {
+ if ( !_tcscmp(g_JabberFeatCapPairs[j].szFeature, featureName)) {
+ m_ThreadInfo->jabberServerCaps |= g_JabberFeatCapPairs[j].jcbCap;
+ break;
+ }
}
}
+ }
- OnProcessLoginRq(m_ThreadInfo, JABBER_LOGIN_SERVERINFO);
-} }
+ OnProcessLoginRq(m_ThreadInfo, JABBER_LOGIN_SERVERINFO);
+}
void CJabberProto::OnIqResultNestedRosterGroups(HXML iqNode, CJabberIqInfo* pInfo)
{
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index c8b96559b2..4c27ddf361 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -49,11 +49,12 @@ static HGENMENU g_hMenuResourcesRoot; static HGENMENU g_hMenuResourcesActive;
static HGENMENU g_hMenuResourcesServer;
-static struct
+struct
{
int icon;
int mode;
-} PresenceModeArray[] =
+}
+static PresenceModeArray[] =
{
{ SKINICON_STATUS_ONLINE, ID_STATUS_ONLINE },
{ SKINICON_STATUS_AWAY, ID_STATUS_AWAY },
@@ -813,7 +814,7 @@ void CJabberProto::MenuInit() m_pepServices.RebuildMenu();
CheckMenuItems();
- NotifyFastHook(hStatusMenuInit, (WPARAM)hJabberRoot, (LPARAM)this);
+ NotifyFastHook(hStatusMenuInit, (WPARAM)hJabberRoot, (LPARAM)(IJabberInterface*)this);
}
//////////////////////////////////////////////////////////////////////////
@@ -1194,6 +1195,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM wParam, LPARAM l ////////////////////////////////////////////////////////////////////////
// Choose protocol instance
+
CJabberProto *JabberChooseInstance(bool bIsLink)
{
if (g_Instances.getCount() == 0)
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 16476a0c45..b1cc88bc0a 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -195,7 +195,6 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface BOOL m_bChangeStatusMessageOnly;
BOOL m_bSendKeepAlive;
BOOL m_bPepSupported;
- BOOL m_bGoogleTalk;
HWND m_hwndAgentRegInput;
HWND m_hwndRegProgress;
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 65a5f059f6..132395ddd6 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -26,7 +26,7 @@ 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)
@@ -620,9 +620,6 @@ void CJabberProto::SendPresenceTo(int status, TCHAR* to, HXML extra, const TCHAR << XATTR(_T("ver"), szCoreVersion);
LIST<TCHAR> arrExtCaps(5);
- if (m_bGoogleTalk)
- arrExtCaps.insert( _T(JABBER_EXT_GTALK_PMUC));
-
if (bSecureIM)
arrExtCaps.insert( _T(JABBER_EXT_SECUREIM));
@@ -652,6 +649,8 @@ void CJabberProto::SendPresenceTo(int status, TCHAR* to, HXML extra, const TCHAR if (m_options.AcceptNotes)
arrExtCaps.insert( _T(JABBER_EXT_MIR_NOTES));
+ NotifyFastHook(hExtListInit, (WPARAM)&arrExtCaps, (LPARAM)(IJabberInterface*)this);
+
// add features enabled through IJabberNetInterface::AddFeatures()
for (int i=0; i < m_lstJabberFeatCapPairsDynamic.getCount(); i++)
if (m_uEnabledFeatCapsDynamic & m_lstJabberFeatCapPairsDynamic[i]->jcbCap)
|