summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_groupchat.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-20 13:55:58 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-20 13:55:58 +0000
commit04f4e2acfbc82946ca3def654214c08071a87359 (patch)
tree871e1f476ed5086e8ebbd7e182ea2a89707cc249 /protocols/JabberG/src/jabber_groupchat.cpp
parent24cbc87262dc8856741db8e9f8388c18b16583ad (diff)
xml api became a set of functions
git-svn-id: http://svn.miranda-ng.org/main/trunk@14288 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_groupchat.cpp')
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index fb1e164ece..6b38a3ee49 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -296,7 +296,7 @@ void CJabberProto::OnIqResultDiscovery(HXML iqNode, CJabberIqInfo *pInfo)
SendMessage(hwndList, CB_RESETCONTENT, 0, 0);
if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
- HXML query = xmlGetChild(iqNode, "query");
+ HXML query = XmlGetChild(iqNode, "query");
if (query == NULL) {
sttRoomListAppend(hwndList, RoomInfo::ROOM_FAIL,
TranslateT("Jabber Error"),
@@ -306,8 +306,8 @@ void CJabberProto::OnIqResultDiscovery(HXML iqNode, CJabberIqInfo *pInfo)
else {
bool found = false;
HXML item;
- for (int i = 1; item = xmlGetNthChild(query, _T("item"), i); i++) {
- const TCHAR *jid = xmlGetAttrValue(item, _T("jid"));
+ for (int i = 1; item = XmlGetNthChild(query, _T("item"), i); i++) {
+ const TCHAR *jid = XmlGetAttrValue(item, _T("jid"));
TCHAR *name = NEWTSTR_ALLOCA(jid);
if (name) {
if (TCHAR *p = _tcschr(name, _T('@')))
@@ -317,7 +317,7 @@ void CJabberProto::OnIqResultDiscovery(HXML iqNode, CJabberIqInfo *pInfo)
sttRoomListAppend(hwndList,
ListGetItemPtr(LIST_BOOKMARK, jid) ? RoomInfo::ROOM_BOOKMARK : RoomInfo::ROOM_DEFAULT,
- xmlGetAttrValue(item, _T("name")),
+ XmlGetAttrValue(item, _T("name")),
jid, name);
found = true;
@@ -332,7 +332,7 @@ void CJabberProto::OnIqResultDiscovery(HXML iqNode, CJabberIqInfo *pInfo)
}
}
else if (pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR) {
- HXML errorNode = xmlGetChild(iqNode, "error");
+ HXML errorNode = XmlGetChild(iqNode, "error");
TCHAR *str = JabberErrorMsg(errorNode);
sttRoomListAppend(hwndList, RoomInfo::ROOM_FAIL,
TranslateT("Jabber Error"),
@@ -770,11 +770,11 @@ static VOID CALLBACK JabberGroupchatChangeNickname(void* arg)
static int sttGetStatusCode(HXML node)
{
- HXML statusNode = xmlGetChild(node, "status");
+ HXML statusNode = XmlGetChild(node, "status");
if (statusNode == NULL)
return -1;
- const TCHAR *statusCode = xmlGetAttrValue(statusNode, _T("code"));
+ const TCHAR *statusCode = XmlGetAttrValue(statusNode, _T("code"));
if (statusCode == NULL)
return -1;
@@ -783,8 +783,8 @@ static int sttGetStatusCode(HXML node)
void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const TCHAR *oldNick, HXML itemNode)
{
- const TCHAR *jid = xmlGetAttrValue(itemNode, _T("jid"));
- const TCHAR *newNick = xmlGetAttrValue(itemNode, _T("nick"));
+ const TCHAR *jid = XmlGetAttrValue(itemNode, _T("jid"));
+ const TCHAR *newNick = XmlGetAttrValue(itemNode, _T("nick"));
if (newNick == NULL)
return;
@@ -822,8 +822,8 @@ void CJabberProto::GroupchatProcessPresence(HXML node)
{
const TCHAR *from;
- if (!node || !xmlGetName(node) || mir_tstrcmp(xmlGetName(node), _T("presence"))) return;
- if ((from = xmlGetAttrValue(node, _T("from"))) == NULL) return;
+ if (!node || !XmlGetName(node) || mir_tstrcmp(XmlGetName(node), _T("presence"))) return;
+ if ((from = XmlGetAttrValue(node, _T("from"))) == NULL) return;
const TCHAR *resource = _tcschr(from, '/');
if (resource == NULL || *++resource == '\0')
@@ -835,18 +835,18 @@ void CJabberProto::GroupchatProcessPresence(HXML node)
pResourceStatus r(item->findResource(resource));
- HXML nNode = xmlGetChildByTag(node, "nick", "xmlns", JABBER_FEAT_NICK);
- const TCHAR *cnick = xmlGetText(nNode);
+ HXML nNode = XmlGetChildByTag(node, "nick", "xmlns", JABBER_FEAT_NICK);
+ const TCHAR *cnick = XmlGetText(nNode);
const TCHAR *nick = cnick ? cnick : (r && r->m_tszNick ? r->m_tszNick : resource);
// process custom nick change
if (cnick && r && r->m_tszNick && mir_tstrcmp(cnick, r->m_tszNick))
r->m_tszNick = mir_tstrdup(cnick);
- HXML xNode = xmlGetChildByTag(node, "x", "xmlns", JABBER_FEAT_MUC_USER);
- HXML itemNode = xmlGetChild(xNode, "item");
+ HXML xNode = XmlGetChildByTag(node, "x", "xmlns", JABBER_FEAT_MUC_USER);
+ HXML itemNode = XmlGetChild(xNode, "item");
- const TCHAR *type = xmlGetAttrValue(node, _T("type"));
+ const TCHAR *type = XmlGetAttrValue(node, _T("type"));
// entering room or a usual room presence
if (type == NULL || !mir_tstrcmp(type, _T("available"))) {
@@ -858,7 +858,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node)
// Update status of room participant
int status = ID_STATUS_ONLINE;
- LPCTSTR ptszShow = xmlGetText(xmlGetChild(node, "show"));
+ LPCTSTR ptszShow = XmlGetText(XmlGetChild(node, "show"));
if (ptszShow) {
if (!mir_tstrcmp(ptszShow, _T("away"))) status = ID_STATUS_AWAY;
else if (!mir_tstrcmp(ptszShow, _T("xa"))) status = ID_STATUS_NA;
@@ -866,10 +866,10 @@ void CJabberProto::GroupchatProcessPresence(HXML node)
else if (!mir_tstrcmp(ptszShow, _T("chat"))) status = ID_STATUS_FREECHAT;
}
- LPCTSTR str = xmlGetText(xmlGetChild(node, "status"));
+ LPCTSTR str = XmlGetText(XmlGetChild(node, "status"));
char priority = 0;
- if (LPCTSTR ptszPriority = xmlGetText(xmlGetChild(node, "priority")))
+ if (LPCTSTR ptszPriority = XmlGetText(XmlGetChild(node, "priority")))
priority = (char)_ttoi(ptszPriority);
bool bStatusChanged = false, bRoomCreated = false, bAffiliationChanged = false, bRoleChanged = false;
@@ -887,14 +887,14 @@ void CJabberProto::GroupchatProcessPresence(HXML node)
JABBER_GC_AFFILIATION affiliation = r->m_affiliation;
JABBER_GC_ROLE role = r->m_role;
- if ((str = xmlGetAttrValue(itemNode, _T("affiliation"))) != NULL) {
+ if ((str = XmlGetAttrValue(itemNode, _T("affiliation"))) != NULL) {
if (!mir_tstrcmp(str, _T("owner"))) affiliation = AFFILIATION_OWNER;
else if (!mir_tstrcmp(str, _T("admin"))) affiliation = AFFILIATION_ADMIN;
else if (!mir_tstrcmp(str, _T("member"))) affiliation = AFFILIATION_MEMBER;
else if (!mir_tstrcmp(str, _T("none"))) affiliation = AFFILIATION_NONE;
else if (!mir_tstrcmp(str, _T("outcast"))) affiliation = AFFILIATION_OUTCAST;
}
- if ((str = xmlGetAttrValue(itemNode, _T("role"))) != NULL) {
+ if ((str = XmlGetAttrValue(itemNode, _T("role"))) != NULL) {
if (!mir_tstrcmp(str, _T("moderator"))) role = ROLE_MODERATOR;
else if (!mir_tstrcmp(str, _T("participant"))) role = ROLE_PARTICIPANT;
else if (!mir_tstrcmp(str, _T("visitor"))) role = ROLE_VISITOR;
@@ -917,7 +917,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node)
bRoleChanged = true;
}
- if (str = xmlGetAttrValue(itemNode, _T("jid")))
+ if (str = XmlGetAttrValue(itemNode, _T("jid")))
r->m_tszRealJid = mir_tstrdup(str);
}
}
@@ -942,8 +942,8 @@ void CJabberProto::GroupchatProcessPresence(HXML node)
// Check <created/>
if (bRoomCreated) {
- HXML n = xmlGetChild(node, "created");
- if (n != NULL && (str = xmlGetAttrValue(n, _T("xmlns"))) != NULL && !mir_tstrcmp(str, JABBER_FEAT_MUC_OWNER))
+ HXML n = XmlGetChild(node, "created");
+ if (n != NULL && (str = XmlGetAttrValue(n, _T("xmlns"))) != NULL && !mir_tstrcmp(str, JABBER_FEAT_MUC_OWNER))
// A new room just created by me
// Request room config
m_ThreadInfo->send(
@@ -956,8 +956,8 @@ void CJabberProto::GroupchatProcessPresence(HXML node)
else if (!mir_tstrcmp(type, _T("unavailable"))) {
const TCHAR *str = 0;
if (xNode != NULL && item->nick != NULL) {
- HXML reasonNode = xmlGetChild(itemNode, "reason");
- str = xmlGetAttrValue(itemNode, _T("jid"));
+ HXML reasonNode = XmlGetChild(itemNode, "reason");
+ str = XmlGetAttrValue(itemNode, _T("jid"));
int iStatus = sttGetStatusCode(xNode);
if (iStatus == 301 && r != NULL)
@@ -991,7 +991,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node)
}
}
- HXML statusNode = xmlGetChild(node, "status");
+ HXML statusNode = XmlGetChild(node, "status");
GcLogUpdateMemberStatus(item, resource, nick, str, GC_EVENT_PART, statusNode);
ListRemoveResource(LIST_CHATROOM, from);
@@ -1003,7 +1003,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node)
// processing room errors
else if (!mir_tstrcmp(type, _T("error"))) {
int errorCode = 0;
- HXML errorNode = xmlGetChild(node, "error");
+ HXML errorNode = XmlGetChild(node, "error");
ptrT str(JabberErrorMsg(errorNode, &errorCode));
if (errorCode == JABBER_ERROR_CONFLICT) {
@@ -1035,11 +1035,11 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
JABBER_LIST_ITEM *item;
CMString imgLink;
- if (!xmlGetName(node) || mir_tstrcmp(xmlGetName(node), _T("message"))) return;
- if ((from = xmlGetAttrValue(node, _T("from"))) == NULL) return;
+ if (!XmlGetName(node) || mir_tstrcmp(XmlGetName(node), _T("message"))) return;
+ if ((from = XmlGetAttrValue(node, _T("from"))) == NULL) return;
if ((item = ListGetItemPtr(LIST_CHATROOM, from)) == NULL) return;
- if ((type = xmlGetAttrValue(node, _T("type"))) == NULL) return;
+ if ((type = XmlGetAttrValue(node, _T("type"))) == NULL) return;
if (!mir_tstrcmp(type, _T("error")))
return;
@@ -1051,15 +1051,15 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
if (resource != NULL && *++resource == '\0')
resource = NULL;
- if ((n = xmlGetChild(node, "subject")) != NULL) {
- msgText = xmlGetText(n);
+ if ((n = XmlGetChild(node, "subject")) != NULL) {
+ msgText = XmlGetText(n);
if (msgText == NULL || msgText[0] == '\0')
return;
gcd.iType = GC_EVENT_TOPIC;
- if (resource == NULL && (m = xmlGetChild(node, "body")) != NULL) {
- const TCHAR *tmpnick = xmlGetText(m);
+ if (resource == NULL && (m = XmlGetChild(node, "body")) != NULL) {
+ const TCHAR *tmpnick = XmlGetText(m);
if (tmpnick == NULL || *tmpnick == 0)
return;
@@ -1076,11 +1076,11 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
else {
imgLink = ExtractImage(node);
- if ((n = xmlGetChildByTag(node, "body", "xml:lang", m_tszSelectedLang)) == NULL)
- if ((n = xmlGetChild(node, "body")) == NULL)
+ if ((n = XmlGetChildByTag(node, "body", "xml:lang", m_tszSelectedLang)) == NULL)
+ if ((n = XmlGetChild(node, "body")) == NULL)
return;
- msgText = xmlGetText(n);
+ msgText = XmlGetText(n);
if (msgText == NULL)
return;
@@ -1097,8 +1097,8 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
time_t msgTime = 0;
if (!JabberReadXep203delay(node, msgTime)) {
- HXML xDelay = xmlGetChildByTag(node, "x", "xmlns", _T("jabber:x:delay"));
- if (xDelay && (p = xmlGetAttrValue(xDelay, _T("stamp"))) != NULL)
+ HXML xDelay = XmlGetChildByTag(node, "x", "xmlns", _T("jabber:x:delay"));
+ if (xDelay && (p = XmlGetAttrValue(xDelay, _T("stamp"))) != NULL)
msgTime = JabberIsoToUnixTime(p);
}