diff options
Diffstat (limited to 'protocols/JabberG')
43 files changed, 452 insertions, 545 deletions
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index c2575a619b..45ab1ce110 100644 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.cpp @@ -42,7 +42,7 @@ HINSTANCE hInst; int hLangpack;
int g_cbCountries;
-struct CountryListEntry* g_countries;
+CountryListEntry *g_countries;
TCHAR szCoreVersion[100];
diff --git a/protocols/JabberG/src/jabber.h b/protocols/JabberG/src/jabber.h index 3ff45594ca..b5fac3160b 100644 --- a/protocols/JabberG/src/jabber.h +++ b/protocols/JabberG/src/jabber.h @@ -389,11 +389,11 @@ struct ThreadData struct JABBER_MODEMSGS
{
- TCHAR* szOnline;
- TCHAR* szAway;
- TCHAR* szNa;
- TCHAR* szDnd;
- TCHAR* szFreechat;
+ TCHAR *szOnline;
+ TCHAR *szAway;
+ TCHAR *szNa;
+ TCHAR *szDnd;
+ TCHAR *szFreechat;
};
struct JABBER_REG_ACCOUNT
@@ -424,10 +424,10 @@ struct filetransfer JABBER_FT_TYPE type;
JABBER_SOCKET s;
JABBER_FILE_STATE state;
- TCHAR* jid;
+ TCHAR *jid;
int fileId;
- TCHAR* iqId;
- TCHAR* sid;
+ TCHAR *iqId;
+ TCHAR *sid;
int bCompleted;
HANDLE hWaitEvent;
@@ -439,7 +439,7 @@ struct filetransfer // Used by file receiving only
char* httpHostName;
WORD httpPort;
- TCHAR* httpPath;
+ TCHAR *httpPath;
unsigned __int64 dwExpectedRecvFileSize;
// Used by file sending only
@@ -486,11 +486,11 @@ struct JABBER_MUC_JIDLIST_INFO ~JABBER_MUC_JIDLIST_INFO();
JABBER_MUC_JIDLIST_TYPE type;
- TCHAR* roomJid; // filled-in by the WM_JABBER_REFRESH code
+ TCHAR *roomJid; // filled-in by the WM_JABBER_REFRESH code
HXML iqNode;
CJabberProto *ppro;
- TCHAR* type2str(void) const;
+ TCHAR *type2str(void) const;
};
typedef void (CJabberProto::*JABBER_FORM_SUBMIT_FUNC)(HXML values, void *userdata);
@@ -674,8 +674,8 @@ TCHAR* UnEscapeChatTags(TCHAR* str_in); struct CJabberAdhocStartupParams
{
- TCHAR* m_szJid;
- TCHAR* m_szNode;
+ TCHAR *m_szJid;
+ TCHAR *m_szNode;
CJabberProto* m_pProto;
CJabberAdhocStartupParams(CJabberProto* proto, TCHAR* szJid, TCHAR* szNode = NULL)
@@ -702,7 +702,7 @@ struct JabberAdHocData RECT frameRect;
HXML AdHocNode;
HXML CommandsNode;
- TCHAR* ResponderJID;
+ TCHAR *ResponderJID;
};
//---- jabber_util.cpp ------------------------------------------------------------------
@@ -744,9 +744,11 @@ char* __stdcall JabberBase64DecodeW(const WCHAR* buffer, int *resultLen) 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 JabberGetPictureType(const char* buf);
int __stdcall JabberGetPacketID(HXML n);
+int __stdcall JabberGetPictureType(const char* buf);
+LPCTSTR __stdcall JabberGetPictureType(HXML node, const char *picBuf);
+
TCHAR* time2str(time_t _time, TCHAR *buf, size_t bufLen);
time_t str2time(const TCHAR*);
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp index 8f75503737..6ccf1e1e3e 100644 --- a/protocols/JabberG/src/jabber_adhoc.cpp +++ b/protocols/JabberG/src/jabber_adhoc.cpp @@ -225,7 +225,7 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA if ((type = xmlGetAttrValue(workNode, _T("type"))) == NULL) return TRUE;
if ( !lstrcmp(type, _T("result"))) {
// wParam = <iq/> node from responder as a result of command execution
- HXML commandNode, xNode, n;
+ HXML commandNode, xNode;
if ((commandNode = xmlGetChild(dat->AdHocNode, _T("command"))) == NULL)
return TRUE;
@@ -236,10 +236,10 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA // use jabber:x:data form
HWND hFrame = GetDlgItem(hwndDlg, IDC_FRAME);
ShowWindow(GetDlgItem(hwndDlg, IDC_FRAME_TEXT), SW_HIDE);
- if ((n = xmlGetChild(xNode , "instructions")) != NULL && xmlGetText(n)!=NULL)
- JabberFormSetInstruction(hwndDlg, xmlGetText(n));
- else if ((n = xmlGetChild(xNode , "title")) != NULL && xmlGetText(n)!=NULL)
- JabberFormSetInstruction(hwndDlg, xmlGetText(n));
+ if (LPCTSTR ptszInstr = xmlGetText( xmlGetChild(xNode , "instructions")))
+ JabberFormSetInstruction(hwndDlg, ptszInstr);
+ else if (LPCTSTR ptszTitle = xmlGetText( xmlGetChild(xNode , "title")))
+ JabberFormSetInstruction(hwndDlg, ptszTitle);
else
JabberFormSetInstruction(hwndDlg, TranslateTS(status));
JabberFormCreateUI(hFrame, xNode, &dat->CurrentHeight);
@@ -250,20 +250,16 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA int toHide[]={ IDC_FRAME_TEXT, IDC_FRAME, IDC_VSCROLL, 0};
sttShowControls(hwndDlg, FALSE, toHide);
- const TCHAR * noteText=NULL;
- HXML noteNode = xmlGetChild(commandNode , "note");
- if (noteNode)
- noteText = xmlGetText(noteNode);
-
+ LPCTSTR noteText = xmlGetText( xmlGetChild(commandNode, "note"));
JabberFormSetInstruction(hwndDlg, noteText ? noteText : TranslateTS(status));
}
//check actions
HXML actionsNode = xmlGetChild(commandNode , "actions");
if (actionsNode != NULL) {
- ShowDlgItem(hwndDlg, IDC_PREV, (xmlGetChild(actionsNode , "prev")!=NULL) ? SW_SHOW : SW_HIDE);
- ShowDlgItem(hwndDlg, IDC_NEXT, (xmlGetChild(actionsNode , "next")!=NULL) ? SW_SHOW : SW_HIDE);
- ShowDlgItem(hwndDlg, IDC_COMPLETE, (xmlGetChild(actionsNode , "complete")!=NULL) ? SW_SHOW : SW_HIDE);
+ ShowDlgItem(hwndDlg, IDC_PREV, (xmlGetChild(actionsNode , "prev") != NULL) ? SW_SHOW : SW_HIDE);
+ ShowDlgItem(hwndDlg, IDC_NEXT, (xmlGetChild(actionsNode , "next") != NULL) ? SW_SHOW : SW_HIDE);
+ ShowDlgItem(hwndDlg, IDC_COMPLETE, (xmlGetChild(actionsNode , "complete") != NULL) ? SW_SHOW : SW_HIDE);
ShowDlgItem(hwndDlg, IDC_SUBMIT, SW_HIDE);
int toEnable[]={ IDC_PREV, IDC_NEXT, IDC_COMPLETE, 0};
diff --git a/protocols/JabberG/src/jabber_agent.cpp b/protocols/JabberG/src/jabber_agent.cpp index 39ec5f7872..c448cee0c7 100644 --- a/protocols/JabberG/src/jabber_agent.cpp +++ b/protocols/JabberG/src/jabber_agent.cpp @@ -79,7 +79,7 @@ class CAgentRegDlg : public CJabberDlgBase int m_formHeight, m_frameHeight;
RECT m_frameRect;
HXML m_agentRegIqNode;
- TCHAR* m_jid;
+ TCHAR *m_jid;
CCtrlButton m_submit;
@@ -152,9 +152,8 @@ public: if ((xNode=xmlGetChild(queryNode , "x")) != NULL) {
// use new jabber:x:data form
- HXML n = xmlGetChild(xNode , "instructions");
- if (n != NULL && xmlGetText(n)!=NULL)
- JabberFormSetInstruction(m_hwnd, xmlGetText(n));
+ if (LPCTSTR ptszInstr = xmlGetText( xmlGetChild(xNode, "instructions")))
+ JabberFormSetInstruction(m_hwnd, ptszInstr);
JabberFormCreateUI(hFrame, xNode, &m_formHeight /*dummy*/);
}
@@ -163,7 +162,7 @@ public: HJFORMLAYOUT layout_info = JabberFormCreateLayout(hFrame);
for (int i=0; ; i++) {
HXML n = xmlGetChild(queryNode ,i);
- if ( !n)
+ if (n == NULL)
break;
if (xmlGetName(n)) {
diff --git a/protocols/JabberG/src/jabber_bookmarks.cpp b/protocols/JabberG/src/jabber_bookmarks.cpp index edc14e833d..f7cb896d58 100644 --- a/protocols/JabberG/src/jabber_bookmarks.cpp +++ b/protocols/JabberG/src/jabber_bookmarks.cpp @@ -109,7 +109,7 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM case IDOK:
{
GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, SIZEOF(text));
- TCHAR* roomJID = NEWTSTR_ALLOCA(text);
+ TCHAR *roomJID = NEWTSTR_ALLOCA(text);
if (param->m_item)
param->ppro->ListRemove(LIST_BOOKMARK, param->m_item->jid);
@@ -356,7 +356,7 @@ void CJabberDlgBookmarks::OpenBookmark() if (item->nick && *item->nick)
m_proto->GroupchatJoinRoom(server, room, item->nick, item->password);
else {
- TCHAR* nick = JabberNickFromJID(m_proto->m_szJabberJID);
+ TCHAR *nick = JabberNickFromJID(m_proto->m_szJabberJID);
m_proto->GroupchatJoinRoom(server, room, nick, item->password);
mir_free(nick);
}
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp index 67492ecb3d..c34bf5494f 100644 --- a/protocols/JabberG/src/jabber_byte.cpp +++ b/protocols/JabberG/src/jabber_byte.cpp @@ -145,7 +145,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) DBVARIANT dbv;
TCHAR szPort[8];
HANDLE hEvent = NULL;
- TCHAR* proxyJid;
+ TCHAR *proxyJid;
CJabberIqInfo* pInfo = NULL;
int nIqId = 0;
@@ -625,14 +625,14 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt) sid = xmlGetAttrValue(queryNode, _T("sid"));
}
- if (szId && from && to && sid && (n = xmlGetChild(queryNode , "streamhost"))!=NULL) {
+ if (szId && from && to && sid && (n = xmlGetChild(queryNode , "streamhost")) != NULL) {
jbt->iqId = mir_tstrdup(szId);
jbt->srcJID = mir_tstrdup(from);
jbt->dstJID = mir_tstrdup(to);
jbt->sid = mir_tstrdup(sid);
if ((buffer=(char*)mir_alloc(JABBER_NETWORK_BUFFER_SIZE))) {
- for (i=1; (n = xmlGetNthChild(queryNode, _T("streamhost"), i))!=NULL; i++) {
+ for (i=1; (n = xmlGetNthChild(queryNode, _T("streamhost"), i)) != NULL; i++) {
if ((szHost = xmlGetAttrValue(n, _T("host"))) != NULL &&
(szPort = xmlGetAttrValue(n, _T("port"))) != NULL &&
(str = xmlGetAttrValue(n, _T("jid"))) != NULL) {
diff --git a/protocols/JabberG/src/jabber_byte.h b/protocols/JabberG/src/jabber_byte.h index 95f50f40a7..e03b4bc636 100644 --- a/protocols/JabberG/src/jabber_byte.h +++ b/protocols/JabberG/src/jabber_byte.h @@ -34,11 +34,11 @@ struct JABBER_BYTE_TRANSFER {
~JABBER_BYTE_TRANSFER();
- TCHAR* sid;
- TCHAR* srcJID;
- TCHAR* dstJID;
- TCHAR* streamhostJID;
- TCHAR* iqId;
+ TCHAR *sid;
+ TCHAR *srcJID;
+ TCHAR *dstJID;
+ TCHAR *streamhostJID;
+ TCHAR *iqId;
JABBER_BYTE_STATE state;
HANDLE hConn;
HANDLE hEvent;
@@ -51,10 +51,10 @@ struct JABBER_BYTE_TRANSFER // XEP-0065 proxy support
BOOL bProxyDiscovered;
HANDLE hProxyEvent;
- TCHAR* szProxyHost;
- TCHAR* szProxyPort;
- TCHAR* szProxyJid;
- TCHAR* szStreamhostUsed;
+ TCHAR *szProxyHost;
+ TCHAR *szProxyPort;
+ TCHAR *szProxyJid;
+ TCHAR *szStreamhostUsed;
BOOL bStreamActivated;
HANDLE hSendEvent;
};
diff --git a/protocols/JabberG/src/jabber_captcha.cpp b/protocols/JabberG/src/jabber_captcha.cpp index e27c09db27..dcb9d8c3b6 100644 --- a/protocols/JabberG/src/jabber_captcha.cpp +++ b/protocols/JabberG/src/jabber_captcha.cpp @@ -109,10 +109,9 @@ INT_PTR CALLBACK JabberCaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, return FALSE;
}
-bool CJabberProto::ProcessCaptcha (HXML node, HXML parentNode, ThreadData* info) {
+bool CJabberProto::ProcessCaptcha(HXML node, HXML parentNode, ThreadData* info)
+{
CAPTCHA_FORM_PARAMS param;
- char *ImageBuf = 0;
- const TCHAR *PicType = 0;
TCHAR *CaptchaPath = 0;
HXML x = xmlGetChildByTag(node, "x", "xmlns", JABBER_FEAT_DATA_FORMS);
@@ -143,12 +142,10 @@ bool CJabberProto::ProcessCaptcha (HXML node, HXML parentNode, ThreadData* info) if (o == NULL || xmlGetText(o) == NULL)
return false;
- GetCaptchaImage(parentNode, ImageBuf, PicType, CaptchaPath);
- char* p = mir_t2a(CaptchaPath);
- param.bmp = (HBITMAP) CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)p);
+ GetCaptchaImage(parentNode, CaptchaPath);
+ param.bmp = (HBITMAP) CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)CaptchaPath);
DeleteFile(CaptchaPath);
mir_free(CaptchaPath);
- mir_free(p);
BITMAP bmp = {0};
GetObject(param.bmp, sizeof(bmp), &bmp);
@@ -162,58 +159,34 @@ bool CJabberProto::ProcessCaptcha (HXML node, HXML parentNode, ThreadData* info) return true;
}
-void CJabberProto::GetCaptchaImage (HXML node, char *ImageBuf, const TCHAR *PicType, TCHAR*& CaptchaPath) {
+bool CJabberProto::GetCaptchaImage(HXML node, TCHAR*& CaptchaPath)
+{
HXML o = xmlGetChild(node , "data");
int bufferLen;
char* buffer = JabberBase64DecodeT(xmlGetText(o), &bufferLen);
if (buffer == NULL)
- return;
-
- const TCHAR *szPicType;
- HXML m = xmlGetChild(node , "TYPE");
- if (m == NULL || xmlGetText(m) == NULL) {
- LBL_NoTypeSpecified:
- switch(JabberGetPictureType(buffer)) {
- case PA_FORMAT_GIF: szPicType = _T("image/gif"); break;
- case PA_FORMAT_BMP: szPicType = _T("image/bmp"); break;
- case PA_FORMAT_PNG: szPicType = _T("image/png"); break;
- case PA_FORMAT_JPEG: szPicType = _T("image/jpeg"); break;
- default:
- goto LBL_Ret;
- }
- }
- else {
- const TCHAR *tszType = xmlGetText(m);
- if ( !_tcscmp(tszType, _T("image/jpeg")) ||
- !_tcscmp(tszType, _T("image/png")) ||
- !_tcscmp(tszType, _T("image/gif")) ||
- !_tcscmp(tszType, _T("image/bmp")))
- szPicType = tszType;
- else
- goto LBL_NoTypeSpecified;
- }
+ return false;
- DWORD nWritten;
+ const TCHAR *szPicType = JabberGetPictureType(node, buffer);
+ if (szPicType == NULL)
+ return false;
-LBL_Ret:
- TCHAR* ext = _tcsstr((TCHAR*)szPicType, _T("/"))+1;
+ TCHAR *ext = _tcsstr((TCHAR*)szPicType, _T("/"))+1;
TCHAR filename[MAX_PATH];
mir_sntprintf(filename, SIZEOF(filename), _T("%%TEMP%%\\captcha.%s"), ext);
CaptchaPath = Utils_ReplaceVarsT(filename);
HANDLE hFile = CreateFile(CaptchaPath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
- goto LBL_Ret;
-
- if ( !WriteFile(hFile, buffer, bufferLen, &nWritten, NULL))
- goto LBL_Ret;
+ return false;
+ DWORD nWritten;
+ bool res = WriteFile(hFile, buffer, bufferLen, &nWritten, NULL) != 0;
CloseHandle(hFile);
-
- ImageBuf = buffer;
- PicType = szPicType;
+ return res;
}
-void CJabberProto::sendCaptchaResult(TCHAR* buf, ThreadData* info, LPCTSTR from, LPCTSTR challenge, LPCTSTR fromjid, LPCTSTR sid){
+void CJabberProto::sendCaptchaResult(TCHAR* buf, ThreadData* info, LPCTSTR from, LPCTSTR challenge, LPCTSTR fromjid, LPCTSTR sid)
+{
XmlNodeIq iq(_T("set"), SerialNext());
HXML query= iq <<XATTR(_T("to"), from) << XCHILD(_T("captcha")) << XATTR(_T("xmlns"), _T("urn:xmpp:captcha")) << XCHILD (_T("x")) << XATTR(_T("xmlns"), JABBER_FEAT_DATA_FORMS) << XATTR(_T("type"), _T("submit"));
query << XCHILD(_T("field")) << XATTR (_T("var"), _T("FORM_TYPE")) << XCHILD(_T("value"), _T("urn:xmpp:captcha"));
@@ -224,7 +197,8 @@ void CJabberProto::sendCaptchaResult(TCHAR* buf, ThreadData* info, LPCTSTR from, info -> send (iq);
}
-void CJabberProto::sendCaptchaError(ThreadData* info, LPCTSTR from, LPCTSTR to, LPCTSTR challenge) {
+void CJabberProto::sendCaptchaError(ThreadData* info, LPCTSTR from, LPCTSTR to, LPCTSTR challenge)
+{
XmlNode message(_T("message"));
HXML query= message << XATTR(_T("type"), _T("error")) << XATTR(_T("to"), from) << XATTR(_T("id"), challenge) << XATTR(_T("from"), to)
<< XCHILD(_T("error")) << XATTR(_T("type"), _T("modify"))
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 0da8edb038..6057ed2dfd 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -126,7 +126,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) for (i = 0; i < SIZEOF(sttAffiliationItems); i++) sttAffiliationItems[i].translate();
for (i = 0; i < SIZEOF(sttRoleItems); i++) sttRoleItems[i].translate();
- TCHAR* szNick = JabberNickFromJID(item->jid);
+ TCHAR *szNick = JabberNickFromJID(item->jid);
GCSESSION gcw = { sizeof(GCSESSION) };
gcw.iType = GCW_CHATROOM;
@@ -276,18 +276,16 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, JABBER_RESOURCE_ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const TCHAR *resource, const TCHAR *nick, const TCHAR *jid, int action, HXML reason, int nStatusCode)
{
int statusToSet = 0;
- const TCHAR *szReason = NULL;
- if (reason != NULL && xmlGetText(reason) != NULL)
- szReason = xmlGetText(reason);
- if ( !szReason) {
+ const TCHAR *szReason = xmlGetText(reason);
+ if (szReason == NULL) {
if (nStatusCode == 322)
szReason = TranslateT("because room is now members-only");
else if (nStatusCode == 301)
szReason = TranslateT("user banned");
}
- TCHAR* myNick = (item->nick == NULL) ? NULL : mir_tstrdup(item->nick);
+ TCHAR *myNick = (item->nick == NULL) ? NULL : mir_tstrdup(item->nick);
if (myNick == NULL)
myNick = JabberNickFromJID(m_szJabberJID);
@@ -355,16 +353,12 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason) {
TCHAR *szMessage = NULL;
- const TCHAR *szReason = NULL;
- if (reason != NULL && xmlGetText(reason) != NULL)
- szReason = xmlGetText(reason);
-
GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL };
gcd.ptszID = item->jid;
GCEVENT gce = {0};
gce.cbSize = sizeof(GCEVENT);
gce.ptszUID = item->jid;
- gce.ptszText = szReason;
+ gce.ptszText = xmlGetText(reason);
gce.dwFlags = GC_TCHAR;
gce.pDest = &gcd;
@@ -380,7 +374,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason) else szMessage = TranslateTS(JABBER_GC_MSG_QUIT);
}
else {
- TCHAR* myNick = JabberNickFromJID(m_szJabberJID);
+ TCHAR *myNick = JabberNickFromJID(m_szJabberJID);
GcLogUpdateMemberStatus(item, myNick, myNick, NULL, GC_EVENT_KICK, reason);
mir_free(myNick);
CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
@@ -1495,7 +1489,7 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam) rtrimt(gch->ptszText);
if (m_bJabberOnline) {
- TCHAR* buf = NEWTSTR_ALLOCA(gch->ptszText);
+ TCHAR *buf = NEWTSTR_ALLOCA(gch->ptszText);
UnEscapeChatTags(buf);
m_ThreadInfo->send(
XmlNode(_T("message")) << XATTR(_T("to"), item->jid) << XATTR(_T("type"), _T("groupchat"))
@@ -1529,7 +1523,7 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam) void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, TCHAR* str , TCHAR* rsn)
{
const TCHAR *field = (jidListInfo->type == MUC_BANLIST || _tcschr(str,'@')) ? _T("jid") : _T("nick");
- TCHAR* roomJid = jidListInfo->roomJid;
+ TCHAR *roomJid = jidListInfo->roomJid;
if (jidListInfo->type == MUC_BANLIST) {
AdminSetReason(roomJid, JABBER_FEAT_MUC_ADMIN, field, str, _T("affiliation"), _T("outcast"), rsn);
AdminGet(roomJid, JABBER_FEAT_MUC_ADMIN, _T("affiliation"), _T("outcast"), &CJabberProto::OnIqResultMucGetBanList);
@@ -1538,7 +1532,7 @@ void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, TCHAR* s void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, TCHAR* str)
{
const TCHAR *field = (jidListInfo->type == MUC_BANLIST || _tcschr(str,'@')) ? _T("jid") : _T("nick");
- TCHAR* roomJid = jidListInfo->roomJid;
+ TCHAR *roomJid = jidListInfo->roomJid;
switch (jidListInfo->type) {
case MUC_VOICELIST:
@@ -1569,7 +1563,7 @@ void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, TCHAR* s void CJabberProto::DeleteMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, TCHAR* jid)
{
- TCHAR* roomJid = jidListInfo->roomJid;
+ TCHAR *roomJid = jidListInfo->roomJid;
switch (jidListInfo->type) {
case MUC_VOICELIST: // change role to visitor (from participant)
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 93168b7186..aa29ad9535 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -233,7 +233,7 @@ static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent) for (i = 0; i < xmlGetAttrCount(node); i++)
{
- TCHAR* attr = (TCHAR*)xmlGetAttrName(node, i);
+ TCHAR *attr = (TCHAR*)xmlGetAttrName(node, i);
sttAppendBufRaw(buf, " ");
sttAppendBufRaw(buf, RTF_BEGINATTRNAME);
sttAppendBufW(buf, attr);
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index ec85c64e51..ef850a1e73 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -194,7 +194,7 @@ void CJabberProto::OnIqResultServiceDiscoveryInfo(HXML iqNode, CJabberIqInfo* pI else {
if (pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR) {
HXML errorNode = xmlGetChild(iqNode , "error");
- TCHAR* str = JabberErrorMsg(errorNode);
+ TCHAR *str = JabberErrorMsg(errorNode);
pNode->SetInfoRequestErrorText(str);
mir_free(str);
}
@@ -237,7 +237,7 @@ void CJabberProto::OnIqResultServiceDiscoveryItems(HXML iqNode, CJabberIqInfo* p else {
if (pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR) {
HXML errorNode = xmlGetChild(iqNode , "error");
- TCHAR* str = JabberErrorMsg(errorNode);
+ TCHAR *str = JabberErrorMsg(errorNode);
pNode->SetItemsRequestErrorText(str);
mir_free(str);
}
@@ -404,7 +404,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) LISTFOREACH(i, this, LIST_ROSTER)
{
if ((item=ListGetItemPtrFromIndex(i)) != NULL) {
- if (_tcschr(item->jid, '@')==NULL && _tcschr(item->jid, '/')==NULL && item->subscription!=SUB_NONE) {
+ if (_tcschr(item->jid, '@') == NULL && _tcschr(item->jid, '/') == NULL && item->subscription!=SUB_NONE) {
HANDLE hContact = HContactFromJID(item->jid);
if (hContact != NULL)
setByte(hContact, "IsTransport", TRUE);
diff --git a/protocols/JabberG/src/jabber_disco.h b/protocols/JabberG/src/jabber_disco.h index efd9d453bf..31818912c3 100644 --- a/protocols/JabberG/src/jabber_disco.h +++ b/protocols/JabberG/src/jabber_disco.h @@ -56,15 +56,15 @@ public: if (m_pNext)
delete m_pNext;
}
- TCHAR* GetCategory()
+ TCHAR *GetCategory()
{
return m_szCategory;
}
- TCHAR* GetType()
+ TCHAR *GetType()
{
return m_szType;
}
- TCHAR* GetName()
+ TCHAR *GetName()
{
return m_szName;
}
@@ -98,7 +98,7 @@ public: if (m_pNext)
delete m_pNext;
}
- TCHAR* GetVar()
+ TCHAR *GetVar()
{
return m_szVar;
}
@@ -233,7 +233,7 @@ public: replaceStrT(m_szJid, szJid);
return TRUE;
}
- TCHAR* GetJid()
+ TCHAR *GetJid()
{
return m_szJid;
}
@@ -242,11 +242,11 @@ public: replaceStrT(m_szNode, szNode);
return TRUE;
}
- TCHAR* GetNode()
+ TCHAR *GetNode()
{
return m_szNode;
}
- TCHAR* GetName()
+ TCHAR *GetName()
{
return m_szName;
}
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index ecb18ef9e3..b93d983ff9 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -94,7 +94,7 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING* cws, HANDLE hCon if (item == NULL)
return;
- TCHAR* nick;
+ TCHAR *nick;
if ( !db_get_ts(hContact, "CList", "MyHandle", &dbv)) {
nick = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
@@ -137,7 +137,7 @@ void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING* cws, HANDLE hC return;
if (cws->value.type == DBVT_DELETED) {
- TCHAR* nick = pcli->pfnGetContactDisplayName(hContact, GCDNF_NOMYHANDLE);
+ TCHAR *nick = pcli->pfnGetContactDisplayName(hContact, GCDNF_NOMYHANDLE);
AddContactToRoster(item->jid, nick, item->group);
mir_free(nick);
return;
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index 159b0fae11..7136a23e1d 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -123,7 +123,7 @@ int CJabberProto::FileReceiveParse(filetransfer *ft, char* buffer, int datalen) }
else { // FT_INITIALIZING
if (str[0] == '\0') {
- TCHAR* s;
+ TCHAR *s;
if ((s = _tcsrchr(ft->httpPath, '/')) != NULL)
s++;
else
@@ -282,7 +282,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) JABBER_LIST_ITEM *item = ListAdd(LIST_FILE, szPort);
item->ft = ft;
- TCHAR* ptszResource = ListGetBestClientResourceNamePtr(ft->jid);
+ TCHAR *ptszResource = ListGetBestClientResourceNamePtr(ft->jid);
if (ptszResource != NULL) {
ft->state = FT_CONNECTING;
for (int i=0; i < ft->std.totalFiles && ft->state != FT_ERROR && ft->state != FT_DENIED; i++) {
@@ -297,7 +297,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) else
p = ft->std.ptszFiles[i];
- TCHAR* pFileName = JabberHttpUrlEncode(p);
+ TCHAR *pFileName = JabberHttpUrlEncode(p);
if (pFileName != NULL) {
int id = SerialNext();
if (ft->iqId) mir_free(ft->iqId);
@@ -321,7 +321,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) mir_free(myAddr);
int len = lstrlen(ptszResource) + lstrlen(ft->jid) + 2;
- TCHAR* fulljid = (TCHAR*)alloca(sizeof(TCHAR)*len);
+ TCHAR *fulljid = (TCHAR*)alloca(sizeof(TCHAR)*len);
wsprintf(fulljid, _T("%s/%s"), ft->jid, ptszResource);
XmlNodeIq iq(_T("set"), id, fulljid);
@@ -407,15 +407,15 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer, num += 2;
currentFile = ft->std.currentFileNumber;
- TCHAR* t = _tcsrchr(ft->std.ptszFiles[ currentFile ], '\\');
+ TCHAR *t = _tcsrchr(ft->std.ptszFiles[ currentFile ], '\\');
if (t != NULL)
t++;
else
t = ft->std.ptszFiles[currentFile];
- if (ft->httpPath==NULL || lstrcmp(ft->httpPath, t)) {
+ if (ft->httpPath == NULL || lstrcmp(ft->httpPath, t)) {
if (ft->httpPath == NULL)
- Log("Requested file name does not matched (httpPath==NULL)");
+ Log("Requested file name does not matched (httpPath == NULL)");
else
Log("Requested file name does not matched ('%s' vs. '%s')", ft->httpPath, t);
ft->state = FT_ERROR;
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp index 7dc680f5d0..a1aa699924 100644 --- a/protocols/JabberG/src/jabber_form.cpp +++ b/protocols/JabberG/src/jabber_form.cpp @@ -65,7 +65,7 @@ void JabberFormCenterContent(HWND hwndStatic) minX=rcWindow.right;
HWND oldChild=NULL;
HWND hWndChild=GetWindow(hwndStatic,GW_CHILD);
- while (hWndChild!=oldChild && hWndChild!=NULL)
+ while (hWndChild!=oldChild && hWndChild != NULL)
{
DWORD style=GetWindowLongPtr(hWndChild, GWL_STYLE);
RECT rc;
@@ -96,7 +96,7 @@ void JabberFormCenterContent(HWND hwndStatic) int dx=(minX-rcWindow.left)/2;
oldChild=NULL;
hWndChild=GetWindow(hwndStatic,GW_CHILD);
- while (hWndChild!=oldChild && hWndChild!=NULL)
+ while (hWndChild!=oldChild && hWndChild != NULL)
{
DWORD style=GetWindowLongPtr(hWndChild, GWL_STYLE);
RECT rc;
@@ -459,14 +459,14 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp {
JabberFormDestroyUI(hwndStatic);
- HXML v, o, vs;
+ HXML v, vs;
int i, j, k;
const TCHAR *label, *typeName, *varStr, *str, *valueText;
TCHAR *labelStr, *valueStr, *p;
RECT frameRect;
- if (xNode==NULL || xmlGetName(xNode)==NULL || lstrcmp(xmlGetName(xNode), _T("x")) || hwndStatic==NULL) return;
+ if (xNode == NULL || xmlGetName(xNode) == NULL || lstrcmp(xmlGetName(xNode), _T("x")) || hwndStatic == NULL) return;
GetClientRect(hwndStatic, &frameRect);
@@ -496,17 +496,14 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp TJabberFormControlType type = JabberFormTypeNameToId(typeName);
- if ((v = xmlGetChild(n , "value")) != NULL)
- {
+ if ((v = xmlGetChild(n, "value")) != NULL) {
valueText = xmlGetText(v);
if (type != JFORM_CTYPE_TEXT_MULTI)
- {
valueStr = mir_tstrdup(valueText);
- } else
- {
+ else {
size_t size = 1;
for (j=0; ; j++) {
- v = xmlGetChild(n ,j);
+ v = xmlGetChild(n,j);
if ( !v)
break;
if (xmlGetName(v) && !lstrcmp(xmlGetName(v), _T("value")) && xmlGetText(v))
@@ -515,7 +512,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp valueStr = (TCHAR*)mir_alloc(sizeof(TCHAR)*size);
valueStr[0] = '\0';
for (j=0; ; j++) {
- v = xmlGetChild(n ,j);
+ v = xmlGetChild(n,j);
if ( !v)
break;
if (xmlGetName(v) && !lstrcmp(xmlGetName(v), _T("value")) && xmlGetText(v)) {
@@ -524,21 +521,18 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp _tcscat(valueStr, xmlGetText(v));
} }
}
- } else
- {
- valueText = valueStr = NULL;
}
+ else valueText = valueStr = NULL;
TJabberFormControlInfo *item = JabberFormAppendControl(hwndStatic, &layout_info, type, labelStr, valueStr);
mir_free(labelStr);
mir_free(valueStr);
- if (type == JFORM_CTYPE_LIST_SINGLE)
- {
+ if (type == JFORM_CTYPE_LIST_SINGLE) {
for (j=0; ; j++) {
- o = xmlGetChild(n ,j);
- if ( !o)
+ HXML o = xmlGetChild(n,j);
+ if (o == NULL)
break;
if (xmlGetName(o) && !lstrcmp(xmlGetName(o), _T("option"))) {
if ((v = xmlGetChild(o , "value")) != NULL && xmlGetText(v)) {
@@ -551,12 +545,11 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp JabberFormAddListItem(item, p, selected);
mir_free(p);
} } } }
- } else
- if (type == JFORM_CTYPE_LIST_MULTI)
- {
+ }
+ else if (type == JFORM_CTYPE_LIST_MULTI) {
for (j=0; ; j++) {
- o = xmlGetChild(n ,j);
- if ( !o)
+ HXML o = xmlGetChild(n,j);
+ if (o == NULL)
break;
if (xmlGetName(o) && !lstrcmp(xmlGetName(o), _T("option"))) {
if ((v = xmlGetChild(o , "value")) != NULL && xmlGetText(v)) {
@@ -565,7 +558,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp if ((p = mir_tstrdup(str)) != NULL) {
bool selected = false;
for (k=0; ; k++) {
- vs = xmlGetChild(n ,k);
+ vs = xmlGetChild(n,k);
if ( !vs)
break;
if ( !lstrcmp(xmlGetName(vs), _T("value")) && xmlGetText(vs) && !_tcscmp(xmlGetText(vs), xmlGetText(v)))
@@ -584,8 +577,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp void JabberFormDestroyUI(HWND hwndStatic)
{
TJabberFormControlList *controls = (TJabberFormControlList *)GetWindowLongPtr(hwndStatic, GWLP_USERDATA);
- if (controls)
- {
+ if (controls) {
for (int i = 0; i < controls->getCount(); i++)
mir_free((*controls)[i]);
controls->destroy();
@@ -651,7 +643,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) GetDlgItemText(hFrame, id, str, len+1);
v = NULL;
for (j=0; ; j++) {
- o = xmlGetChild(n ,j);
+ o = xmlGetChild(n,j);
if ( !o)
break;
@@ -678,7 +670,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) if ((str = (TCHAR*)mir_alloc((len+1)*sizeof(TCHAR))) != NULL) {
SendMessage(hCtrl, LB_GETTEXT, j, (LPARAM)str);
for (k=0; ; k++) {
- o = xmlGetChild(n ,k);
+ o = xmlGetChild(n,k);
if ( !o)
break;
@@ -695,7 +687,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) id++;
}
else if ( !_tcscmp(type, _T("fixed")) || !_tcscmp(type, _T("hidden"))) {
- v = xmlGetChild(n , "value");
+ v = xmlGetChild(n, "value");
if (v != NULL && xmlGetText(v) != NULL)
field << XCHILD(_T("value"), xmlGetText(v));
}
@@ -742,12 +734,12 @@ static INT_PTR CALLBACK JabberFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, jfi = (JABBER_FORM_INFO *) lParam;
if (jfi != NULL) {
// Set dialog title
- if (jfi->xNode!=NULL && (n = xmlGetChild(jfi->xNode , "title")) != NULL && xmlGetText(n) != NULL)
+ if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode , "title")) != NULL && xmlGetText(n) != NULL)
SetWindowText(hwndDlg, xmlGetText(n));
else if (jfi->defTitle != NULL)
SetWindowText(hwndDlg, TranslateTS(jfi->defTitle));
// Set instruction field
- if (jfi->xNode!=NULL && (n = xmlGetChild(jfi->xNode , "instructions")) != NULL && xmlGetText(n) != NULL)
+ if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode , "instructions")) != NULL && xmlGetText(n) != NULL)
JabberFormSetInstruction(hwndDlg, xmlGetText(n));
else
{
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index bb73cc35ee..b3ae7a1beb 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -85,7 +85,7 @@ void CJabberProto::FtInitiate(TCHAR* jid, filetransfer *ft) int i;
TCHAR sid[9];
- if (jid==NULL || ft==NULL || !m_bJabberOnline || (rs=ListGetBestClientResourceNamePtr(jid))==NULL) {
+ if (jid == NULL || ft == NULL || !m_bJabberOnline || (rs=ListGetBestClientResourceNamePtr(jid)) == NULL) {
if (ft) {
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
delete ft;
@@ -142,7 +142,7 @@ void CJabberProto::OnFtSiResult(HXML iqNode, CJabberIqInfo* pInfo) if ((featureNode = xmlGetChild(siNode , "feature")) != NULL) {
if ((xNode = xmlGetChildByTag(featureNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS)) != NULL) {
if ((fieldNode = xmlGetChildByTag(xNode, "field", "var", _T("stream-method"))) != NULL) {
- if ((valueNode = xmlGetChild(fieldNode , "value"))!=NULL && xmlGetText(valueNode)!=NULL) {
+ if ((valueNode = xmlGetChild(fieldNode , "value")) != NULL && xmlGetText(valueNode) != NULL) {
if ((bDirect || bProxy) && !_tcscmp(xmlGetText(valueNode), JABBER_FEAT_BYTESTREAMS)) {
// Start Bytestream session
JABBER_BYTE_TRANSFER *jbt = new JABBER_BYTE_TRANSFER;
@@ -317,7 +317,7 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) filesize = _ttoi64(str);
if ((featureNode = xmlGetChildByTag(siNode, "feature", "xmlns", JABBER_FEAT_FEATURE_NEG)) != NULL &&
(xNode = xmlGetChildByTag(featureNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS)) != NULL &&
- (fieldNode = xmlGetChildByTag(xNode, "field", "var", _T("stream-method")))!=NULL) {
+ (fieldNode = xmlGetChildByTag(xNode, "field", "var", _T("stream-method"))) != NULL) {
BOOL bIbbOnly = m_options.BsOnlyIBB;
HXML optionNode = NULL;
@@ -395,7 +395,7 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) void CJabberProto::FtAcceptSiRequest(filetransfer *ft)
{
- if ( !m_bJabberOnline || ft==NULL || ft->jid==NULL || ft->sid==NULL) return;
+ if ( !m_bJabberOnline || ft == NULL || ft->jid == NULL || ft->sid == NULL) return;
JABBER_LIST_ITEM *item;
if ((item=ListAdd(LIST_FTRECV, ft->sid)) != NULL) {
@@ -412,7 +412,7 @@ void CJabberProto::FtAcceptSiRequest(filetransfer *ft) void CJabberProto::FtAcceptIbbRequest(filetransfer *ft)
{
- if ( !m_bJabberOnline || ft==NULL || ft->jid==NULL || ft->sid==NULL) return;
+ if ( !m_bJabberOnline || ft == NULL || ft->jid == NULL || ft->sid == NULL) return;
JABBER_LIST_ITEM *item;
if ((item=ListAdd(LIST_FTRECV, ft->sid)) != NULL) {
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 5dc517a445..03ccab63c9 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -394,7 +394,7 @@ void CJabberProto::OnIqResultDiscovery(HXML iqNode, CJabberIqInfo *pInfo) if (pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR)
{
HXML errorNode = xmlGetChild(iqNode , "error");
- TCHAR* str = JabberErrorMsg(errorNode);
+ TCHAR *str = JabberErrorMsg(errorNode);
sttRoomListAppend(hwndList, RoomInfo::ROOM_FAIL,
TranslateT("Jabber Error"),
str,
@@ -500,7 +500,7 @@ void CJabberDlgGcJoin::OnInitDialog() db_free(&dbv);
}
else {
- TCHAR* nick = JabberNickFromJID(m_proto->m_szJabberJID);
+ TCHAR *nick = JabberNickFromJID(m_proto->m_szJabberJID);
SetDlgItemText(m_hwnd, IDC_NICK, nick);
mir_free(nick);
}
@@ -771,7 +771,7 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case IDOK:
{
GetDlgItemText(m_hwnd, IDC_SERVER, text, SIZEOF(text));
- TCHAR* server = NEWTSTR_ALLOCA(text), *room;
+ TCHAR *server = NEWTSTR_ALLOCA(text), *room;
m_proto->ComboAddRecentString(m_hwnd, IDC_SERVER, "joinWnd_rcSvr", server);
@@ -779,10 +779,10 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) room = NEWTSTR_ALLOCA(text);
GetDlgItemText(m_hwnd, IDC_NICK, text, SIZEOF(text));
- TCHAR* nick = NEWTSTR_ALLOCA(text);
+ TCHAR *nick = NEWTSTR_ALLOCA(text);
GetDlgItemText(m_hwnd, IDC_PASSWORD, text, SIZEOF(text));
- TCHAR* password = NEWTSTR_ALLOCA(text);
+ TCHAR *password = NEWTSTR_ALLOCA(text);
m_proto->GroupchatJoinRoom(server, room, nick, password);
}
// fall through
@@ -825,7 +825,7 @@ struct JabberGroupchatChangeNicknameParam }
CJabberProto *ppro;
- TCHAR* jid;
+ TCHAR *jid;
};
static VOID CALLBACK JabberGroupchatChangeNickname(void* arg)
@@ -840,7 +840,7 @@ static VOID CALLBACK JabberGroupchatChangeNickname(void* arg) TCHAR szCaption[ 1024 ];
szBuffer[ 0 ] = _T('\0');
- TCHAR* roomName = item->name ? item->name : item->jid;
+ TCHAR *roomName = item->name ? item->name : item->jid;
mir_sntprintf(szCaption, SIZEOF(szCaption), _T("%s <%s>"), TranslateT("Change nickname in"), roomName);
if (item->nick)
mir_sntprintf(szBuffer, SIZEOF(szBuffer), _T("%s"), item->nick);
@@ -931,7 +931,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) if (nNode == NULL)
nNode = xmlGetChildByTag(node, "nick:nick", "xmlns:nick", JABBER_FEAT_NICK);
- const TCHAR *cnick = nNode ? xmlGetText(nNode) : NULL;
+ const TCHAR *cnick = xmlGetText(nNode);
const TCHAR *nick = cnick ? cnick : (r && r->nick ? r->nick : resource);
// process custom nick change
@@ -947,7 +947,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) // entering room or a usual room presence
if (type == NULL || !_tcscmp(type, _T("available"))) {
- TCHAR* room = JabberNickFromJID(from);
+ TCHAR *room = JabberNickFromJID(from);
if (room == NULL)
return;
@@ -1158,7 +1158,6 @@ void CJabberProto::GroupchatProcessMessage(HXML node) if ((n = xmlGetChild(node , "subject")) != NULL) {
msgText = xmlGetText(n);
-
if (msgText == NULL || msgText[0] == '\0')
return;
@@ -1184,7 +1183,6 @@ void CJabberProto::GroupchatProcessMessage(HXML node) return;
msgText = xmlGetText(n);
-
if (msgText == NULL)
return;
@@ -1215,11 +1213,9 @@ void CJabberProto::GroupchatProcessMessage(HXML node) JABBER_RESOURCE_STATUS *r = GcFindResource(item, resource);
nick = r && r->nick ? r->nick : resource;
}
- else
- nick = NULL;
+ else nick = NULL;
- GCEVENT gce = {0};
- gce.cbSize = sizeof(GCEVENT);
+ GCEVENT gce = { sizeof(GCEVENT) };
gce.pDest = &gcd;
gce.ptszUID = resource;
gce.ptszNick = nick;
@@ -1278,7 +1274,7 @@ public: if (m_info->reason != NULL)
SetDlgItemText(m_hwnd, IDC_REASON, m_info->reason);
- TCHAR* myNick = JabberNickFromJID(m_proto->m_szJabberJID);
+ TCHAR *myNick = JabberNickFromJID(m_proto->m_szJabberJID);
SetDlgItemText(m_hwnd, IDC_NICK, myNick);
mir_free(myNick);
@@ -1324,7 +1320,7 @@ void CJabberProto::GroupchatProcessInvite(const TCHAR *roomJid, const TCHAR *fro ForkThread((MyThreadFunc)&CJabberProto::GroupchatInviteAcceptThread, inviteInfo);
}
else {
- TCHAR* myNick = JabberNickFromJID(m_szJabberJID);
+ TCHAR *myNick = JabberNickFromJID(m_szJabberJID);
AcceptGroupchatInvite(roomJid, myNick, password);
mir_free(myNick);
} }
diff --git a/protocols/JabberG/src/jabber_ibb.h b/protocols/JabberG/src/jabber_ibb.h index 8cd33ddc1c..2778a6f3c3 100644 --- a/protocols/JabberG/src/jabber_ibb.h +++ b/protocols/JabberG/src/jabber_ibb.h @@ -28,9 +28,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef enum { JIBB_INIT, JIBB_CONNECT, JIBB_SENDING, JIBB_RECVING, JIBB_DONE, JIBB_ERROR } JABBER_IBB_STATE;
typedef struct {
- TCHAR* sid;
- TCHAR* srcJID;
- TCHAR* dstJID;
+ TCHAR *sid;
+ TCHAR *srcJID;
+ TCHAR *dstJID;
unsigned __int64 dwTransferredSize;
JABBER_IBB_STATE state;
HANDLE hEvent;
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index c30a57cfe4..43559692f2 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -41,7 +41,7 @@ HIMAGELIST hAdvancedStatusIcon = NULL; struct CTransportProtoTableItem
{
- TCHAR* mask;
+ TCHAR *mask;
char* proto;
};
@@ -234,7 +234,7 @@ static BOOL MatchMask(const TCHAR *name, const TCHAR *mask) if (*mask != '|')
return WildComparei(name, mask);
- TCHAR* temp = NEWTSTR_ALLOCA(mask);
+ TCHAR *temp = NEWTSTR_ALLOCA(mask);
for (int e=1; mask[e] != '\0'; e++) {
int s = e;
while (mask[e] != '\0' && mask[e] != '|')
@@ -259,13 +259,13 @@ static HICON ExtractIconFromPath(const char *path, BOOL * needFree) HICON hIcon;
lstrcpynA(file,path,sizeof(file));
comma=strrchr(file,',');
- if (comma==NULL) n=0;
+ if (comma == NULL) n=0;
else {n=atoi(comma+1); *comma=0;}
PathToAbsolute(file, fileFull);
hIcon=NULL;
ExtractIconExA(fileFull,n,NULL,&hIcon,1);
if (needFree)
- *needFree=(hIcon!=NULL);
+ *needFree=(hIcon != NULL);
return hIcon;
}
@@ -277,7 +277,7 @@ static HICON LoadTransportIcon(char *filename,int i,char *IconName,TCHAR *SectNa if (needFree) *needFree=FALSE;
GetModuleFileNameA(NULL, szPath, MAX_PATH);
str=strrchr(szPath,'\\');
- if (str!=NULL) *str=0;
+ if (str != NULL) *str=0;
_snprintf(szMyPath, sizeof(szMyPath), "%s\\Icons\\%s", szPath, filename);
_snprintf(szFullPath, sizeof(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i);
BOOL nf;
@@ -427,15 +427,15 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR *jid, HANDLE hContact return FALSE;
// strip domain part from jid
- TCHAR* domain = _tcschr((TCHAR*)jid, '@');
+ TCHAR *domain = _tcschr((TCHAR*)jid, '@');
BOOL isAgent = (domain == NULL) ? TRUE : FALSE;
BOOL isTransported = FALSE;
- if (domain!=NULL)
+ if (domain != NULL)
domain = NEWTSTR_ALLOCA(domain+1);
else
domain = NEWTSTR_ALLOCA(jid);
- TCHAR* resourcepos = _tcschr(domain, '/');
+ TCHAR *resourcepos = _tcschr(domain, '/');
if (resourcepos != NULL)
*resourcepos = '\0';
diff --git a/protocols/JabberG/src/jabber_iq.h b/protocols/JabberG/src/jabber_iq.h index 5b82e9afb1..9cd3937d0a 100644 --- a/protocols/JabberG/src/jabber_iq.h +++ b/protocols/JabberG/src/jabber_iq.h @@ -52,7 +52,7 @@ typedef void (CJabberProto::*JABBER_IQ_PFUNC)(HXML iqNode); typedef void (*IQ_USER_DATA_FREE_FUNC)(void *pUserData);
typedef struct {
- TCHAR* xmlns;
+ TCHAR *xmlns;
JABBER_IQ_PFUNC func;
BOOL allowSubNs; // e.g. #info in disco#info
} JABBER_IQ_XMLNS_FUNC;
@@ -185,8 +185,8 @@ class CJabberIqPermanentInfo JABBER_PERMANENT_IQ_HANDLER m_pHandler;
DWORD m_dwParamsToParse;
int m_nIqTypes;
- TCHAR* m_szXmlns;
- TCHAR* m_szTag;
+ TCHAR *m_szXmlns;
+ TCHAR *m_szTag;
BOOL m_bAllowPartialNs;
void *m_pUserData;
IQ_USER_DATA_FREE_FUNC m_pUserDataFree;
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index 962c864237..cd16f466a9 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -477,7 +477,7 @@ BOOL CJabberProto::OnIqRequestAvatar(HXML, CJabberIqInfo *pInfo) if (pictureType == PA_FORMAT_UNKNOWN)
return TRUE;
- TCHAR* szMimeType;
+ TCHAR *szMimeType;
switch(pictureType) {
case PA_FORMAT_JPEG: szMimeType = _T("image/jpeg"); break;
case PA_FORMAT_GIF: szMimeType = _T("image/gif"); break;
@@ -532,17 +532,17 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) // RFC 3921 #7.2 Business Rules
if (pInfo->GetFrom()) {
- TCHAR* szFrom = JabberPrepareJid(pInfo->GetFrom());
+ TCHAR *szFrom = JabberPrepareJid(pInfo->GetFrom());
if ( !szFrom)
return TRUE;
- TCHAR* szTo = JabberPrepareJid(m_ThreadInfo->fullJID);
+ TCHAR *szTo = JabberPrepareJid(m_ThreadInfo->fullJID);
if ( !szTo) {
mir_free(szFrom);
return TRUE;
}
- TCHAR* pDelimiter = _tcschr(szFrom, _T('/'));
+ TCHAR *pDelimiter = _tcschr(szFrom, _T('/'));
if (pDelimiter) *pDelimiter = _T('\0');
pDelimiter = _tcschr(szTo, _T('/'));
@@ -563,7 +563,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) JABBER_LIST_ITEM *item;
HANDLE hContact = NULL;
const TCHAR *jid, *str, *name;
- TCHAR* nick;
+ TCHAR *nick;
Log("<iq/> Got roster push, query has %d children", xmlGetChildCount(queryNode));
for (int i=0; ; i++) {
@@ -590,7 +590,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) replaceStrT(item->nick, nick);
HXML groupNode = xmlGetChild(itemNode , "group");
- replaceStrT(item->group, (groupNode) ? xmlGetText(groupNode) : NULL);
+ replaceStrT(item->group, xmlGetText(groupNode));
if ((hContact=HContactFromJID(jid, 0)) == NULL) {
// Received roster has a new JID.
@@ -699,13 +699,13 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) ft->iqId = mir_tstrdup(pInfo->GetIdStr());
if (ft->httpHostName && ft->httpPath) {
- TCHAR* desc = NULL;
+ TCHAR *desc = NULL;
Log("Host=%s Port=%d Path=%s", ft->httpHostName, ft->httpPort, ft->httpPath);
if ((n = xmlGetChild(pInfo->GetChildNode(), "desc")) != NULL)
desc = (TCHAR*)xmlGetText(n);
- TCHAR* str2;
+ TCHAR *str2;
Log("description = %s", desc);
if ((str2 = _tcsrchr(ft->httpPath, '/')) != NULL)
str2++;
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 664526e22d..d3e565c7f9 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -158,7 +158,7 @@ void CJabberProto::OnProcessLoginRq(ThreadData* info, DWORD rq) if (item->nick && item->nick[0] != 0)
GroupchatJoinRoom(server, p, item->nick, item->password, true);
else {
- TCHAR* nick = JabberNickFromJID(m_szJabberJID);
+ TCHAR *nick = JabberNickFromJID(m_szJabberJID);
GroupchatJoinRoom(server, p, nick, item->password, true);
mir_free(nick);
}
@@ -383,7 +383,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo* pInfo) szGroupDelimeter = NULL;
}
- TCHAR* nick;
+ TCHAR *nick;
int i;
LIST<void> chatRooms(10);
OBJLIST<JABBER_HTTP_AVATARS> *httpavatars = new OBJLIST<JABBER_HTTP_AVATARS>(20, JABBER_HTTP_AVATARS::compare);
@@ -427,7 +427,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo* pInfo) mir_free(item->nick); item->nick = nick;
HXML groupNode = xmlGetChild(itemNode , "group");
- replaceStrT(item->group, (groupNode) ? xmlGetText(groupNode) : NULL);
+ replaceStrT(item->group, xmlGetText(groupNode));
// check group delimiters:
if (item->group && szGroupDelimeter) {
@@ -576,7 +576,7 @@ void CJabberProto::OnIqResultGetRegister(HXML iqNode) else if ( !lstrcmp(type, _T("error"))) {
if (m_hwndAgentRegInput) {
HXML errorNode = xmlGetChild(iqNode , "error");
- TCHAR* str = JabberErrorMsg(errorNode);
+ TCHAR *str = JabberErrorMsg(errorNode);
SendMessage(m_hwndAgentRegInput, WM_JABBER_REGINPUT_ACTIVATE, 0 /*error*/, (LPARAM)str);
mir_free(str);
} } }
@@ -602,7 +602,7 @@ void CJabberProto::OnIqResultSetRegister(HXML iqNode) else if ( !lstrcmp(type, _T("error"))) {
if (m_hwndRegProgress) {
HXML errorNode = xmlGetChild(iqNode , "error");
- TCHAR* str = JabberErrorMsg(errorNode);
+ TCHAR *str = JabberErrorMsg(errorNode);
SendMessage(m_hwndRegProgress, WM_JABBER_REGDLG_UPDATE, 100, (LPARAM)str);
mir_free(str);
} } }
@@ -616,40 +616,18 @@ void CJabberProto::OnIqResultGetVcardPhoto(const TCHAR *jid, HXML n, HANDLE hCon if (hasPhoto)
return;
- HXML o = xmlGetChild(n , "BINVAL");
+ HXML o = xmlGetChild(n, "BINVAL");
if (o == NULL || xmlGetText(o) == NULL)
return;
int bufferLen;
- char* buffer = JabberBase64DecodeT(xmlGetText(o), &bufferLen);
+ ptrA buffer( JabberBase64DecodeT(xmlGetText(o), &bufferLen));
if (buffer == NULL)
return;
- const TCHAR *szPicType;
- HXML m = xmlGetChild(n , "TYPE");
- if (m == NULL || xmlGetText(m) == NULL) {
-LBL_NoTypeSpecified:
- switch(JabberGetPictureType(buffer)) {
- case PA_FORMAT_GIF: szPicType = _T("image/gif"); break;
- case PA_FORMAT_BMP: szPicType = _T("image/bmp"); break;
- case PA_FORMAT_PNG: szPicType = _T("image/png"); break;
- case PA_FORMAT_JPEG: szPicType = _T("image/jpeg"); break;
- default:
-LBL_Ret:
- mir_free(buffer);
- return;
- }
- }
- else {
- const TCHAR *tszType = xmlGetText(m);
- if ( !_tcscmp(tszType, _T("image/jpeg")) ||
- !_tcscmp(tszType, _T("image/png")) ||
- !_tcscmp(tszType, _T("image/gif")) ||
- !_tcscmp(tszType, _T("image/bmp")))
- szPicType = tszType;
- else
- goto LBL_NoTypeSpecified;
- }
+ const TCHAR *szPicType = JabberGetPictureType(n, buffer);
+ if (szPicType == NULL)
+ return;
TCHAR szAvatarFileName[MAX_PATH];
GetAvatarFileName(hContact, szAvatarFileName, SIZEOF(szAvatarFileName));
@@ -657,14 +635,14 @@ LBL_Ret: Log("Picture file name set to %S", szAvatarFileName);
HANDLE hFile = CreateFile(szAvatarFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
- goto LBL_Ret;
+ return;
Log("Writing %d bytes", bufferLen);
DWORD nWritten;
- if ( !WriteFile(hFile, buffer, bufferLen, &nWritten, NULL))
- goto LBL_Ret;
-
+ bool bRes = WriteFile(hFile, buffer, bufferLen, &nWritten, NULL) != 0;
CloseHandle(hFile);
+ if (!bRes)
+ return;
Log("%d bytes written", nWritten);
if (hContact == NULL) {
@@ -687,7 +665,7 @@ LBL_Ret: DeleteFile(item->photoFileName);
replaceStrT(item->photoFileName, szAvatarFileName);
Log("Contact's picture saved to %S", szAvatarFileName);
- OnIqResultGotAvatar(hContact, o, xmlGetText(m));
+ OnIqResultGotAvatar(hContact, o, szPicType);
}
db_free(&dbv);
@@ -695,8 +673,6 @@ LBL_Ret: if ( !hasPhoto)
DeleteFile(szAvatarFileName);
-
- goto LBL_Ret;
}
static TCHAR* sttGetText(HXML node, char* tag)
@@ -794,22 +770,22 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) else if ( !lstrcmp(xmlGetName(n), _T("N"))) {
// First/Last name
if ( !hasGiven && !hasFamily && !hasMiddle) {
- if ((m=xmlGetChild(n , "GIVEN")) != NULL && xmlGetText(m)!=NULL) {
+ if ((m=xmlGetChild(n, "GIVEN")) != NULL && xmlGetText(m) != NULL) {
hasGiven = TRUE;
setTString(hContact, "FirstName", xmlGetText(m));
}
- if ((m=xmlGetChild(n , "FAMILY")) != NULL && xmlGetText(m)!=NULL) {
+ if ((m=xmlGetChild(n, "FAMILY")) != NULL && xmlGetText(m) != NULL) {
hasFamily = TRUE;
setTString(hContact, "LastName", xmlGetText(m));
}
- if ((m=xmlGetChild(n , "MIDDLE")) != NULL && xmlGetText(m) != NULL) {
+ if ((m=xmlGetChild(n, "MIDDLE")) != NULL && xmlGetText(m) != NULL) {
hasMiddle = TRUE;
setTString(hContact, "MiddleName", xmlGetText(m));
} }
}
else if ( !lstrcmp(xmlGetName(n), _T("EMAIL"))) {
// E-mail address(es)
- if ((m=xmlGetChild(n , "USERID")) == NULL) // Some bad client put e-mail directly in <EMAIL/> instead of <USERID/>
+ if ((m=xmlGetChild(n, "USERID")) == NULL) // Some bad client put e-mail directly in <EMAIL/> instead of <USERID/>
m = n;
if (xmlGetText(m) != NULL) {
char text[100];
@@ -825,10 +801,10 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) if (hContact == NULL) {
sprintf(text, "e-mailFlag%d", nEmail);
int nFlag = 0;
- if (xmlGetChild(n , "HOME") != NULL) nFlag |= JABBER_VCEMAIL_HOME;
- if (xmlGetChild(n , "WORK") != NULL) nFlag |= JABBER_VCEMAIL_WORK;
- if (xmlGetChild(n , "INTERNET") != NULL) nFlag |= JABBER_VCEMAIL_INTERNET;
- if (xmlGetChild(n , "X400") != NULL) nFlag |= JABBER_VCEMAIL_X400;
+ if (xmlGetChild(n, "HOME") != NULL) nFlag |= JABBER_VCEMAIL_HOME;
+ if (xmlGetChild(n, "WORK") != NULL) nFlag |= JABBER_VCEMAIL_WORK;
+ if (xmlGetChild(n, "INTERNET") != NULL) nFlag |= JABBER_VCEMAIL_INTERNET;
+ if (xmlGetChild(n, "X400") != NULL) nFlag |= JABBER_VCEMAIL_X400;
setWord(text, nFlag);
}
nEmail++;
@@ -836,7 +812,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) }
else if ( !lstrcmp(xmlGetName(n), _T("BDAY"))) {
// Birthday
- if ( !hasBday && xmlGetText(n)!=NULL) {
+ if ( !hasBday && xmlGetText(n) != NULL) {
if (hContact != NULL) {
if (_stscanf(xmlGetText(n), _T("%d-%d-%d"), &nYear, &nMonth, &nDay) == 3) {
hasBday = TRUE;
@@ -860,9 +836,9 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) }
else if ( !lstrcmp(xmlGetName(n), _T("GENDER"))) {
// Gender
- if ( !hasGender && xmlGetText(n)!=NULL) {
+ if ( !hasGender && xmlGetText(n) != NULL) {
if (hContact != NULL) {
- if (xmlGetText(n)[0] && strchr("mMfF", xmlGetText(n)[0])!=NULL) {
+ if (xmlGetText(n)[0] && strchr("mMfF", xmlGetText(n)[0]) != NULL) {
hasGender = TRUE;
setByte(hContact, "Gender", (BYTE) toupper(xmlGetText(n)[0]));
}
@@ -873,15 +849,15 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) } }
}
else if ( !lstrcmp(xmlGetName(n), _T("ADR"))) {
- if ( !hasHome && xmlGetChild(n , "HOME")!=NULL) {
+ if ( !hasHome && xmlGetChild(n, "HOME") != NULL) {
// Home address
hasHome = TRUE;
- if ((m=xmlGetChild(n , "STREET")) != NULL && xmlGetText(m) != NULL) {
+ if ((m=xmlGetChild(n, "STREET")) != NULL && xmlGetText(m) != NULL) {
hasHomeStreet = TRUE;
if (hContact != NULL) {
- if ((o=xmlGetChild(n , "EXTADR")) != NULL && xmlGetText(o) != NULL)
+ if ((o=xmlGetChild(n, "EXTADR")) != NULL && xmlGetText(o) != NULL)
mir_sntprintf(text, SIZEOF(text), _T("%s\r\n%s"), xmlGetText(m), xmlGetText(o));
- else if ((o=xmlGetChild(n , "EXTADD"))!=NULL && xmlGetText(o)!=NULL)
+ else if ((o=xmlGetChild(n, "EXTADD")) != NULL && xmlGetText(o) != NULL)
mir_sntprintf(text, SIZEOF(text), _T("%s\r\n%s"), xmlGetText(m), xmlGetText(o));
else
_tcsncpy(text, xmlGetText(m), SIZEOF(text));
@@ -890,41 +866,41 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) }
else {
setTString(hContact, "Street", xmlGetText(m));
- if ((m=xmlGetChild(n , "EXTADR")) == NULL)
- m = xmlGetChild(n , "EXTADD");
- if (m!=NULL && xmlGetText(m)!=NULL) {
+ if ((m=xmlGetChild(n, "EXTADR")) == NULL)
+ m = xmlGetChild(n, "EXTADD");
+ if (m != NULL && xmlGetText(m) != NULL) {
hasHomeStreet2 = TRUE;
setTString(hContact, "Street2", xmlGetText(m));
} } }
- if ((m=xmlGetChild(n , "LOCALITY"))!=NULL && xmlGetText(m)!=NULL) {
+ if ((m=xmlGetChild(n, "LOCALITY")) != NULL && xmlGetText(m) != NULL) {
hasHomeLocality = TRUE;
setTString(hContact, "City", xmlGetText(m));
}
- if ((m=xmlGetChild(n , "REGION"))!=NULL && xmlGetText(m)!=NULL) {
+ if ((m=xmlGetChild(n, "REGION")) != NULL && xmlGetText(m) != NULL) {
hasHomeRegion = TRUE;
setTString(hContact, "State", xmlGetText(m));
}
- if ((m=xmlGetChild(n , "PCODE"))!=NULL && xmlGetText(m)!=NULL) {
+ if ((m=xmlGetChild(n, "PCODE")) != NULL && xmlGetText(m) != NULL) {
hasHomePcode = TRUE;
setTString(hContact, "ZIP", xmlGetText(m));
}
- if ((m=xmlGetChild(n , "CTRY"))==NULL || xmlGetText(m)==NULL) // Some bad client use <COUNTRY/> instead of <CTRY/>
- m = xmlGetChild(n , "COUNTRY");
- if (m!=NULL && xmlGetText(m)!=NULL) {
+ if ((m=xmlGetChild(n, "CTRY")) == NULL || xmlGetText(m) == NULL) // Some bad client use <COUNTRY/> instead of <CTRY/>
+ m = xmlGetChild(n, "COUNTRY");
+ if (m != NULL && xmlGetText(m) != NULL) {
hasHomeCtry = TRUE;
setTString(hContact, "Country", xmlGetText(m));
} }
- if ( !hasWork && xmlGetChild(n , "WORK")!=NULL) {
+ if ( !hasWork && xmlGetChild(n, "WORK") != NULL) {
// Work address
hasWork = TRUE;
- if ((m=xmlGetChild(n , "STREET"))!=NULL && xmlGetText(m)!=NULL) {
+ if ((m=xmlGetChild(n, "STREET")) != NULL && xmlGetText(m) != NULL) {
hasWorkStreet = TRUE;
if (hContact != NULL) {
- if ((o=xmlGetChild(n , "EXTADR"))!=NULL && xmlGetText(o)!=NULL)
+ if ((o=xmlGetChild(n, "EXTADR")) != NULL && xmlGetText(o) != NULL)
mir_sntprintf(text, SIZEOF(text), _T("%s\r\n%s"), xmlGetText(m), xmlGetText(o));
- else if ((o=xmlGetChild(n , "EXTADD"))!=NULL && xmlGetText(o)!=NULL)
+ else if ((o=xmlGetChild(n, "EXTADD")) != NULL && xmlGetText(o) != NULL)
mir_sntprintf(text, SIZEOF(text), _T("%s\r\n%s"), xmlGetText(m), xmlGetText(o));
else
_tcsncpy(text, xmlGetText(m), SIZEOF(text));
@@ -933,57 +909,57 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) }
else {
setTString(hContact, "CompanyStreet", xmlGetText(m));
- if ((m=xmlGetChild(n , "EXTADR")) == NULL)
- m = xmlGetChild(n , "EXTADD");
- if (m!=NULL && xmlGetText(m)!=NULL) {
+ if ((m=xmlGetChild(n, "EXTADR")) == NULL)
+ m = xmlGetChild(n, "EXTADD");
+ if (m != NULL && xmlGetText(m) != NULL) {
hasWorkStreet2 = TRUE;
setTString(hContact, "CompanyStreet2", xmlGetText(m));
} } }
- if ((m=xmlGetChild(n , "LOCALITY"))!=NULL && xmlGetText(m)!=NULL) {
+ if ((m=xmlGetChild(n, "LOCALITY")) != NULL && xmlGetText(m) != NULL) {
hasWorkLocality = TRUE;
setTString(hContact, "CompanyCity", xmlGetText(m));
}
- if ((m=xmlGetChild(n , "REGION"))!=NULL && xmlGetText(m)!=NULL) {
+ if ((m=xmlGetChild(n, "REGION")) != NULL && xmlGetText(m) != NULL) {
hasWorkRegion = TRUE;
setTString(hContact, "CompanyState", xmlGetText(m));
}
- if ((m=xmlGetChild(n , "PCODE"))!=NULL && xmlGetText(m)!=NULL) {
+ if ((m=xmlGetChild(n, "PCODE")) != NULL && xmlGetText(m) != NULL) {
hasWorkPcode = TRUE;
setTString(hContact, "CompanyZIP", xmlGetText(m));
}
- if ((m=xmlGetChild(n , "CTRY"))==NULL || xmlGetText(m)==NULL) // Some bad client use <COUNTRY/> instead of <CTRY/>
- m = xmlGetChild(n , "COUNTRY");
- if (m!=NULL && xmlGetText(m)!=NULL) {
+ if ((m=xmlGetChild(n, "CTRY")) == NULL || xmlGetText(m) == NULL) // Some bad client use <COUNTRY/> instead of <CTRY/>
+ m = xmlGetChild(n, "COUNTRY");
+ if (m != NULL && xmlGetText(m) != NULL) {
hasWorkCtry = TRUE;
setTString(hContact, "CompanyCountry", xmlGetText(m));
} }
}
else if ( !lstrcmp(xmlGetName(n), _T("TEL"))) {
// Telephone/Fax/Cellular
- if ((m=xmlGetChild(n , "NUMBER"))!=NULL && xmlGetText(m)!=NULL) {
+ if ((m=xmlGetChild(n, "NUMBER")) != NULL && xmlGetText(m) != NULL) {
if (hContact != NULL) {
- if ( !hasFax && xmlGetChild(n , "FAX")!=NULL) {
+ if ( !hasFax && xmlGetChild(n, "FAX") != NULL) {
hasFax = TRUE;
setTString(hContact, "Fax", xmlGetText(m));
}
- else if ( !hasCell && xmlGetChild(n , "CELL")!=NULL) {
+ else if ( !hasCell && xmlGetChild(n, "CELL") != NULL) {
hasCell = TRUE;
setTString(hContact, "Cellular", xmlGetText(m));
}
else if ( !hasPhone &&
- (xmlGetChild(n , "HOME")!=NULL ||
- xmlGetChild(n , "WORK")!=NULL ||
- xmlGetChild(n , "VOICE")!=NULL ||
- (xmlGetChild(n , "FAX")==NULL &&
- xmlGetChild(n , "PAGER")==NULL &&
- xmlGetChild(n , "MSG")==NULL &&
- xmlGetChild(n , "CELL")==NULL &&
- xmlGetChild(n , "VIDEO")==NULL &&
- xmlGetChild(n , "BBS")==NULL &&
- xmlGetChild(n , "MODEM")==NULL &&
- xmlGetChild(n , "ISDN")==NULL &&
- xmlGetChild(n , "PCS")==NULL))) {
+ (xmlGetChild(n, "HOME") != NULL ||
+ xmlGetChild(n, "WORK") != NULL ||
+ xmlGetChild(n, "VOICE") != NULL ||
+ (xmlGetChild(n, "FAX") == NULL &&
+ xmlGetChild(n, "PAGER") == NULL &&
+ xmlGetChild(n, "MSG") == NULL &&
+ xmlGetChild(n, "CELL") == NULL &&
+ xmlGetChild(n, "VIDEO") == NULL &&
+ xmlGetChild(n, "BBS") == NULL &&
+ xmlGetChild(n, "MODEM") == NULL &&
+ xmlGetChild(n, "ISDN") == NULL &&
+ xmlGetChild(n, "PCS") == NULL))) {
hasPhone = TRUE;
setTString(hContact, "Phone", xmlGetText(m));
}
@@ -995,56 +971,56 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) sprintf(text, "PhoneFlag%d", nPhone);
int nFlag = 0;
- if (xmlGetChild(n ,"HOME") != NULL) nFlag |= JABBER_VCTEL_HOME;
- if (xmlGetChild(n ,"WORK") != NULL) nFlag |= JABBER_VCTEL_WORK;
- if (xmlGetChild(n ,"VOICE") != NULL) nFlag |= JABBER_VCTEL_VOICE;
- if (xmlGetChild(n ,"FAX") != NULL) nFlag |= JABBER_VCTEL_FAX;
- if (xmlGetChild(n ,"PAGER") != NULL) nFlag |= JABBER_VCTEL_PAGER;
- if (xmlGetChild(n ,"MSG") != NULL) nFlag |= JABBER_VCTEL_MSG;
- if (xmlGetChild(n ,"CELL") != NULL) nFlag |= JABBER_VCTEL_CELL;
- if (xmlGetChild(n ,"VIDEO") != NULL) nFlag |= JABBER_VCTEL_VIDEO;
- if (xmlGetChild(n ,"BBS") != NULL) nFlag |= JABBER_VCTEL_BBS;
- if (xmlGetChild(n ,"MODEM") != NULL) nFlag |= JABBER_VCTEL_MODEM;
- if (xmlGetChild(n ,"ISDN") != NULL) nFlag |= JABBER_VCTEL_ISDN;
- if (xmlGetChild(n ,"PCS") != NULL) nFlag |= JABBER_VCTEL_PCS;
+ if (xmlGetChild(n,"HOME") != NULL) nFlag |= JABBER_VCTEL_HOME;
+ if (xmlGetChild(n,"WORK") != NULL) nFlag |= JABBER_VCTEL_WORK;
+ if (xmlGetChild(n,"VOICE") != NULL) nFlag |= JABBER_VCTEL_VOICE;
+ if (xmlGetChild(n,"FAX") != NULL) nFlag |= JABBER_VCTEL_FAX;
+ if (xmlGetChild(n,"PAGER") != NULL) nFlag |= JABBER_VCTEL_PAGER;
+ if (xmlGetChild(n,"MSG") != NULL) nFlag |= JABBER_VCTEL_MSG;
+ if (xmlGetChild(n,"CELL") != NULL) nFlag |= JABBER_VCTEL_CELL;
+ if (xmlGetChild(n,"VIDEO") != NULL) nFlag |= JABBER_VCTEL_VIDEO;
+ if (xmlGetChild(n,"BBS") != NULL) nFlag |= JABBER_VCTEL_BBS;
+ if (xmlGetChild(n,"MODEM") != NULL) nFlag |= JABBER_VCTEL_MODEM;
+ if (xmlGetChild(n,"ISDN") != NULL) nFlag |= JABBER_VCTEL_ISDN;
+ if (xmlGetChild(n,"PCS") != NULL) nFlag |= JABBER_VCTEL_PCS;
setWord(text, nFlag);
nPhone++;
} }
}
else if ( !lstrcmp(xmlGetName(n), _T("URL"))) {
// Homepage
- if ( !hasUrl && xmlGetText(n)!=NULL) {
+ if ( !hasUrl && xmlGetText(n) != NULL) {
hasUrl = TRUE;
setTString(hContact, "Homepage", xmlGetText(n));
}
}
else if ( !lstrcmp(xmlGetName(n), _T("ORG"))) {
if ( !hasOrgname && !hasOrgunit) {
- if ((m=xmlGetChild(n ,"ORGNAME"))!=NULL && xmlGetText(m)!=NULL) {
+ if ((m=xmlGetChild(n,"ORGNAME")) != NULL && xmlGetText(m) != NULL) {
hasOrgname = TRUE;
setTString(hContact, "Company", xmlGetText(m));
}
- if ((m=xmlGetChild(n ,"ORGUNIT"))!=NULL && xmlGetText(m)!=NULL) { // The real vCard can have multiple <ORGUNIT/> but we will only display the first one
+ if ((m=xmlGetChild(n,"ORGUNIT")) != NULL && xmlGetText(m) != NULL) { // The real vCard can have multiple <ORGUNIT/> but we will only display the first one
hasOrgunit = TRUE;
setTString(hContact, "CompanyDepartment", xmlGetText(m));
} }
}
else if ( !lstrcmp(xmlGetName(n), _T("ROLE"))) {
- if ( !hasRole && xmlGetText(n)!=NULL) {
+ if ( !hasRole && xmlGetText(n) != NULL) {
hasRole = TRUE;
setTString(hContact, "Role", xmlGetText(n));
}
}
else if ( !lstrcmp(xmlGetName(n), _T("TITLE"))) {
- if ( !hasTitle && xmlGetText(n)!=NULL) {
+ if ( !hasTitle && xmlGetText(n) != NULL) {
hasTitle = TRUE;
setTString(hContact, "CompanyPosition", xmlGetText(n));
}
}
else if ( !lstrcmp(xmlGetName(n), _T("DESC"))) {
- if ( !hasDesc && xmlGetText(n)!=NULL) {
+ if ( !hasDesc && xmlGetText(n) != NULL) {
hasDesc = TRUE;
- TCHAR* szMemo = JabberUnixToDosT(xmlGetText(n));
+ TCHAR *szMemo = JabberUnixToDosT(xmlGetText(n));
setTString(hContact, "About", szMemo);
mir_free(szMemo);
}
@@ -1131,7 +1107,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) if ( !hasHomeStreet)
delSetting(hContact, "Street");
- if ( !hasHomeStreet2 && hContact==NULL)
+ if ( !hasHomeStreet2 && hContact == NULL)
delSetting(hContact, "Street2");
if ( !hasHomeLocality)
delSetting(hContact, "City");
@@ -1143,7 +1119,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) delSetting(hContact, "Country");
if ( !hasWorkStreet)
delSetting(hContact, "CompanyStreet");
- if ( !hasWorkStreet2 && hContact==NULL)
+ if ( !hasWorkStreet2 && hContact == NULL)
delSetting(hContact, "CompanyStreet2");
if ( !hasWorkLocality)
delSetting(hContact, "CompanyCity");
@@ -1216,19 +1192,19 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode) jsr.jid[ SIZEOF(jsr.jid)-1] = '\0';
jsr.hdr.id = (TCHAR*)jid;
Log("Result jid = %S", jid);
- if ((n=xmlGetChild(itemNode , "nick"))!=NULL && xmlGetText(n)!=NULL)
+ if ((n=xmlGetChild(itemNode , "nick")) != NULL && xmlGetText(n) != NULL)
jsr.hdr.nick = (TCHAR*)xmlGetText(n);
else
jsr.hdr.nick = _T("");
- if ((n=xmlGetChild(itemNode , "first"))!=NULL && xmlGetText(n)!=NULL)
+ if ((n=xmlGetChild(itemNode , "first")) != NULL && xmlGetText(n) != NULL)
jsr.hdr.firstName = (TCHAR*)xmlGetText(n);
else
jsr.hdr.firstName = _T("");
- if ((n=xmlGetChild(itemNode , "last"))!=NULL && xmlGetText(n)!=NULL)
+ if ((n=xmlGetChild(itemNode , "last")) != NULL && xmlGetText(n) != NULL)
jsr.hdr.lastName = (TCHAR*)xmlGetText(n);
else
jsr.hdr.lastName = _T("");
- if ((n=xmlGetChild(itemNode , "email"))!=NULL && xmlGetText(n)!=NULL)
+ if ((n=xmlGetChild(itemNode , "email")) != NULL && xmlGetText(n) != NULL)
jsr.hdr.email = (TCHAR*)xmlGetText(n);
else
jsr.hdr.email = _T("");
@@ -1364,9 +1340,7 @@ void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode) return;
}
- HXML typeNode = xmlGetChild(vCard , "TYPE");
- const TCHAR *mimeType = NULL;
- if (typeNode != NULL) mimeType = xmlGetText(typeNode);
+ const TCHAR *mimeType = xmlGetText( xmlGetChild(vCard , "TYPE"));
HXML n = xmlGetChild(vCard , "BINVAL");
if (n == NULL)
return;
@@ -1472,14 +1446,14 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode) void CJabberProto::OnIqResultGotAvatar(HANDLE hContact, HXML n, const TCHAR *mimeType)
{
int resultLen = 0;
- char* body = JabberBase64DecodeT(xmlGetText(n), &resultLen);
+ ptrA body( JabberBase64DecodeT( xmlGetText(n), &resultLen));
int pictureType;
if (mimeType != NULL) {
- if ( !lstrcmp(mimeType, _T("image/jpeg"))) pictureType = PA_FORMAT_JPEG;
- else if ( !lstrcmp(mimeType, _T("image/png"))) pictureType = PA_FORMAT_PNG;
- else if ( !lstrcmp(mimeType, _T("image/gif"))) pictureType = PA_FORMAT_GIF;
- else if ( !lstrcmp(mimeType, _T("image/bmp"))) pictureType = PA_FORMAT_BMP;
+ if ( !lstrcmp(mimeType, _T("image/jpeg"))) pictureType = PA_FORMAT_JPEG;
+ else if ( !lstrcmp(mimeType, _T("image/png"))) pictureType = PA_FORMAT_PNG;
+ else if ( !lstrcmp(mimeType, _T("image/gif"))) pictureType = PA_FORMAT_GIF;
+ else if ( !lstrcmp(mimeType, _T("image/bmp"))) pictureType = PA_FORMAT_BMP;
else {
LBL_ErrFormat:
Log("Invalid mime type specified for picture: %S", mimeType);
@@ -1507,7 +1481,7 @@ LBL_ErrFormat: mir_sha1_byte_t digest[20];
mir_sha1_ctx sha;
mir_sha1_init(&sha);
- mir_sha1_append(&sha, (mir_sha1_byte_t*)body, resultLen);
+ mir_sha1_append(&sha, (mir_sha1_byte_t*)(char*)body, resultLen);
mir_sha1_finish(&sha, digest);
for (int i=0; i<20; i++)
sprintf(buffer+(i<<1), "%02x", digest[i]);
@@ -1524,8 +1498,6 @@ LBL_ErrFormat: Log("Broadcast new avatar: %s",AI.filename);
}
else ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, HANDLE(&AI), NULL);
-
- mir_free(body);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1636,7 +1608,7 @@ void CJabberProto::OnIqResultSetBookmarks(HXML iqNode) }
else if ( !lstrcmp(type, _T("error"))) {
HXML errorNode = xmlGetChild(iqNode , "error");
- TCHAR* str = JabberErrorMsg(errorNode);
+ TCHAR *str = JabberErrorMsg(errorNode);
MessageBox(NULL, str, TranslateT("Jabber Bookmarks Error"), MB_OK|MB_SETFOREGROUND);
mir_free(str);
UI_SAFE_NOTIFY(m_pDlgBookmarks, WM_JABBER_ACTIVATE);
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp index b4aad02f26..49cc776320 100644 --- a/protocols/JabberG/src/jabber_iqid_muc.cpp +++ b/protocols/JabberG/src/jabber_iqid_muc.cpp @@ -249,7 +249,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w dat->roomJid = mir_tstrdup(from);
if ((queryNode = xmlGetChild(iqNode , "query")) != NULL) {
- TCHAR* localFrom = mir_tstrdup(from);
+ TCHAR *localFrom = mir_tstrdup(from);
mir_sntprintf(title, SIZEOF(title), TranslateT("%s, %d items (%s)"),
(dat->type == MUC_VOICELIST) ? TranslateT("Voice List") :
(dat->type == MUC_MEMBERLIST) ? TranslateT("Member List") :
@@ -477,7 +477,7 @@ static void CALLBACK JabberMucJidListCreateDialogApcProc(void* param) return;
}
- if (*pHwndJidList!=NULL && IsWindow(*pHwndJidList)) {
+ if (*pHwndJidList != NULL && IsWindow(*pHwndJidList)) {
SetForegroundWindow(*pHwndJidList);
SendMessage(*pHwndJidList, WM_JABBER_REFRESH, 0, (LPARAM)jidListInfo);
}
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 9f4775b609..06d1baf3b5 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -544,7 +544,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleRequestAuth(WPARAM wParam, LPARAM) HANDLE hContact;
DBVARIANT dbv;
- if ((hContact=(HANDLE)wParam)!=NULL && m_bJabberOnline) {
+ if ((hContact=(HANDLE)wParam) != NULL && m_bJabberOnline) {
if ( !getTString(hContact, "jid", &dbv)) {
m_ThreadInfo->send(XmlNode(_T("presence")) << XATTR(_T("to"), dbv.ptszVal) << XATTR(_T("type"), _T("subscribe")));
db_free(&dbv);
@@ -558,7 +558,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleGrantAuth(WPARAM wParam, LPARAM) HANDLE hContact;
DBVARIANT dbv;
- if ((hContact=(HANDLE)wParam)!=NULL && m_bJabberOnline) {
+ if ((hContact=(HANDLE)wParam) != NULL && m_bJabberOnline) {
if ( !getTString(hContact, "jid", &dbv)) {
m_ThreadInfo->send(XmlNode(_T("presence")) << XATTR(_T("to"), dbv.ptszVal) << XATTR(_T("type"), _T("subscribed")));
db_free(&dbv);
diff --git a/protocols/JabberG/src/jabber_message_handlers.cpp b/protocols/JabberG/src/jabber_message_handlers.cpp index 9542e54817..f78643a100 100644 --- a/protocols/JabberG/src/jabber_message_handlers.cpp +++ b/protocols/JabberG/src/jabber_message_handlers.cpp @@ -59,9 +59,9 @@ BOOL CJabberProto::OnMessageIbb(HXML node, ThreadData *pThreadData, CJabberMessa BOOL bOk = FALSE;
const TCHAR *sid = xmlGetAttrValue(pInfo->GetChildNode(), _T("sid"));
const TCHAR *seq = xmlGetAttrValue(pInfo->GetChildNode(), _T("seq"));
- if (sid && seq && xmlGetText(pInfo->GetChildNode())) {
+ if (sid && seq && xmlGetText(pInfo->GetChildNode()))
bOk = OnIbbRecvdData(xmlGetText(pInfo->GetChildNode()), sid, seq);
- }
+
return TRUE;
}
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index b8b42953de..eb0f091f22 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -77,7 +77,7 @@ static void JabberContactListCreateClistGroup(TCHAR* groupName) _itoa(i, str, 10);
if ( db_get_ts(NULL, "CListGroups", str, &dbv))
break;
- TCHAR* name = dbv.ptszVal;
+ TCHAR *name = dbv.ptszVal;
if (name[0]!='\0' && !_tcscmp(name+1, groupName)) {
// Already exists, no need to create
db_free(&dbv);
@@ -99,7 +99,7 @@ void JabberContactListCreateGroup(TCHAR* groupName) {
TCHAR name[128], *p;
- if (groupName==NULL || groupName[0]=='\0' || groupName[0]=='\\') return;
+ if (groupName == NULL || groupName[0]=='\0' || groupName[0]=='\\') return;
_tcsncpy(name, groupName, SIZEOF(name));
name[ SIZEOF(name)-1] = '\0';
@@ -155,10 +155,10 @@ void CJabberProto::DBAddAuthRequest(const TCHAR *jid, const TCHAR *nick) HANDLE CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL temporary, BOOL stripResource)
{
HANDLE hContact;
- TCHAR* s, *p, *q;
+ TCHAR *s, *p, *q;
size_t len;
- if (jid==NULL || jid[0]=='\0')
+ if (jid == NULL || jid[0]=='\0')
return NULL;
s = mir_tstrdup(jid);
@@ -168,7 +168,7 @@ HANDLE CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL t if ((q = _tcschr(p, '/')) != NULL)
*q = '\0';
- if ( !stripResource && q!=NULL) // so that resource is not stripped
+ if ( !stripResource && q != NULL) // so that resource is not stripped
*q = '/';
len = _tcslen(s);
@@ -252,7 +252,7 @@ void CJabberProto::InitCustomFolders(void) void CJabberProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen)
{
size_t tPathLen;
- TCHAR* path = (TCHAR*)alloca(cbLen * sizeof(TCHAR));
+ TCHAR *path = (TCHAR*)alloca(cbLen * sizeof(TCHAR));
InitCustomFolders();
@@ -394,7 +394,7 @@ TCHAR* EscapeChatTags(TCHAR* pszText) if (nChars == 0)
return mir_tstrdup(pszText);
- TCHAR* pszNewText = (TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(pszText) + 1 + nChars)), *s, *d;
+ TCHAR *pszNewText = (TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(pszText) + 1 + nChars)), *s, *d;
if (pszNewText == NULL)
return mir_tstrdup(pszText);
@@ -409,7 +409,7 @@ TCHAR* EscapeChatTags(TCHAR* pszText) TCHAR* UnEscapeChatTags(TCHAR* str_in)
{
- TCHAR* s = str_in, *d = str_in;
+ TCHAR *s = str_in, *d = str_in;
while (*s) {
if (*s == '%' && s[1] == '%')
s++;
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index a929050869..74a5551725 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -459,7 +459,7 @@ protected: m_cbServer.AddString(TranslateT("Loading..."));
// fill predefined resources
- TCHAR* szResources[] = { _T("Home"), _T("Work"), _T("Office"), _T("Miranda") };
+ TCHAR *szResources[] = { _T("Home"), _T("Work"), _T("Office"), _T("Miranda") };
for (i = 0; i < SIZEOF(szResources); i++)
m_cbResource.AddString(szResources[i]);
@@ -769,7 +769,7 @@ private: NETLIBHTTPREQUEST *result = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)wnd->GetProto()->m_hNetlibUser, (LPARAM)&request);
if (result) {
if (result->resultCode == 200 && result->dataLength && result->pData) {
- TCHAR* buf = mir_a2t(result->pData);
+ TCHAR *buf = mir_a2t(result->pData);
XmlNode node(buf, NULL, NULL);
if (node) {
HXML queryNode = xmlGetChild(node, _T("query"));
@@ -1047,10 +1047,7 @@ void CJabberProto::_RosterHandleGetRequest(HXML node) const TCHAR *name = xmlGetAttrValue(item, _T("name"));
const TCHAR *subscription = xmlGetAttrValue(item, _T("subscription"));
- const TCHAR *group = NULL;
- HXML groupNode = xmlGetChild(item , "group");
- if (groupNode)
- group = xmlGetText(groupNode);
+ const TCHAR *group = xmlGetText( xmlGetChild(item, "group"));
_RosterInsertListItem(hList, jid, name, group, subscription, TRUE);
}
@@ -1135,19 +1132,16 @@ void CJabberProto::_RosterHandleGetRequest(HXML node) BOOL bPushed = itemRoster ? TRUE : FALSE;
if ( !bPushed) {
const TCHAR *rosterName = xmlGetAttrValue(itemRoster, _T("name"));
- if ((rosterName!=NULL || name[0]!=_T('\0')) && lstrcmpi(rosterName,name))
+ if ((rosterName != NULL || name[0]!=_T('\0')) && lstrcmpi(rosterName,name))
bPushed=TRUE;
if ( !bPushed) {
rosterName = xmlGetAttrValue(itemRoster, _T("subscription"));
- if ((rosterName!=NULL || subscr[0]!=_T('\0')) && lstrcmpi(rosterName,subscr))
+ if ((rosterName != NULL || subscr[0]!=_T('\0')) && lstrcmpi(rosterName,subscr))
bPushed=TRUE;
}
if ( !bPushed) {
- HXML groupNode = xmlGetChild(itemRoster , "group");
- const TCHAR *rosterGroup=NULL;
- if (groupNode != NULL)
- rosterGroup = xmlGetText(groupNode);
- if ((rosterGroup!=NULL || group[0]!=_T('\0')) && lstrcmpi(rosterGroup,group))
+ const TCHAR *rosterGroup = xmlGetText( xmlGetChild(itemRoster, "group"));
+ if ((rosterGroup != NULL || group[0]!=_T('\0')) && lstrcmpi(rosterGroup,group))
bPushed=TRUE;
}
}
@@ -1340,7 +1334,7 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg) fclose(fp);
_RosterListClear(hwndDlg);
- TCHAR* newBuf = mir_utf8decodeT(buffer);
+ TCHAR *newBuf = mir_utf8decodeT(buffer);
mir_free(buffer);
int nBytesProcessed = 0;
@@ -1681,7 +1675,7 @@ protected: m_cbServer.AddString(TranslateT("Loading..."));
// fill predefined resources
- TCHAR* szResources[] = { _T("Home"), _T("Work"), _T("Office"), _T("Miranda") };
+ TCHAR *szResources[] = { _T("Home"), _T("Work"), _T("Office"), _T("Miranda") };
for (i = 0; i < SIZEOF(szResources); i++)
m_cbResource.AddString(szResources[i]);
@@ -2235,7 +2229,7 @@ void CJabberDlgAccMgrUI::QueryServerListThread(void *arg) NETLIBHTTPREQUEST *result = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)wnd->GetProto()->m_hNetlibUser, (LPARAM)&request);
if (result && IsWindow(hwnd)) {
if ((result->resultCode == 200) && result->dataLength && result->pData) {
- TCHAR* ptszText = mir_a2t(result->pData);
+ TCHAR *ptszText = mir_a2t(result->pData);
XmlNode node(ptszText, NULL, NULL);
if (node) {
HXML queryNode = xmlGetChild(node, _T("query"));
diff --git a/protocols/JabberG/src/jabber_opttree.cpp b/protocols/JabberG/src/jabber_opttree.cpp index 3217669caa..5ca3c03fe8 100644 --- a/protocols/JabberG/src/jabber_opttree.cpp +++ b/protocols/JabberG/src/jabber_opttree.cpp @@ -122,7 +122,7 @@ void CCtrlTreeOpts::OnInit() /* build options tree. based on code from IcoLib */
for (int i = 0; i < m_options.getCount(); i++)
{
- TCHAR* sectionName;
+ TCHAR *sectionName;
int sectionLevel = 0;
HTREEITEM hSection = NULL;
@@ -132,7 +132,7 @@ void CCtrlTreeOpts::OnInit() while (sectionName)
{
// allow multi-level tree
- TCHAR* pItemName = sectionName;
+ TCHAR *pItemName = sectionName;
HTREEITEM hItem;
if (sectionName = _tcschr(sectionName, '/'))
diff --git a/protocols/JabberG/src/jabber_password.cpp b/protocols/JabberG/src/jabber_password.cpp index 3322f5b62f..8712c00950 100644 --- a/protocols/JabberG/src/jabber_password.cpp +++ b/protocols/JabberG/src/jabber_password.cpp @@ -47,7 +47,7 @@ static INT_PTR CALLBACK JabberChangePasswordDlgProc(HWND hwndDlg, UINT msg, WPAR WindowSetIcon(hwndDlg, ppro, "key");
TranslateDialogDefault(hwndDlg);
- if (ppro->m_bJabberOnline && ppro->m_ThreadInfo!=NULL) {
+ if (ppro->m_bJabberOnline && ppro->m_ThreadInfo != NULL) {
TCHAR text[1024];
mir_sntprintf(text, SIZEOF(text), _T("%s %s@%S"), TranslateT("Set New Password for"), ppro->m_ThreadInfo->username, ppro->m_ThreadInfo->server);
SetWindowText(hwndDlg, text);
@@ -56,7 +56,7 @@ static INT_PTR CALLBACK JabberChangePasswordDlgProc(HWND hwndDlg, UINT msg, WPAR case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
- if (ppro->m_bJabberOnline && ppro->m_ThreadInfo!=NULL) {
+ if (ppro->m_bJabberOnline && ppro->m_ThreadInfo != NULL) {
TCHAR newPasswd[512], text[512];
GetDlgItemText(hwndDlg, IDC_NEWPASSWD, newPasswd, SIZEOF(newPasswd));
GetDlgItemText(hwndDlg, IDC_NEWPASSWD2, text, SIZEOF(text));
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 5eead4a104..966e101eb4 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -374,7 +374,7 @@ public: SendDlgItemMessage(m_hwnd, IDC_ICO_PRESENCEIN, STM_SETICON, (WPARAM)m_proto->LoadIconEx("pl_prin_allow"), 0);
SendDlgItemMessage(m_hwnd, IDC_ICO_PRESENCEOUT, STM_SETICON, (WPARAM)m_proto->LoadIconEx("pl_prout_allow"), 0);
- TCHAR* szTypes[] = { _T("JID"), _T("Group"), _T("Subscription"), _T("Any") };
+ TCHAR *szTypes[] = { _T("JID"), _T("Group"), _T("Subscription"), _T("Any") };
int i, nTypes[] = { Jid, Group, Subscription, Else };
for (i = 0; i < SIZEOF(szTypes); i++)
{
@@ -385,7 +385,7 @@ public: }
SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_RESETCONTENT, 0, 0);
- TCHAR* szSubscriptions[] = { _T("none"), _T("from"), _T("to"), _T("both") };
+ TCHAR *szSubscriptions[] = { _T("none"), _T("from"), _T("to"), _T("both") };
for (i = 0; i < SIZEOF(szSubscriptions); i++)
{
LRESULT nItem = SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szSubscriptions[i]));
@@ -2117,7 +2117,7 @@ void CJabberDlgPrivacyLists::clcClist_OnClick(CCtrlClc::TEventInfo *evt) if (evt->info->iColumn==-1) return;
hItem = m_clcClist.HitTest(evt->info->pt.x, evt->info->pt.y, &hitFlags);
- if (hItem==NULL) return;
+ if (hItem == NULL) return;
if ( !(hitFlags&CLCHT_ONITEMEXTRA)) return;
iImage = m_clcClist.GetExtraImage(hItem, evt->info->iColumn);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index af504fcd53..b5cd44a0b3 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -317,8 +317,8 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) DBVARIANT dbv;
if ( !getTString(hContact, "jid", &dbv)) {
- TCHAR* domain = NEWTSTR_ALLOCA(dbv.ptszVal);
- TCHAR* resourcepos = _tcschr(domain, '/');
+ TCHAR *domain = NEWTSTR_ALLOCA(dbv.ptszVal);
+ TCHAR *resourcepos = _tcschr(domain, '/');
if (resourcepos != NULL)
*resourcepos = '\0';
m_lstTransports.insert(mir_tstrdup(domain));
@@ -372,7 +372,7 @@ int __cdecl CJabberProto::OnPreShutdown(WPARAM, LPARAM) HANDLE CJabberProto::AddToListByJID(const TCHAR *newJid, DWORD flags)
{
HANDLE hContact;
- TCHAR* jid, *nick;
+ TCHAR *jid, *nick;
Log("AddToListByJID jid = %S", newJid);
@@ -732,7 +732,7 @@ int __cdecl CJabberProto::GetInfo(HANDLE hContact, int /*infoType*/) if ( !item) {
TCHAR szBareJid[JABBER_MAX_JID_LEN];
_tcsncpy(szBareJid, jid, SIZEOF(szBareJid));
- TCHAR* pDelimiter = _tcschr(szBareJid, _T('/'));
+ TCHAR *pDelimiter = _tcschr(szBareJid, _T('/'));
if (pDelimiter) {
*pDelimiter = 0;
pDelimiter++;
@@ -1242,7 +1242,7 @@ int __cdecl CJabberProto::SetApparentMode(HANDLE hContact, int mode) DBVARIANT dbv;
if ( !getTString(hContact, "jid", &dbv)) {
- TCHAR* jid = dbv.ptszVal;
+ TCHAR *jid = dbv.ptszVal;
switch (mode) {
case ID_STATUS_ONLINE:
if (m_iStatus == ID_STATUS_INVISIBLE || oldMode == ID_STATUS_OFFLINE)
@@ -1430,7 +1430,7 @@ int __cdecl CJabberProto::SetAwayMsg(int status, const TCHAR *msg) return 1;
}
- TCHAR* newModeMsg = mir_tstrdup(msg);
+ TCHAR *newModeMsg = mir_tstrdup(msg);
if ((*szMsg == NULL && newModeMsg == NULL) ||
(*szMsg != NULL && newModeMsg != NULL && !lstrcmp(*szMsg, newModeMsg))) {
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 93bbe613cd..7d6ecbeeb6 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -58,10 +58,10 @@ struct JABBER_IQ_FUNC struct JABBER_GROUPCHAT_INVITE_INFO
{
- TCHAR* roomJid;
- TCHAR* from;
- TCHAR* reason;
- TCHAR* password;
+ TCHAR *roomJid;
+ TCHAR *from;
+ TCHAR *reason;
+ TCHAR *password;
};
struct ROSTERREQUSERDATA
@@ -240,14 +240,14 @@ struct CJabberProto : public PROTO<CJabberProto> HANDLE m_hThreadHandle;
- TCHAR* m_szJabberJID;
+ TCHAR *m_szJabberJID;
char* m_szStreamId;
BOOL m_bJabberOnline; // XMPP connection initialized and we can send XMPP packets
int m_nJabberSearchID;
time_t m_tmJabberLoggedInTime;
time_t m_tmJabberIdleStartTime;
UINT m_nJabberCodePage;
- TCHAR* m_tszSelectedLang;
+ TCHAR *m_tszSelectedLang;
CMString m_szCurrentEntityCapsHash;
@@ -437,7 +437,7 @@ struct CJabberProto : public PROTO<CJabberProto> //---- jabber_captcha.cpp ------------------------------------------------------------
- void GetCaptchaImage (HXML node, char *ImageBuf, const TCHAR *PicType, TCHAR*& CaptchaPath);
+ bool GetCaptchaImage(HXML node, TCHAR*& CaptchaPath);
void sendCaptchaResult(TCHAR* buf, ThreadData* info, LPCTSTR from, LPCTSTR challenge, LPCTSTR fromjid, LPCTSTR sid);
void sendCaptchaError(ThreadData* info, LPCTSTR from, LPCTSTR to, LPCTSTR challenge);
diff --git a/protocols/JabberG/src/jabber_proxy.cpp b/protocols/JabberG/src/jabber_proxy.cpp index 50e5f4eca3..8f7308fff8 100644 --- a/protocols/JabberG/src/jabber_proxy.cpp +++ b/protocols/JabberG/src/jabber_proxy.cpp @@ -99,7 +99,7 @@ int JabberHttpGatewayBegin(HANDLE /*hConn*/, NETLIBOPENCONNECTION* /*nloc*/) int JabberHttpGatewayWrapSend(HANDLE hConn, PBYTE buf, int len, int flags, MIRANDASERVICE pfnNetlibSend)
{
- TCHAR* strb = mir_utf8decodeW((char*)buf);
+ TCHAR *strb = mir_utf8decodeW((char*)buf);
TCHAR sid[25] = _T("");
unsigned __int64 rid = 0;
@@ -110,7 +110,7 @@ int JabberHttpGatewayWrapSend(HANDLE hConn, PBYTE buf, int len, int flags, MIRAN XATTR(_T("xmlns"), _T("http://jabber.org/protocol/httpbind"));
xmlAddChild(hBody, hPayLoad);
- TCHAR* str = xi.toString(hBody, NULL);
+ TCHAR *str = xi.toString(hBody, NULL);
mir_free(strb);
char* utfStr = mir_utf8encodeT(str);
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index 3330c209f7..0a27984db2 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -78,7 +78,7 @@ BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo* pInfo, const T Lock();
CJabberAdhocNode* pNode = GetFirstNode();
while (pNode) {
- TCHAR* szJid = pNode->GetJid();
+ TCHAR *szJid = pNode->GetJid();
if ( !szJid)
szJid = m_pProto->m_ThreadInfo->fullJID;
@@ -339,44 +339,39 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhoc if ( !xNode)
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
- HXML fieldNode = xmlGetChildByTag(xNode, "field", "var", _T("status"));
+ HXML fieldNode = xmlGetChildByTag(xNode, "field", "var", _T("status")), valueNode;
if ( !xNode)
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
- HXML valueNode = xmlGetChild(fieldNode , "value");
- if ( !valueNode || !xmlGetText(valueNode))
+ LPCTSTR ptszValue = xmlGetText( xmlGetChild(fieldNode , "value"));
+ if (ptszValue == NULL)
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
- int status = 0;
-
- if ( !_tcscmp(xmlGetText(valueNode), _T("away"))) status = ID_STATUS_AWAY;
- else if ( !_tcscmp(xmlGetText(valueNode), _T("xa"))) status = ID_STATUS_NA;
- else if ( !_tcscmp(xmlGetText(valueNode), _T("dnd"))) status = ID_STATUS_DND;
- else if ( !_tcscmp(xmlGetText(valueNode), _T("chat"))) status = ID_STATUS_FREECHAT;
- else if ( !_tcscmp(xmlGetText(valueNode), _T("online"))) status = ID_STATUS_ONLINE;
- else if ( !_tcscmp(xmlGetText(valueNode), _T("invisible"))) status = ID_STATUS_INVISIBLE;
- else if ( !_tcscmp(xmlGetText(valueNode), _T("offline"))) status = ID_STATUS_OFFLINE;
-
- if ( !status)
+ int status;
+ if ( !_tcscmp(ptszValue, _T("away"))) status = ID_STATUS_AWAY;
+ else if ( !_tcscmp(ptszValue, _T("xa"))) status = ID_STATUS_NA;
+ else if ( !_tcscmp(ptszValue, _T("dnd"))) status = ID_STATUS_DND;
+ else if ( !_tcscmp(ptszValue, _T("chat"))) status = ID_STATUS_FREECHAT;
+ else if ( !_tcscmp(ptszValue, _T("online"))) status = ID_STATUS_ONLINE;
+ else if ( !_tcscmp(ptszValue, _T("invisible"))) status = ID_STATUS_INVISIBLE;
+ else if ( !_tcscmp(ptszValue, _T("offline"))) status = ID_STATUS_OFFLINE;
+ else
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
int priority = -9999;
fieldNode = xmlGetChildByTag(xNode, "field", "var", _T("status-priority"));
- if (fieldNode && (valueNode = xmlGetChild(fieldNode , "value"))) {
- if (xmlGetText(valueNode))
- priority = _ttoi(xmlGetText(valueNode));
- }
+ if (fieldNode && (valueNode = xmlGetChild(fieldNode , "value")))
+ if (ptszValue = xmlGetText(valueNode))
+ priority = _ttoi(ptszValue);
if (priority >= -128 && priority <= 127)
setWord("Priority", (WORD)priority);
const TCHAR *szStatusMessage = NULL;
fieldNode = xmlGetChildByTag(xNode, "field", "var", _T("status-message"));
- if (fieldNode && (valueNode = xmlGetChild(fieldNode , "value"))) {
- if (xmlGetText(valueNode))
- szStatusMessage = xmlGetText(valueNode);
- }
+ if (fieldNode && (valueNode = xmlGetChild(fieldNode , "value")))
+ szStatusMessage = xmlGetText(valueNode);
// skip f...ng away dialog
int nNoDlg = db_get_b(NULL, "SRAway", StatusModeToDbSetting(status, "NoDlg"), 0);
@@ -386,7 +381,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhoc fieldNode = xmlGetChildByTag(xNode, "field", "var", _T("status-global"));
if (fieldNode && (valueNode = xmlGetChild(fieldNode , "value"))) {
- if (xmlGetText(valueNode) && _ttoi(xmlGetText(valueNode)))
+ if ((ptszValue = xmlGetText(valueNode)) != NULL && _ttoi(ptszValue))
CallService(MS_CLIST_SETSTATUSMODE, status, NULL);
else
CallProtoService(m_szModuleName, PS_SETSTATUS, status, NULL);
@@ -445,28 +440,23 @@ int CJabberProto::AdhocOptionsHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhocSe if ( !xNode)
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
- HXML fieldNode, valueNode;
-
// Automatically Accept File Transfers
- fieldNode = xmlGetChildByTag(xNode, "field", "var", _T("auto-files"));
- if (fieldNode && (valueNode = xmlGetChild(fieldNode , "value"))) {
+ HXML fieldNode = xmlGetChildByTag(xNode, "field", "var", _T("auto-files")), valueNode;
+ if (fieldNode && (valueNode = xmlGetChild(fieldNode , "value")))
if (xmlGetText(valueNode))
db_set_b(NULL, "SRFile", "AutoAccept", (BYTE)_ttoi(xmlGetText(valueNode)));
- }
// Use sounds
fieldNode = xmlGetChildByTag(xNode, "field", "var", _T("sounds"));
- if (fieldNode && (valueNode = xmlGetChild(fieldNode , "value"))) {
+ if (fieldNode && (valueNode = xmlGetChild(fieldNode , "value")))
if (xmlGetText(valueNode))
db_set_b(NULL, "Skin", "UseSound", (BYTE)_ttoi(xmlGetText(valueNode)));
- }
// Disable remote controlling
fieldNode = xmlGetChildByTag(xNode, "field", "var", _T("enable-rc"));
- if (fieldNode && (valueNode = xmlGetChild(fieldNode , "value"))) {
+ if (fieldNode && (valueNode = xmlGetChild(fieldNode , "value")))
if (xmlGetText(valueNode) && _ttoi(xmlGetText(valueNode)))
m_options.EnableRemoteControl = 0;
- }
return JABBER_ADHOC_HANDLER_STATUS_COMPLETED;
}
@@ -487,7 +477,7 @@ int CJabberProto::RcGetUnreadEventsCount() dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob + 1);
int nGetTextResult = db_event_get(hDbEvent, &dbei);
if ( !nGetTextResult && dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT)) {
- TCHAR* szEventText = DbGetEventTextT(&dbei, CP_ACP);
+ TCHAR *szEventText = DbGetEventTextT(&dbei, CP_ACP);
if (szEventText) {
nEventsSent++;
mir_free(szEventText);
@@ -553,17 +543,14 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhocSe if ( !xNode)
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
- HXML fieldNode, valueNode;
-
BOOL bRemoveCListEvents = TRUE;
// remove clist events
- fieldNode = xmlGetChildByTag(xNode,"field", "var", _T("remove-clist-events"));
- if (fieldNode && (valueNode = xmlGetChild(fieldNode , "value"))) {
- if (xmlGetText(valueNode) && !_ttoi(xmlGetText(valueNode))) {
+ HXML fieldNode = xmlGetChildByTag(xNode,"field", "var", _T("remove-clist-events")), valueNode;
+ if (fieldNode && (valueNode = xmlGetChild(fieldNode , "value")))
+ if (xmlGetText(valueNode) && !_ttoi(xmlGetText(valueNode)))
bRemoveCListEvents = FALSE;
- }
- }
+
m_options.RcMarkMessagesAsRead = bRemoveCListEvents ? 1 : 0;
int nEventsSent = 0;
@@ -581,7 +568,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhocSe dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob + 1);
int nGetTextResult = db_event_get(hDbEvent, &dbei);
if ( !nGetTextResult && dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT)) {
- TCHAR* szEventText = DbGetEventTextT(&dbei, CP_ACP);
+ TCHAR *szEventText = DbGetEventTextT(&dbei, CP_ACP);
if (szEventText) {
XmlNode msg(_T("message"));
msg << XATTR(_T("to"), pInfo->GetFrom()) << XATTRID(SerialNext())
diff --git a/protocols/JabberG/src/jabber_rc.h b/protocols/JabberG/src/jabber_rc.h index b8f928c5f6..c2b3167eed 100644 --- a/protocols/JabberG/src/jabber_rc.h +++ b/protocols/JabberG/src/jabber_rc.h @@ -101,9 +101,9 @@ class CJabberAdhocNode; class CJabberAdhocNode
{
protected:
- TCHAR* m_szJid;
- TCHAR* m_szNode;
- TCHAR* m_szName;
+ TCHAR *m_szJid;
+ TCHAR *m_szNode;
+ TCHAR *m_szName;
CJabberAdhocNode* m_pNext;
JABBER_ADHOC_HANDLER m_pHandler;
CJabberProto* m_pProto;
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index 0366291a25..342e761c2b 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -189,7 +189,7 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode) HXML errorNode = xmlGetChild(iqNode, "error");
if (errorNode) {
code = xmlGetAttrValue(errorNode, _T("code"));
- description=xmlGetText(errorNode);
+ description = xmlGetText(errorNode);
}
_sntprintf(buff,SIZEOF(buff),TranslateT("Error %s %s\r\nPlease select other server"),code ? code : _T(""),description?description:_T(""));
SetDlgItemText(searchHandleDlg,IDC_INSTRUCTIONS,buff);
@@ -214,7 +214,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M U_TCHAR_MAP* pmUserData = (U_TCHAR_MAP*)plUsersInfo->operator [](i);
int nUserFields = pmUserData->getCount();
for (int j=0; j < nUserFields; j++) {
- TCHAR* var = pmUserData->getKeyName(j);
+ TCHAR *var = pmUserData->getKeyName(j);
if (var && ListOfNonEmptyFields.getIndex(var) < 0)
ListOfNonEmptyFields.insert(var);
} }
@@ -238,7 +238,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M /* Sending Columns Titles */
for (i=0; i < nFieldCount; i++) {
- TCHAR* var = ListOfFields[i];
+ TCHAR *var = ListOfFields[i];
if (var)
Results.pszFields[i] = pmAllFields->operator [](var);
}
@@ -319,8 +319,8 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode) while (HXML fieldNode = xmlGetNthChild(reportNode, _T("field"), i++)) {
TCHAR *var = (TCHAR*)xmlGetAttrValue(fieldNode, _T("var"));
if (var) {
- TCHAR* Label = (TCHAR*)xmlGetAttrValue(fieldNode, _T("label"));
- mColumnsNames.insert(var, (Label!=NULL) ? Label : var);
+ TCHAR *Label = (TCHAR*)xmlGetAttrValue(fieldNode, _T("label"));
+ mColumnsNames.insert(var, (Label != NULL) ? Label : var);
} } }
int i=1;
@@ -346,7 +346,7 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode) U_TCHAR_MAP *pUserColumn=new U_TCHAR_MAP(10);
TCHAR *jid = (TCHAR*)xmlGetAttrValue(itemNode, _T("jid"));
- TCHAR* keyReturned;
+ TCHAR *keyReturned;
mColumnsNames.insertCopyKey(_T("jid"),_T("jid"),&keyReturned, CopyKey, DestroyKey);
mColumnsNames.insert(_T("jid"), keyReturned);
pUserColumn->insertCopyKey(_T("jid"), jid, NULL, CopyKey, DestroyKey);
@@ -358,10 +358,11 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode) const TCHAR *szColumnName = xmlGetName(child);
if (szColumnName) {
- if (xmlGetText(child) && xmlGetText(child)[0] != _T('\0')) {
+ LPCTSTR ptszChild = xmlGetText(child);
+ if (ptszChild && *ptszChild) {
mColumnsNames.insertCopyKey((TCHAR*)szColumnName,_T(""),&keyReturned, CopyKey, DestroyKey);
mColumnsNames.insert((TCHAR*)szColumnName,keyReturned);
- pUserColumn->insertCopyKey((TCHAR*)szColumnName, (TCHAR*)xmlGetText(child),NULL, CopyKey, DestroyKey);
+ pUserColumn->insertCopyKey((TCHAR*)szColumnName, (TCHAR*)ptszChild, NULL, CopyKey, DestroyKey);
} } }
SearchResults.insert((void*)pUserColumn);
diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp index eaf8076f2d..5cc728a360 100644 --- a/protocols/JabberG/src/jabber_secur.cpp +++ b/protocols/JabberG/src/jabber_secur.cpp @@ -86,7 +86,7 @@ bool TNtlmAuth::getSpn(TCHAR* szSpn, size_t dwSpnLen) myGetUserNameEx(2, szFullUserName, &szFullUserNameLen);
}
- TCHAR* name = _tcsrchr(szFullUserName, '\\');
+ TCHAR *name = _tcsrchr(szFullUserName, '\\');
if (name) *name = 0;
else return false;
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index dc7011bc7d..56387a2b22 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -80,7 +80,7 @@ INT_PTR __cdecl CJabberProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam) INT_PTR __cdecl CJabberProto::JabberGetAvatar(WPARAM wParam, LPARAM lParam)
{
- TCHAR* buf = (TCHAR*)wParam;
+ TCHAR *buf = (TCHAR*)wParam;
int size = (int)lParam;
if (buf == NULL || size <= 0)
@@ -281,7 +281,7 @@ INT_PTR __cdecl CJabberProto::OnGetEventTextPresence(WPARAM, LPARAM lParam) INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam)
{
- TCHAR* tszFileName = (TCHAR*)lParam;
+ TCHAR *tszFileName = (TCHAR*)lParam;
if (m_bJabberOnline) {
SetServerVcard(TRUE, tszFileName);
@@ -506,7 +506,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM wParam, LPARAM lP szMsgBody = _tcsstr(szSecondParam, _T("body="));
if (szMsgBody) {
szMsgBody += 5;
- TCHAR* szDelim = _tcschr(szMsgBody, _T(';'));
+ TCHAR *szDelim = _tcschr(szMsgBody, _T(';'));
if (szDelim)
szDelim = 0;
JabberHttpUrlDecode(szMsgBody);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 7d7ce7d5a3..f030609074 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -61,7 +61,7 @@ struct JabberPasswordDlgParam WORD dlgResult;
TCHAR onlinePassword[128];
HANDLE hEventPasswdDlg;
- TCHAR* ptszJid;
+ TCHAR *ptszJid;
};
static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -504,7 +504,7 @@ LBL_FatalError: recvRest:
buffer[datalen] = '\0';
- TCHAR* str;
+ TCHAR *str;
str = mir_utf8decodeW(buffer);
int bytesParsed = 0;
@@ -773,7 +773,7 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData* info) if ( !_tcscmp(xmlGetName(n), _T("compression")) && m_options.EnableZlib == TRUE) {
Log("Server compression available");
for (int k=0; ; k++) {
- HXML c = xmlGetChild(n ,k);
+ HXML c = xmlGetChild(n,k);
if ( !c)
break;
@@ -798,18 +798,18 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData* info) areMechanismsDefined = true;
//JabberLog("%d mechanisms\n",n->numChild);
for (int k=0; ; k++) {
- HXML c = xmlGetChild(n ,k);
+ HXML c = xmlGetChild(n,k);
if ( !c)
break;
if ( !_tcscmp(xmlGetName(c), _T("mechanism"))) {
- //JabberLog("Mechanism: %s",xmlGetText(c));
- if ( !_tcscmp(xmlGetText(c), _T("PLAIN"))) m_AuthMechs.isPlainOldAvailable = m_AuthMechs.isPlainAvailable = true;
- else if ( !_tcscmp(xmlGetText(c), _T("DIGEST-MD5"))) m_AuthMechs.isMd5Available = true;
- else if ( !_tcscmp(xmlGetText(c), _T("SCRAM-SHA-1"))) m_AuthMechs.isScramAvailable = true;
- else if ( !_tcscmp(xmlGetText(c), _T("NTLM"))) m_AuthMechs.isNtlmAvailable = true;
- else if ( !_tcscmp(xmlGetText(c), _T("GSS-SPNEGO"))) m_AuthMechs.isSpnegoAvailable = true;
- else if ( !_tcscmp(xmlGetText(c), _T("GSSAPI"))) m_AuthMechs.isKerberosAvailable = true;
+ LPCTSTR ptszMechanism = xmlGetText(c);
+ if ( !_tcscmp(ptszMechanism, _T("PLAIN"))) m_AuthMechs.isPlainOldAvailable = m_AuthMechs.isPlainAvailable = true;
+ else if ( !_tcscmp(ptszMechanism, _T("DIGEST-MD5"))) m_AuthMechs.isMd5Available = true;
+ else if ( !_tcscmp(ptszMechanism, _T("SCRAM-SHA-1"))) m_AuthMechs.isScramAvailable = true;
+ else if ( !_tcscmp(ptszMechanism, _T("NTLM"))) m_AuthMechs.isNtlmAvailable = true;
+ else if ( !_tcscmp(ptszMechanism, _T("GSS-SPNEGO"))) m_AuthMechs.isSpnegoAvailable = true;
+ else if ( !_tcscmp(ptszMechanism, _T("GSSAPI"))) m_AuthMechs.isKerberosAvailable = true;
}
else if ( !_tcscmp(xmlGetName(c), _T("hostname"))) {
const TCHAR *mech = xmlGetAttrValue(c, _T("mechanism"));
@@ -817,7 +817,8 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData* info) m_AuthMechs.m_gssapiHostName = mir_tstrdup(xmlGetText(c));
}
}
- } }
+ }
+ }
else if ( !_tcscmp(xmlGetName(n), _T("register"))) isRegisterAvailable = true;
else if ( !_tcscmp(xmlGetName(n), _T("auth" ))) m_AuthMechs.isAuthAvailable = true;
else if ( !_tcscmp(xmlGetName(n), _T("session" ))) m_AuthMechs.isSessionAvailable = true;
@@ -1158,7 +1159,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info) LPCTSTR ptszSubject = xmlGetText( xmlGetChild(node , "subject"));
if (ptszSubject && *ptszSubject) {
size_t cbLen = (szMessage ? _tcslen(szMessage) : 0) + _tcslen(ptszSubject) + 128;
- TCHAR* szTmp = (TCHAR *)alloca(sizeof(TCHAR) * cbLen);
+ TCHAR *szTmp = (TCHAR *)alloca(sizeof(TCHAR) * cbLen);
szTmp[0] = _T('\0');
if (szMessage)
_tcscat(szTmp, _T("Subject: "));
@@ -1265,9 +1266,9 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info) ZeroMemory(pParams, sizeof(CJabberHttpAuthParams));
pParams->m_nType = CJabberHttpAuthParams::MSG;
pParams->m_szFrom = mir_tstrdup(from);
- HXML pThreadNode = xmlGetChild(node , "thread");
- if (pThreadNode && xmlGetText(pThreadNode) && xmlGetText(pThreadNode)[0])
- pParams->m_szThreadId = mir_tstrdup(xmlGetText(pThreadNode));
+ LPCTSTR ptszThread = xmlGetText( xmlGetChild(node, "thread"));
+ if (ptszThread && *ptszThread)
+ pParams->m_szThreadId = mir_tstrdup(ptszThread);
pParams->m_szId = mir_tstrdup(szId);
pParams->m_szMethod = mir_tstrdup(szMethod);
pParams->m_szUrl = mir_tstrdup(szUrl);
@@ -1296,15 +1297,15 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info) return;
}
else if ( !_tcscmp(ptszXmlns, _T("jabber:x:encrypted"))) {
- if (xmlGetText(xNode) == NULL)
+ LPCTSTR ptszText = xmlGetText(xNode);
+ if (ptszText == NULL)
return;
- TCHAR* prolog = _T("-----BEGIN PGP MESSAGE-----\r\n\r\n");
- TCHAR* epilog = _T("\r\n-----END PGP MESSAGE-----\r\n");
- TCHAR* tempstring = (TCHAR*)alloca(sizeof(TCHAR) * (_tcslen(prolog) + _tcslen(xmlGetText(xNode)) + _tcslen(epilog) + 3));
- _tcsncpy(tempstring, prolog, _tcslen(prolog) + 1);
- _tcsncpy(tempstring + _tcslen(prolog), xmlGetText(xNode), _tcslen(xmlGetText(xNode)) + 1);
- _tcsncpy(tempstring + _tcslen(prolog) + _tcslen(xmlGetText(xNode)), epilog, _tcslen(epilog) + 1);
+ TCHAR *prolog = _T("-----BEGIN PGP MESSAGE-----\r\n\r\n");
+ TCHAR *epilog = _T("\r\n-----END PGP MESSAGE-----\r\n");
+ size_t len = _tcslen(prolog) + _tcslen(ptszText) + _tcslen(epilog) + 3;
+ TCHAR *tempstring = (TCHAR*)_alloca(sizeof(TCHAR)*len);
+ mir_sntprintf(tempstring, len, _T("%s%s%s"), prolog, ptszText, epilog);
szMessage = tempstring;
}
else if ( !_tcscmp(ptszXmlns, JABBER_FEAT_DELAY) && msgTime == 0) {
@@ -1356,15 +1357,15 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info) if (item != NULL && xmlGetChild(xNode , "composing") != NULL) {
if (item->messageEventIdStr)
mir_free(item->messageEventIdStr);
- item->messageEventIdStr = (idStr==NULL)?NULL:mir_tstrdup(idStr);
+ item->messageEventIdStr = (idStr == NULL)?NULL:mir_tstrdup(idStr);
} }
}
else if ( !_tcscmp(ptszXmlns, JABBER_FEAT_OOB2)) {
- HXML urlNode;
- if (((urlNode = xmlGetChild(xNode , "url")) != NULL) && xmlGetText(urlNode) && xmlGetText(urlNode)[0] != _T('\0')) {
- size_t cbLen = (szMessage ? _tcslen(szMessage) : 0) + _tcslen(xmlGetText(urlNode)) + 32;
- TCHAR* szTmp = (TCHAR *)alloca(sizeof(TCHAR) * cbLen);
- _tcscpy(szTmp, xmlGetText(urlNode));
+ LPCTSTR ptszUrl = xmlGetText( xmlGetChild(xNode , "url"));
+ if (ptszUrl != NULL && *ptszUrl) {
+ size_t cbLen = (szMessage ? _tcslen(szMessage) : 0) + _tcslen(ptszUrl) + 32;
+ TCHAR *szTmp = (TCHAR *)alloca(sizeof(TCHAR) * cbLen);
+ _tcscpy(szTmp, ptszUrl);
if (szMessage) {
_tcscat(szTmp, _T("\r\n"));
_tcscat(szTmp, szMessage);
@@ -1374,23 +1375,15 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info) }
else if ( !_tcscmp(ptszXmlns, JABBER_FEAT_MUC_USER)) {
HXML inviteNode = xmlGetChild(xNode , _T("invite"));
- if (inviteNode == NULL)
- inviteNode = xmlGetChild(xNode , _T("user:invite"));
-
if (inviteNode != NULL) {
inviteFromJid = xmlGetAttrValue(inviteNode, _T("from"));
- n = xmlGetChild(inviteNode , _T("reason"));
- if (n == NULL)
- n = xmlGetChild(inviteNode , _T("user:reason"));
- if (n != NULL)
- inviteReason = xmlGetText(n);
+ inviteReason = xmlGetText( xmlGetChild(inviteNode , _T("reason")));
}
inviteRoomJid = from;
- if ( !inviteReason)
+ if (inviteReason == NULL)
inviteReason = szMessage;
isChatRoomInvitation = TRUE;
- if ((n = xmlGetChild(xNode , "password")) != NULL)
- invitePassword = xmlGetText(n);
+ invitePassword = xmlGetText( xmlGetChild(xNode, "password"));
}
else if ( !_tcscmp(ptszXmlns, JABBER_FEAT_ROSTER_EXCHANGE) &&
item != NULL && (item->subscription == SUB_BOTH || item->subscription == SUB_TO)) {
@@ -1540,7 +1533,7 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid) int status = ID_STATUS_OFFLINE;
if ( !item->resourceCount) {
// set offline only if jid has resources
- if (_tcschr(jid, '/')==NULL)
+ if (_tcschr(jid, '/') == NULL)
status = item->itemResource.status;
if (item->itemResource.statusMessage)
db_set_ts(hContact, "CList", "StatusMsg", item->itemResource.statusMessage);
@@ -1592,9 +1585,9 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid) void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
{
HANDLE hContact;
- HXML showNode, statusNode, priorityNode;
+ HXML showNode;
JABBER_LIST_ITEM *item;
- LPCTSTR from, show, p;
+ LPCTSTR from, show;
TCHAR *nick;
if ( !node || !xmlGetName(node) ||_tcscmp(xmlGetName(node), _T("presence"))) return;
@@ -1646,21 +1639,17 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) }
char priority = 0;
- if ((priorityNode = xmlGetChild(node , "priority")) != NULL && xmlGetText(priorityNode) != NULL)
- priority = (char)_ttoi(xmlGetText(priorityNode));
+ if (LPCTSTR ptszPriority = xmlGetText( xmlGetChild(node , "priority")))
+ priority = (char)_ttoi(ptszPriority);
- if ((statusNode = xmlGetChild(node , "status")) != NULL && xmlGetText(statusNode) != NULL)
- p = xmlGetText(statusNode);
- else
- p = NULL;
- ListAddResource(LIST_ROSTER, from, status, p, priority);
+ ListAddResource(LIST_ROSTER, from, status, xmlGetText( xmlGetChild(node , "status")), priority);
// XEP-0115: Entity Capabilities
OnProcessPresenceCapabilites(node);
UpdateJidDbSettings(from);
- if (_tcschr(from, '@')==NULL) {
+ if (_tcschr(from, '@') == NULL) {
UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH);
}
Log("%S (%S) online, set contact status to %S", nick, from, pcli->pfnGetStatusModeDescription(status, 0));
@@ -1674,22 +1663,21 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) Log("Avatar enabled");
for (int i = 1; (xNode=xmlGetNthChild(node, _T("x"), i)) != NULL; i++) {
if ( !lstrcmp(xmlGetAttrValue(xNode, _T("xmlns")), _T("jabber:x:avatar"))) {
- if ((xNode = xmlGetChild(xNode , "hash")) != NULL && xmlGetText(xNode) != NULL) {
+ LPCTSTR ptszHash = xmlGetText( xmlGetChild(xNode , "hash"));
+ if (ptszHash != NULL) {
delSetting(hContact,"AvatarXVcard");
Log("AvatarXVcard deleted");
- setTString(hContact, "AvatarHash", xmlGetText(xNode));
+ setTString(hContact, "AvatarHash", ptszHash);
hasAvatar = true;
- DBVARIANT dbv;
- int result = getTString(hContact, "AvatarSaved", &dbv);
- if (result || lstrcmp(dbv.ptszVal, xmlGetText(xNode))) {
+ ptrT saved( db_get_tsa(hContact, m_szModuleName, "AvatarSaved"));
+ if (saved != NULL || lstrcmp(saved, ptszHash)) {
Log("Avatar was changed");
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, NULL);
- } else Log("Not broadcasting avatar changed");
- if ( !result) db_free(&dbv);
- } else {
- removedAvatar = true;
+ }
}
- } }
+ else removedAvatar = true;
+ }
+ }
if ( !hasAvatar) { //no jabber:x:avatar. try vcard-temp:x:update
Log("Not hasXAvatar");
for (int i = 1; (xNode=xmlGetNthChild(node, _T("x"), i)) != NULL; i++) {
@@ -1701,18 +1689,15 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) Log("AvatarXVcard set");
setTString(hContact, "AvatarHash", txt);
hasAvatar = true;
- DBVARIANT dbv;
- int result = getTString(hContact, "AvatarSaved", &dbv);
- if (result || lstrcmp(dbv.ptszVal, txt)) {
+ ptrT saved( db_get_tsa(hContact, m_szModuleName, "AvatarSaved"));
+ if (saved || lstrcmp(saved, txt)) {
Log("Avatar was changed. Using vcard-temp:x:update");
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, NULL);
}
- else Log("Not broadcasting avatar changed");
- if ( !result) db_free(&dbv);
- } else {
- removedAvatar = true;
}
+ else removedAvatar = true;
} } } }
+
if ( !hasAvatar && removedAvatar) {
Log("Has no avatar");
delSetting(hContact, "AvatarHash");
@@ -1739,22 +1724,18 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) // set status only if no more available resources
- if ( !item->resourceCount)
- {
+ if ( !item->resourceCount) {
item->itemResource.status = ID_STATUS_OFFLINE;
- if (((statusNode = xmlGetChild(node , "status")) != NULL) && xmlGetText(statusNode))
- replaceStrT(item->itemResource.statusMessage, xmlGetText(statusNode));
- else
- replaceStrT(item->itemResource.statusMessage, NULL);
+ replaceStrT(item->itemResource.statusMessage, xmlGetText( xmlGetChild(node , "status")));
}
}
else Log("SKIP Receive presence offline from %S (who is not in my roster)", from);
UpdateJidDbSettings(from);
- if (_tcschr(from, '@')==NULL) {
+ if (_tcschr(from, '@') == NULL)
UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH);
- }
+
DBCheckIsTransportedContact(from, hContact);
return;
}
@@ -1814,7 +1795,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) if (item->subscription == SUB_FROM) item->subscription = SUB_BOTH;
else if (item->subscription == SUB_NONE) {
item->subscription = SUB_TO;
- if (_tcschr(from, '@')==NULL) {
+ if (_tcschr(from, '@') == NULL) {
UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH);
}
}
@@ -1838,11 +1819,11 @@ void CJabberProto::OnIqResultVersion(HXML /*node*/, CJabberIqInfo *pInfo) if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT && queryNode) {
HXML n;
- if ((n = xmlGetChild(queryNode , "name"))!=NULL && xmlGetText(n))
+ if ((n = xmlGetChild(queryNode , "name")) != NULL && xmlGetText(n))
r->software = mir_tstrdup(xmlGetText(n));
- if ((n = xmlGetChild(queryNode , "version"))!=NULL && xmlGetText(n))
+ if ((n = xmlGetChild(queryNode , "version")) != NULL && xmlGetText(n))
r->version = mir_tstrdup(xmlGetText(n));
- if ((n = xmlGetChild(queryNode , "os"))!=NULL && xmlGetText(n))
+ if ((n = xmlGetChild(queryNode , "os")) != NULL && xmlGetText(n))
r->system = mir_tstrdup(xmlGetText(n));
}
@@ -1996,7 +1977,7 @@ void CJabberProto::OnProcessRegIq(HXML node, ThreadData* info) else if ( !_tcscmp(type, _T("error"))) {
errorNode = xmlGetChild(node , "error");
- TCHAR* str = JabberErrorMsg(errorNode);
+ TCHAR *str = JabberErrorMsg(errorNode);
SendMessage(info->reg_hwndDlg, WM_JABBER_REGDLG_UPDATE, 100, (LPARAM)str);
mir_free(str);
info->reg_done = TRUE;
@@ -2088,7 +2069,7 @@ int ThreadData::send(HXML node) proto->OnConsoleProcessXml(node, JCPF_OUT);
- TCHAR* str = xi.toString(node, NULL);
+ TCHAR *str = xi.toString(node, NULL);
// strip forbidden control characters from outgoing XML stream
TCHAR *q = str;
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 617c5df776..810c04f3d2 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -656,7 +656,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP }
ShowWindow(GetDlgItem(hwndDlg, IDC_SAVE), SW_HIDE);
if ( !photoInfo->ppro->getTString(photoInfo->hContact, "jid", &dbv)) {
- TCHAR* jid = dbv.ptszVal;
+ TCHAR *jid = dbv.ptszVal;
if ((item = photoInfo->ppro->ListGetItemPtr(LIST_VCARD_TEMP, jid)) == NULL)
item = photoInfo->ppro->ListGetItemPtr(LIST_ROSTER, jid);
if (item != NULL) {
@@ -691,7 +691,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP if (photoInfo->ppro->getTString(photoInfo->hContact, "jid", &dbv))
break;
- TCHAR* jid = dbv.ptszVal;
+ TCHAR *jid = dbv.ptszVal;
if ((item = photoInfo->ppro->ListGetItemPtr(LIST_VCARD_TEMP, jid)) == NULL)
item = photoInfo->ppro->ListGetItemPtr(LIST_ROSTER, jid);
if (item != NULL) {
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index f1f871966f..b79a5b509c 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -137,7 +137,7 @@ TCHAR* __stdcall JabberNickFromJID(const TCHAR *jid) if ( !jid) return mir_tstrdup(_T(""));
const TCHAR *p;
- TCHAR* nick;
+ TCHAR *nick;
if ((p = _tcschr(jid, '@')) == NULL)
p = _tcschr(jid, '/');
@@ -192,9 +192,9 @@ JABBER_LIST_ITEM* CJabberProto::GetItemFromContact(HANDLE hContact) TCHAR* JabberPrepareJid(LPCTSTR jid)
{
if ( !jid) return NULL;
- TCHAR* szNewJid = mir_tstrdup(jid);
+ TCHAR *szNewJid = mir_tstrdup(jid);
if ( !szNewJid) return NULL;
- TCHAR* pDelimiter = _tcschr(szNewJid, _T('/'));
+ TCHAR *pDelimiter = _tcschr(szNewJid, _T('/'));
if (pDelimiter) *pDelimiter = _T('\0');
CharLower(szNewJid);
if (pDelimiter) *pDelimiter = _T('/');
@@ -407,7 +407,7 @@ char* __stdcall JabberUnixToDos(const char* str) char* p, *q, *res;
int extra;
- if (str==NULL || str[0]=='\0')
+ if (str == NULL || str[0]=='\0')
return NULL;
extra = 0;
@@ -430,7 +430,7 @@ char* __stdcall JabberUnixToDos(const char* str) WCHAR* __stdcall JabberUnixToDosW(const WCHAR* str)
{
- if (str==NULL || str[0]=='\0')
+ if (str == NULL || str[0]=='\0')
return NULL;
const WCHAR* p;
@@ -461,7 +461,7 @@ TCHAR* __stdcall JabberHttpUrlEncode(const TCHAR *str) if (str == NULL) return NULL;
res = (TCHAR*) mir_alloc(3*_tcslen(str) + 1);
for (p = (TCHAR*)str, q = res; *p!='\0'; p++,q++) {
- if ((*p>='A' && *p<='Z') || (*p>='a' && *p<='z') || (*p>='0' && *p<='9') || strchr("$-_.+!*'(),", *p)!=NULL) {
+ if ((*p>='A' && *p<='Z') || (*p>='a' && *p<='z') || (*p>='0' && *p<='9') || strchr("$-_.+!*'(),", *p) != NULL) {
*q = *p;
}
else {
@@ -522,7 +522,7 @@ int __stdcall JabberCombineStatus(int status1, int status2) struct tagErrorCodeToStr {
int code;
- TCHAR* str;
+ TCHAR *str;
}
static JabberErrorCodeToStrMapping[] = {
{ JABBER_ERROR_REDIRECT, LPGENT("Redirect") },
@@ -554,7 +554,7 @@ TCHAR* __stdcall JabberErrorStr(int errorCode) TCHAR* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode)
{
- TCHAR* errorStr = (TCHAR*)mir_alloc(256 * sizeof(TCHAR));
+ TCHAR *errorStr = (TCHAR*)mir_alloc(256 * sizeof(TCHAR));
if (errorNode == NULL) {
if (pErrorCode)
*pErrorCode = -1;
@@ -620,7 +620,7 @@ static char b64table[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz char* __stdcall JabberBase64Encode(const char* buffer, int bufferLen)
{
- if (buffer==NULL || bufferLen<=0)
+ if (buffer == NULL || bufferLen<=0)
return NULL;
char* res = (char*)mir_alloc((((bufferLen+2)*4)/3) + 1);
@@ -677,7 +677,7 @@ char* __stdcall JabberBase64Decode(const char* str, int *resultLen) unsigned char* r, igroup[4], a[4];
int n, num, count;
- if (str==NULL || resultLen==NULL) return NULL;
+ if (str == NULL || resultLen == NULL) return NULL;
if ((res=(char*)mir_alloc(((strlen(str)+3)/4)*3)) == NULL) return NULL;
for (n=0; n<256; n++)
@@ -1005,7 +1005,7 @@ void __stdcall JabberStringAppend(char* *str, int *sizeAlloced, const char* fmt, if (str == NULL) return;
- if (*str==NULL || *sizeAlloced<=0) {
+ if (*str == NULL || *sizeAlloced<=0) {
*sizeAlloced = 2048;
size = 2048;
*str = (char*)mir_alloc(size);
@@ -1110,6 +1110,25 @@ int __stdcall JabberGetPictureType(const char* buf) return PA_FORMAT_UNKNOWN;
}
+LPCTSTR __stdcall JabberGetPictureType(HXML node, const char *picBuf)
+{
+ if (LPCTSTR ptszType = xmlGetText( xmlGetChild(node , "TYPE")))
+ if ( !_tcscmp(ptszType, _T("image/jpeg")) ||
+ !_tcscmp(ptszType, _T("image/png")) ||
+ !_tcscmp(ptszType, _T("image/gif")) ||
+ !_tcscmp(ptszType, _T("image/bmp")))
+ return ptszType;
+
+ switch(JabberGetPictureType(picBuf)) {
+ case PA_FORMAT_GIF: return _T("image/gif");
+ case PA_FORMAT_BMP: return _T("image/bmp");
+ case PA_FORMAT_PNG: return _T("image/png");
+ case PA_FORMAT_JPEG: return _T("image/jpeg");
+ }
+
+ return NULL;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// TStringPairs class members
@@ -1239,7 +1258,7 @@ static VOID CALLBACK sttRebuildInfoFrameApcProc(void* param) LISTFOREACH(i, ppro, LIST_ROSTER)
{
if ((item=ppro->ListGetItemPtrFromIndex(i)) != NULL) {
- if (_tcschr(item->jid, '@')==NULL && _tcschr(item->jid, '/')==NULL && item->subscription!=SUB_NONE) {
+ if (_tcschr(item->jid, '@') == NULL && _tcschr(item->jid, '/') == NULL && item->subscription!=SUB_NONE) {
HANDLE hContact = ppro->HContactFromJID(item->jid);
if (hContact == NULL) continue;
@@ -1324,8 +1343,8 @@ struct JabberEnterStringParams CJabberProto *ppro;
int type;
- TCHAR* caption;
- TCHAR* result;
+ TCHAR *caption;
+ TCHAR *result;
size_t resultLen;
char *windowName;
int recentCount;
@@ -1561,7 +1580,7 @@ bool JabberReadXep203delay(HXML node, time_t &msgTime) return false;
// skip '-' chars
- TCHAR* szStamp = NEWTSTR_ALLOCA(ptszTimeStamp);
+ TCHAR *szStamp = NEWTSTR_ALLOCA(ptszTimeStamp);
int si = 0, sj = 0;
while (1) {
if (szStamp[si] == _T('-'))
@@ -1711,17 +1730,17 @@ BOOL CJabberProto::IsMyOwnJID(LPCTSTR szJID) if ( !m_ThreadInfo)
return FALSE;
- TCHAR* szFrom = JabberPrepareJid(szJID);
+ TCHAR *szFrom = JabberPrepareJid(szJID);
if ( !szFrom)
return FALSE;
- TCHAR* szTo = JabberPrepareJid(m_ThreadInfo->fullJID);
+ TCHAR *szTo = JabberPrepareJid(m_ThreadInfo->fullJID);
if ( !szTo) {
mir_free(szFrom);
return FALSE;
}
- TCHAR* pDelimiter = _tcschr(szFrom, _T('/'));
+ TCHAR *pDelimiter = _tcschr(szFrom, _T('/'));
if (pDelimiter) *pDelimiter = _T('\0');
pDelimiter = _tcschr(szTo, _T('/'));
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index decf141c5e..39dc3a6799 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -1157,7 +1157,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) if (ReadFile(hFile, buffer, st.st_size, &nRead, NULL)) {
if ((str=JabberBase64Encode(buffer, nRead)) != NULL) {
n = v << XCHILD(_T("PHOTO"));
- TCHAR* szFileType;
+ TCHAR *szFileType;
switch(JabberGetPictureType(buffer)) {
case PA_FORMAT_PNG: szFileType = _T("image/png"); break;
case PA_FORMAT_GIF: szFileType = _T("image/gif"); break;
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 1f9c30401a..273919ce89 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -409,7 +409,7 @@ void CPepService::Publish() void CPepService::Retract()
{
- TCHAR* tempName = mir_a2t(m_name);
+ TCHAR *tempName = mir_a2t(m_name);
_tcslwr(tempName);
m_proto->m_ThreadInfo->send(
|