summaryrefslogtreecommitdiff
path: root/protocols/Tlen/src/tlen_iqid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Tlen/src/tlen_iqid.cpp')
-rw-r--r--protocols/Tlen/src/tlen_iqid.cpp201
1 files changed, 108 insertions, 93 deletions
diff --git a/protocols/Tlen/src/tlen_iqid.cpp b/protocols/Tlen/src/tlen_iqid.cpp
index 786c642758..aa27bb4e04 100644
--- a/protocols/Tlen/src/tlen_iqid.cpp
+++ b/protocols/Tlen/src/tlen_iqid.cpp
@@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// ACTION: if successfully logged in, continue by requesting roster list and set my initial status
void TlenIqResultAuth(TlenProtocol *proto, XmlNode *iqNode)
{
- char *type=TlenXmlGetAttrValue(iqNode, "type");
+ char *type = TlenXmlGetAttrValue(iqNode, "type");
if (type == NULL)
return;
@@ -42,9 +42,9 @@ void TlenIqResultAuth(TlenProtocol *proto, XmlNode *iqNode)
db_set_s(NULL, proto->m_szModuleName, "Nick", proto->threadData->username);
else
db_free(&dbv);
-// iqId = TlenSerialNext();
-// TlenIqAdd(iqId, IQ_PROC_NONE, TlenIqResultGetRoster);
-// TlenSend(info, "<iq type='get' id='"TLEN_IQID"%d'><query xmlns='jabber:iq:roster'/></iq>", iqId);
+ // iqId = TlenSerialNext();
+ // TlenIqAdd(iqId, IQ_PROC_NONE, TlenIqResultGetRoster);
+ // TlenSend(info, "<iq type='get' id='"TLEN_IQID"%d'><query xmlns='jabber:iq:roster'/></iq>", iqId);
TlenSend(proto, "<iq type='get' id='GetRoster'><query xmlns='jabber:iq:roster'/></iq>");
TlenSend(proto, "<iq to='tcfg' type='get' id='TcfgGetAfterLoggedIn'></iq>");
@@ -55,7 +55,7 @@ void TlenIqResultAuth(TlenProtocol *proto, XmlNode *iqNode)
TlenSend(proto, "</s>");
mir_snprintf(text, Translate("Authentication failed for %s@%s."), proto->threadData->username, proto->threadData->server);
- MessageBoxA(NULL, text, Translate("Tlen Authentication"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
+ MessageBoxA(NULL, text, Translate("Tlen Authentication"), MB_OK | MB_ICONSTOP | MB_SETFOREGROUND);
ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
proto->threadData = NULL; // To disallow auto reconnect
}
@@ -67,10 +67,10 @@ void TlenResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) {
MCONTACT hContact;
char *name, *nick;
- for (int i=0; i<queryNode->numChild; i++) {
+ for (int i = 0; i < queryNode->numChild; i++) {
XmlNode *itemNode = queryNode->child[i];
if (!mir_strcmp(itemNode->name, "item")) {
- char *jid=TlenXmlGetAttrValue(itemNode, "jid");
+ char *jid = TlenXmlGetAttrValue(itemNode, "jid");
if (jid != NULL) {
char *str = TlenXmlGetAttrValue(itemNode, "subscription");
if (str == NULL)
@@ -81,7 +81,8 @@ void TlenResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) {
db_set_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
}
TlenListRemove(proto, LIST_ROSTER, jid);
- } else {
+ }
+ else {
TLEN_LIST_ITEM *item = TlenListAdd(proto, LIST_ROSTER, jid);
if (item != NULL) {
if (!mir_strcmp(str, "both"))
@@ -92,23 +93,24 @@ void TlenResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) {
item->subscription = SUB_FROM;
else
item->subscription = SUB_NONE;
- if ((name=TlenXmlGetAttrValue(itemNode, "name")) != NULL) {
+ if ((name = TlenXmlGetAttrValue(itemNode, "name")) != NULL) {
nick = TlenTextDecode(name);
- } else {
+ }
+ else {
nick = TlenLocalNickFromJID(jid);
}
if (nick != NULL) {
if (item->nick) mir_free(item->nick);
item->nick = nick;
- if ((hContact=TlenHContactFromJID(proto, jid)) == NULL) {
+ if ((hContact = TlenHContactFromJID(proto, jid)) == NULL) {
// Received roster has a new JID.
// Add the jid (with empty resource) to Miranda contact list.
hContact = TlenDBCreateContact(proto, jid, nick, FALSE);
}
db_set_s(hContact, "CList", "MyHandle", nick);
if (item->group) mir_free(item->group);
- if ((groupNode=TlenXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
+ if ((groupNode = TlenXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
item->group = TlenGroupDecode(groupNode->text);
Clist_CreateGroup(0, _A2T(item->group));
// Don't set group again if already correct, or Miranda may show wrong group count in some case
@@ -116,9 +118,11 @@ void TlenResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) {
if (mir_strcmp(dbv.pszVal, item->group))
db_set_s(hContact, "CList", "Group", item->group);
db_free(&dbv);
- } else
+ }
+ else
db_set_s(hContact, "CList", "Group", item->group);
- } else {
+ }
+ else {
item->group = NULL;
db_unset(hContact, "CList", "Group");
}
@@ -134,9 +138,9 @@ void TlenResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) {
// ACTION: populate LIST_ROSTER and create contact for any new rosters
void TlenIqResultRoster(TlenProtocol *proto, XmlNode *iqNode)
{
- char *type=TlenXmlGetAttrValue(iqNode, "type");
+ char *type = TlenXmlGetAttrValue(iqNode, "type");
if (type == NULL) return;
- XmlNode *queryNode=TlenXmlGetChild(iqNode, "query");
+ XmlNode *queryNode = TlenXmlGetChild(iqNode, "query");
if (queryNode == NULL) return;
if (!mir_strcmp(type, "result")) {
@@ -149,7 +153,7 @@ void TlenIqResultRoster(TlenProtocol *proto, XmlNode *iqNode)
char *jid, *name, *nick;
int i, oldStatus;
- for (i=0; i<queryNode->numChild; i++) {
+ for (i = 0; i < queryNode->numChild; i++) {
itemNode = queryNode->child[i];
if (!mir_strcmp(itemNode->name, "item")) {
str = TlenXmlGetAttrValue(itemNode, "subscription");
@@ -159,26 +163,26 @@ void TlenIqResultRoster(TlenProtocol *proto, XmlNode *iqNode)
else if (!mir_strcmp(str, "from")) sub = SUB_FROM;
else sub = SUB_NONE;
//if (str != NULL && (!mir_strcmp(str, "to") || !mir_strcmp(str, "both"))) {
- if ((jid=TlenXmlGetAttrValue(itemNode, "jid")) != NULL) {
- if ((name=TlenXmlGetAttrValue(itemNode, "name")) != NULL)
+ if ((jid = TlenXmlGetAttrValue(itemNode, "jid")) != NULL) {
+ if ((name = TlenXmlGetAttrValue(itemNode, "name")) != NULL)
nick = TlenTextDecode(name);
else
nick = TlenLocalNickFromJID(jid);
-
+
if (nick != NULL) {
MCONTACT hContact;
item = TlenListAdd(proto, LIST_ROSTER, jid);
if (item->nick) mir_free(item->nick);
item->nick = nick;
item->subscription = sub;
- if ((hContact=TlenHContactFromJID(proto, jid)) == NULL) {
+ if ((hContact = TlenHContactFromJID(proto, jid)) == NULL) {
// Received roster has a new JID.
// Add the jid (with empty resource) to Miranda contact list.
hContact = TlenDBCreateContact(proto, jid, nick, FALSE);
}
db_set_s(hContact, "CList", "MyHandle", nick);
if (item->group) mir_free(item->group);
- if ((groupNode=TlenXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
+ if ((groupNode = TlenXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
item->group = TlenGroupDecode(groupNode->text);
Clist_CreateGroup(0, _A2T(item->group));
// Don't set group again if already correct, or Miranda may show wrong group count in some case
@@ -193,25 +197,25 @@ void TlenIqResultRoster(TlenProtocol *proto, XmlNode *iqNode)
item->group = NULL;
db_unset(hContact, "CList", "Group");
}
- if (!db_get(hContact, proto->m_szModuleName, "AvatarHash", &dbv)) {
- if (item->avatarHash) mir_free(item->avatarHash);
- item->avatarHash = mir_strdup(dbv.pszVal);
+
+ ptrA szAvatarHash(proto->getStringA(hContact, "AvatarHash"));
+ if (szAvatarHash != NULL) {
+ replaceStr(item->avatarHash, szAvatarHash);
proto->debugLogA("Setting hash [%s] = %s", nick, item->avatarHash);
- db_free(&dbv);
}
item->avatarFormat = db_get_dw(hContact, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
}
}
}
}
-
+
// Delete orphaned contacts (if roster sync is enabled)
if (db_get_b(NULL, proto->m_szModuleName, "RosterSync", FALSE) == TRUE) {
for (MCONTACT hContact = db_find_first(proto->m_szModuleName); hContact; ) {
MCONTACT hNext = hContact = db_find_next(hContact, proto->m_szModuleName);
- ptrA jid( db_get_sa(hContact, proto->m_szModuleName, "jid"));
- if (jid != NULL) {
- if (!TlenListExist(proto, LIST_ROSTER, jid)) {
+ ptrA szJid(proto->getStringA(hContact, "szJid"));
+ if (szJid != NULL) {
+ if (!TlenListExist(proto, LIST_ROSTER, szJid)) {
proto->debugLogA("Syncing roster: deleting 0x%x", hContact);
CallService(MS_DB_CONTACT_DELETE, hContact, 0);
}
@@ -228,7 +232,7 @@ void TlenIqResultRoster(TlenProtocol *proto, XmlNode *iqNode)
proto->debugLogA("Status changed via THREADSTART");
oldStatus = proto->m_iStatus;
TlenSendPresence(proto, proto->m_iDesiredStatus);
- ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, proto->m_iStatus);
+ ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, proto->m_iStatus);
}
}
}
@@ -241,27 +245,28 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode)
MCONTACT hContact;
char *nText;
-// TlenLog("<iq/> iqIdGetVcard (tlen)");
- char *type=TlenXmlGetAttrValue(iqNode, "type");
+ // TlenLog("<iq/> iqIdGetVcard (tlen)");
+ char *type = TlenXmlGetAttrValue(iqNode, "type");
if (type == NULL) return;
if (!mir_strcmp(type, "result")) {
DBVARIANT dbv;
- XmlNode *queryNode=TlenXmlGetChild(iqNode, "query");
+ XmlNode *queryNode = TlenXmlGetChild(iqNode, "query");
if (queryNode == NULL) return;
- XmlNode *itemNode=TlenXmlGetChild(queryNode, "item");
+ XmlNode *itemNode = TlenXmlGetChild(queryNode, "item");
if (itemNode == NULL) return;
- char *jid=TlenXmlGetAttrValue(itemNode, "jid");
+ char *jid = TlenXmlGetAttrValue(itemNode, "jid");
if (jid != NULL) {
if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) return;
if (strchr(jid, '@') != NULL) {
strncpy_s(text, jid, _TRUNCATE);
- } else {
- mir_snprintf(text, "%s@%s", jid, dbv.pszVal); // Add @tlen.pl
+ }
+ else {
+ mir_snprintf(text, "%s@%s", jid, dbv.pszVal); // Add @tlen.pl
}
db_free(&dbv);
- if ((hContact=TlenHContactFromJID(proto, text)) == NULL) {
+ if ((hContact = TlenHContactFromJID(proto, text)) == NULL) {
if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) return;
if (mir_strcmp(dbv.pszVal, jid)) {
db_free(&dbv);
@@ -269,12 +274,13 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode)
}
db_free(&dbv);
}
- } else {
+ }
+ else {
hContact = NULL;
}
bool hasFirst = false, hasLast = false, hasNick = false, hasEmail = false, hasCity = false, hasAge = false,
hasGender = false, hasSchool = false, hasLookFor = false, hasOccupation = false;
- for (int i=0; i<itemNode->numChild; i++) {
+ for (int i = 0; i < itemNode->numChild; i++) {
XmlNode *n = itemNode->child[i];
if (n == NULL || n->name == NULL) continue;
if (!mir_strcmp(n->name, "first")) {
@@ -327,7 +333,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode)
else if (!mir_strcmp(n->name, "s")) {
if (n->text != NULL && n->text[1] == '\0' && (n->text[0] == '1' || n->text[0] == '2')) {
hasGender = true;
- db_set_b(hContact, proto->m_szModuleName, "Gender", (BYTE) (n->text[0] == '1'?'M':'F'));
+ db_set_b(hContact, proto->m_szModuleName, "Gender", (BYTE)(n->text[0] == '1' ? 'M' : 'F'));
}
}
else if (!mir_strcmp(n->name, "e")) {
@@ -386,7 +392,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode)
db_unset(hContact, proto->m_szModuleName, "Occupation");
if (!hasLookFor)
db_unset(hContact, proto->m_szModuleName, "LookingFor");
- ProtoBroadcastAck(proto->m_szModuleName, hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
+ ProtoBroadcastAck(proto->m_szModuleName, hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
}
@@ -395,64 +401,69 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode)
XmlNode *queryNode, *itemNode, *n;
char *jid;
int i, found = 0;
- TLEN_SEARCH_RESULT jsr = {0};
- DBVARIANT dbv = {0};
+ TLEN_SEARCH_RESULT jsr = { 0 };
+ DBVARIANT dbv = { 0 };
-// TlenLog("<iq/> iqIdGetSearch");
+ // TlenLog("<iq/> iqIdGetSearch");
char *type = TlenXmlGetAttrValue(iqNode, "type");
if (type == NULL)
return;
char *str = TlenXmlGetAttrValue(iqNode, "id");
if (str == NULL)
return;
- int id = atoi(str+mir_strlen(TLEN_IQID));
+ int id = atoi(str + mir_strlen(TLEN_IQID));
if (!mir_strcmp(type, "result")) {
- if ((queryNode=TlenXmlGetChild(iqNode, "query")) == NULL) return;
+ if ((queryNode = TlenXmlGetChild(iqNode, "query")) == NULL) return;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
jsr.hdr.cbSize = sizeof(TLEN_SEARCH_RESULT);
jsr.hdr.flags = PSR_TCHAR;
- for (i=0; i<queryNode->numChild; i++) {
+ for (i = 0; i < queryNode->numChild; i++) {
itemNode = queryNode->child[i];
if (!mir_strcmp(itemNode->name, "item")) {
- if ((jid=TlenXmlGetAttrValue(itemNode, "jid")) != NULL) {
+ if ((jid = TlenXmlGetAttrValue(itemNode, "jid")) != NULL) {
if (strchr(jid, '@') != NULL) {
strncpy_s(jsr.jid, jid, _TRUNCATE);
- } else {
+ }
+ else {
mir_snprintf(jsr.jid, "%s@%s", jid, dbv.pszVal);
}
- jsr.jid[sizeof(jsr.jid)-1] = '\0';
+ jsr.jid[sizeof(jsr.jid) - 1] = '\0';
jsr.hdr.id.t = mir_a2t(jid);
- if ((n=TlenXmlGetChild(itemNode, "nick")) != NULL && n->text != NULL){
+ if ((n = TlenXmlGetChild(itemNode, "nick")) != NULL && n->text != NULL) {
char* buf = TlenTextDecode(n->text);
jsr.hdr.nick.t = mir_a2t(buf);
mir_free(buf);
- } else {
+ }
+ else {
jsr.hdr.nick.t = mir_tstrdup(TEXT(""));
}
- if ((n=TlenXmlGetChild(itemNode, "first")) != NULL && n->text != NULL){
+ if ((n = TlenXmlGetChild(itemNode, "first")) != NULL && n->text != NULL) {
char* buf = TlenTextDecode(n->text);
jsr.hdr.firstName.t = mir_a2t(buf);
mir_free(buf);
- } else {
+ }
+ else {
jsr.hdr.firstName.t = mir_tstrdup(TEXT(""));
}
- if ((n=TlenXmlGetChild(itemNode, "last")) != NULL && n->text != NULL){
+ if ((n = TlenXmlGetChild(itemNode, "last")) != NULL && n->text != NULL) {
char* buf = TlenTextDecode(n->text);
jsr.hdr.lastName.t = mir_a2t(buf);
mir_free(buf);
- } else {
+ }
+ else {
jsr.hdr.lastName.t = mir_tstrdup(TEXT(""));
}
- if ((n=TlenXmlGetChild(itemNode, "email"))!=NULL && n->text!=NULL){
+ if ((n = TlenXmlGetChild(itemNode, "email")) != NULL && n->text != NULL) {
char* buf = TlenTextDecode(n->text);
jsr.hdr.email.t = mir_a2t(buf);
mir_free(buf);
- } else {
+ }
+ else {
jsr.hdr.email.t = mir_tstrdup(TEXT(""));
}
- ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) id, (LPARAM) &jsr);
+ ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&jsr);
found = 1;
mir_free(jsr.hdr.id.t);
mir_free(jsr.hdr.nick.t);
@@ -470,7 +481,7 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode)
mir_snprintf(jsr.jid, "%s@%s", proto->searchJID, dbv.pszVal);
jsr.hdr.nick.t = jsr.hdr.firstName.t = jsr.hdr.lastName.t = jsr.hdr.email.t = jsr.hdr.id.t = TEXT("");
- ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) id, (LPARAM) &jsr);
+ ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&jsr);
}
mir_free(proto->searchJID);
proto->searchJID = NULL;
@@ -482,13 +493,14 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode)
found = TlenRunSearch(proto);
}
if (!found) {
- ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE) id, 0);
+ ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
- } else if (!mir_strcmp(type, "error")) {
+ }
+ else if (!mir_strcmp(type, "error")) {
// ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE) id, 0);
// There is no ACKRESULT_FAILED for ACKTYPE_SEARCH :) look at findadd.c
// So we will just send a SUCCESS
- ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE) id, 0);
+ ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
}
@@ -500,7 +512,8 @@ void GetConfigItem(XmlNode *node, char *dest, BOOL bMethod, int *methodDest) {
char *method = TlenXmlGetAttrValue(node, "method");
if (method != NULL && !strcmpi(method, "POST")) {
*methodDest = REQUEST_POST;
- } else {
+ }
+ else {
*methodDest = REQUEST_GET;
}
}
@@ -510,33 +523,33 @@ void TlenIqResultTcfg(TlenProtocol *proto, XmlNode *iqNode)
{
XmlNode *queryNode, *miniMailNode, *node;
- char *type=TlenXmlGetAttrValue(iqNode, "type");
+ char *type = TlenXmlGetAttrValue(iqNode, "type");
if (type == NULL) return;
if (!mir_strcmp(type, "result")) {
- if ((queryNode=TlenXmlGetChild(iqNode, "query")) == NULL) return;
- if ((miniMailNode=TlenXmlGetChild(queryNode, "mini-mail")) == NULL) return;
- if ((node=TlenXmlGetChild(miniMailNode, "base")) != NULL) {
+ if ((queryNode = TlenXmlGetChild(iqNode, "query")) == NULL) return;
+ if ((miniMailNode = TlenXmlGetChild(queryNode, "mini-mail")) == NULL) return;
+ if ((node = TlenXmlGetChild(miniMailNode, "base")) != NULL) {
GetConfigItem(node, proto->threadData->tlenConfig.mailBase, FALSE, NULL);
}
- if ((node=TlenXmlGetChild(miniMailNode, "msg")) != NULL) {
+ if ((node = TlenXmlGetChild(miniMailNode, "msg")) != NULL) {
GetConfigItem(node, proto->threadData->tlenConfig.mailMsg, TRUE, &proto->threadData->tlenConfig.mailMsgMthd);
}
- if ((node=TlenXmlGetChild(miniMailNode, "index")) != NULL) {
+ if ((node = TlenXmlGetChild(miniMailNode, "index")) != NULL) {
GetConfigItem(node, proto->threadData->tlenConfig.mailIndex, TRUE, &proto->threadData->tlenConfig.mailIndexMthd);
}
- if ((node=TlenXmlGetChild(miniMailNode, "login")) != NULL) {
+ if ((node = TlenXmlGetChild(miniMailNode, "login")) != NULL) {
GetConfigItem(node, proto->threadData->tlenConfig.mailLogin, TRUE, &proto->threadData->tlenConfig.mailLoginMthd);
}
- if ((node=TlenXmlGetChild(miniMailNode, "compose")) != NULL) {
+ if ((node = TlenXmlGetChild(miniMailNode, "compose")) != NULL) {
GetConfigItem(node, proto->threadData->tlenConfig.mailCompose, TRUE, &proto->threadData->tlenConfig.mailComposeMthd);
}
- if ((node=TlenXmlGetChild(miniMailNode, "avatar-get")) != NULL) {
+ if ((node = TlenXmlGetChild(miniMailNode, "avatar-get")) != NULL) {
GetConfigItem(node, proto->threadData->tlenConfig.avatarGet, TRUE, &proto->threadData->tlenConfig.avatarGetMthd);
}
- if ((node=TlenXmlGetChild(miniMailNode, "avatar-upload")) != NULL) {
+ if ((node = TlenXmlGetChild(miniMailNode, "avatar-upload")) != NULL) {
GetConfigItem(node, proto->threadData->tlenConfig.avatarUpload, TRUE, &proto->threadData->tlenConfig.avatarUploadMthd);
}
- if ((node=TlenXmlGetChild(miniMailNode, "avatar-remove")) != NULL) {
+ if ((node = TlenXmlGetChild(miniMailNode, "avatar-remove")) != NULL) {
GetConfigItem(node, proto->threadData->tlenConfig.avatarRemove, TRUE, &proto->threadData->tlenConfig.avatarRemoveMthd);
}
}
@@ -547,30 +560,32 @@ void TlenIqResultVersion(TlenProtocol *proto, XmlNode *iqNode)
XmlNode *queryNode = TlenXmlGetChild(iqNode, "query");
if (queryNode != NULL) {
char *from = TlenXmlGetAttrValue(iqNode, "from");
- if (from != NULL ) {
+ if (from != NULL) {
TLEN_LIST_ITEM *item = TlenListGetItemPtr(proto, LIST_ROSTER, from);
if (item != NULL) {
XmlNode *n;
- if ( item->software ) mir_free( item->software );
- if ( item->version ) mir_free( item->version );
- if ( item->system ) mir_free( item->system );
- if (( n=TlenXmlGetChild( queryNode, "name" )) != NULL && n->text ) {
- item->software = TlenTextDecode( n->text );
- } else
+ if (item->software) mir_free(item->software);
+ if (item->version) mir_free(item->version);
+ if (item->system) mir_free(item->system);
+ if ((n = TlenXmlGetChild(queryNode, "name")) != NULL && n->text) {
+ item->software = TlenTextDecode(n->text);
+ }
+ else
item->software = NULL;
- if (( n=TlenXmlGetChild( queryNode, "version" )) != NULL && n->text )
- item->version = TlenTextDecode( n->text );
+ if ((n = TlenXmlGetChild(queryNode, "version")) != NULL && n->text)
+ item->version = TlenTextDecode(n->text);
else
item->version = NULL;
- if (( n=TlenXmlGetChild( queryNode, "os" )) != NULL && n->text )
- item->system = TlenTextDecode( n->text );
+ if ((n = TlenXmlGetChild(queryNode, "os")) != NULL && n->text)
+ item->system = TlenTextDecode(n->text);
else
item->system = NULL;
MCONTACT hContact = TlenHContactFromJID(proto, item->jid);
if (hContact != NULL) {
if (item->software != NULL) {
db_set_s(hContact, proto->m_szModuleName, "MirVer", item->software);
- } else {
+ }
+ else {
db_unset(hContact, proto->m_szModuleName, "MirVer");
}
}
@@ -583,14 +598,14 @@ void TlenIqResultInfo(TlenProtocol *proto, XmlNode *iqNode)
{
XmlNode *queryNode = TlenXmlGetChild(iqNode, "query");
if (queryNode != NULL) {
- char *from=TlenXmlGetAttrValue(queryNode, "from");
- if (from != NULL ) {
- TLEN_LIST_ITEM *item=TlenListGetItemPtr(proto, LIST_ROSTER, from);
+ char *from = TlenXmlGetAttrValue(queryNode, "from");
+ if (from != NULL) {
+ TLEN_LIST_ITEM *item = TlenListGetItemPtr(proto, LIST_ROSTER, from);
if (item != NULL) {
XmlNode *version = TlenXmlGetChild(queryNode, "version");
if (version != NULL) {
item->protocolVersion = TlenTextDecode(version->text);
- MCONTACT hContact=TlenHContactFromJID(proto, item->jid);
+ MCONTACT hContact = TlenHContactFromJID(proto, item->jid);
if (hContact != NULL) {
if (item->software == NULL) {
char str[128];