summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-09-26 20:24:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-09-26 20:24:42 +0000
commit7b7d16119b71147636b6a473c00f93b28c85a054 (patch)
treeeb88fd492b6b9f99c6121aa95f9242731232e03c /protocols/JabberG
parentf34c2e508eeaba527009e2b86bf6ef7a09a496bb (diff)
nick support (XEP-0172) for our own subscription requests
git-svn-id: http://svn.miranda-ng.org/main/trunk@6244 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG')
-rw-r--r--protocols/JabberG/src/jabber_events.cpp41
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp3
2 files changed, 17 insertions, 27 deletions
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp
index c84b4fdfd3..fb54c36990 100644
--- a/protocols/JabberG/src/jabber_events.cpp
+++ b/protocols/JabberG/src/jabber_events.cpp
@@ -147,39 +147,30 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING *cws, HANDL
if (cws->value.type != DBVT_DELETED && !(cws->value.type==DBVT_BYTE && cws->value.bVal==0))
return;
- DBVARIANT jid, dbv;
- if (getTString(hContact, "jid", &jid))
+ ptrT jid( getTStringA(hContact, "jid"));
+ if (jid == NULL)
return;
- TCHAR *nick;
- Log("Add %S permanently to list", jid.pszVal);
- if ( !db_get_ts(hContact, "CList", "MyHandle", &dbv)) {
- nick = mir_tstrdup(dbv.ptszVal);
- db_free(&dbv);
- }
- else if ( !getTString(hContact, "Nick", &dbv)) {
- nick = mir_tstrdup(dbv.ptszVal);
- db_free(&dbv);
- }
- else nick = JabberNickFromJID(jid.ptszVal);
- if (nick == NULL) {
- db_free(&jid);
+ Log("Add %S permanently to list", jid);
+ ptrT nick( db_get_tsa(hContact, "CList", "MyHandle"));
+ if (nick == NULL)
+ nick = getTStringA(hContact, "Nick");
+ if (nick == NULL)
+ nick = JabberNickFromJID(jid);
+ if (nick == NULL)
return;
- }
- if ( !db_get_ts(hContact, "CList", "Group", &dbv)) {
- AddContactToRoster(jid.ptszVal, nick, dbv.ptszVal);
- db_free(&dbv);
- }
- else AddContactToRoster(jid.ptszVal, nick, NULL);
+ AddContactToRoster(jid, nick, ptrT( db_get_tsa(hContact, "CList", "Group")));
- m_ThreadInfo->send(XmlNode(_T("presence")) << XATTR(_T("to"), jid.ptszVal) << XATTR(_T("type"), _T("subscribe")));
+ HXML xPresence = XmlNode(_T("presence")) << XATTR(_T("to"), jid) << XATTR(_T("type"), _T("subscribe"));
+ ptrT myNick( getTStringA(NULL, "Nick"));
+ if (myNick != NULL)
+ xPresence << XCHILD(_T("nick"), nick) << XATTR(_T("xmlns"), JABBER_FEAT_NICK);
+ m_ThreadInfo->send(xPresence);
- SendGetVcard(jid.ptszVal);
+ SendGetVcard(jid);
- mir_free(nick);
db_unset(hContact, "CList", "Hidden");
- db_free(&jid);
}
int __cdecl CJabberProto::OnDbSettingChanged(WPARAM wParam, LPARAM lParam)
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index e5a77e7d84..bb5921e1c3 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -514,8 +514,7 @@ void CJabberDlgGcJoin::OnInitDialog()
m_proto->ComboLoadRecentStrings(m_hwnd, IDC_SERVER, "joinWnd_rcSvr");
int i;
- for (i=0; i < 5; i++)
- {
+ for (i=0; i < 5; i++) {
TCHAR jid[JABBER_MAX_JID_LEN];
JabberGcRecentInfo info(m_proto);
if ( !info.loadRecent(i))