summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/JabberG/src/jabber.h8
-rw-r--r--protocols/JabberG/src/jabber_agent.cpp11
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp9
-rw-r--r--protocols/JabberG/src/jabber_file.cpp90
-rw-r--r--protocols/JabberG/src/jabber_form.cpp293
-rw-r--r--protocols/JabberG/src/jabber_frame.cpp36
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp6
-rw-r--r--protocols/JabberG/src/jabber_iq.cpp3
-rw-r--r--protocols/JabberG/src/jabber_iq_handlers.cpp71
-rw-r--r--protocols/JabberG/src/jabber_notes.cpp11
-rw-r--r--protocols/JabberG/src/jabber_notes.h5
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp12
-rw-r--r--protocols/JabberG/src/jabber_secur.cpp12
-rw-r--r--protocols/JabberG/src/jabber_secur.h8
-rw-r--r--protocols/JabberG/src/jabber_std.cpp3
-rw-r--r--protocols/JabberG/src/jabber_treelist.cpp1
-rw-r--r--protocols/JabberG/src/jabber_xstatus.cpp12
-rw-r--r--protocols/JabberG/src/jabber_xstatus.h3
18 files changed, 297 insertions, 297 deletions
diff --git a/protocols/JabberG/src/jabber.h b/protocols/JabberG/src/jabber.h
index 7dfb28756e..dd707ac2be 100644
--- a/protocols/JabberG/src/jabber.h
+++ b/protocols/JabberG/src/jabber.h
@@ -36,8 +36,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/*******************************************************************
* Global header files
*******************************************************************/
-#define _WIN32_WINNT 0x501
-#define _WIN32_IE 0x501
+#define _WIN32_WINNT 0x601
+#define _WIN32_IE 0x601
#include <windows.h>
#include <commctrl.h>
@@ -120,7 +120,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
struct CJabberProto;
-class CJabberDlgBase: public CProtoDlgBase<CJabberProto>
+class CJabberDlgBase : public CProtoDlgBase<CJabberProto>
{
typedef CProtoDlgBase<CJabberProto> CSuper;
protected:
@@ -531,7 +531,7 @@ struct CJabberInfoFrame_Event
LPARAM m_pUserData;
};
-class CJabberInfoFrame
+class CJabberInfoFrame : public MZeroedObject
{
public:
CJabberInfoFrame(CJabberProto *proto);
diff --git a/protocols/JabberG/src/jabber_agent.cpp b/protocols/JabberG/src/jabber_agent.cpp
index 6f6a81c182..5b6176bf86 100644
--- a/protocols/JabberG/src/jabber_agent.cpp
+++ b/protocols/JabberG/src/jabber_agent.cpp
@@ -34,7 +34,7 @@ class CAgentRegProgressDlg : public CJabberDlgBase
CCtrlButton m_ok;
public:
- CAgentRegProgressDlg(CJabberProto* _ppro, HWND _owner) :
+ CAgentRegProgressDlg(CJabberProto *_ppro, HWND _owner) :
CJabberDlgBase(_ppro, IDD_OPT_REGISTER, _owner, false),
m_ok(this, IDOK)
{
@@ -44,7 +44,7 @@ public:
virtual void OnInitDialog()
{
m_proto->m_hwndRegProgress = m_hwnd;
- SetWindowTextA(m_hwnd, "Jabber Agent Registration");
+ SetWindowText(m_hwnd, TranslateT("Jabber Agent Registration"));
TranslateDialogDefault(m_hwnd);
}
@@ -55,8 +55,9 @@ public:
SetDlgItemText(m_hwnd, IDC_REG_STATUS, TranslateT("No message"));
else
SetDlgItemText(m_hwnd, IDC_REG_STATUS, (TCHAR*)lParam);
- if (wParam >= 0)
- SendDlgItemMessage(m_hwnd, IDC_PROGRESS_REG, PBM_SETPOS, wParam, 0);
+
+ SendDlgItemMessage(m_hwnd, IDC_PROGRESS_REG, PBM_SETPOS, wParam, 0);
+
if (wParam >= 100)
m_ok.SetText(TranslateT("OK"));
}
@@ -85,7 +86,7 @@ class CAgentRegDlg : public CJabberDlgBase
CCtrlButton m_submit;
public:
- CAgentRegDlg(CJabberProto* _ppro, TCHAR* _jid) :
+ CAgentRegDlg(CJabberProto *_ppro, TCHAR *_jid) :
CJabberDlgBase(_ppro, IDD_FORM, NULL, false),
m_submit(this, IDC_SUBMIT),
m_jid(_jid),
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index 8d3f544774..bb7583fbd5 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -1278,8 +1278,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g
if (item->nick)
szBuffer = item->nick;
if (ppro->EnterString(szBuffer, szTitle, ESF_COMBO, "gcNick_")) {
- JABBER_LIST_ITEM *item = ppro->ListGetItemPtr(LIST_CHATROOM, gch->pDest->ptszID);
- if (item != NULL) {
+ if (ppro->ListGetItemPtr(LIST_CHATROOM, gch->pDest->ptszID) != NULL) {
TCHAR text[1024];
mir_sntprintf(text, SIZEOF(text), _T("%s/%s"), gch->pDest->ptszID, szBuffer);
ppro->SendPresenceTo(ppro->m_iStatus == ID_STATUS_INVISIBLE ? ID_STATUS_ONLINE : ppro->m_iStatus, text, NULL);
@@ -1298,8 +1297,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g
break;
case IDM_BOOKMARKS:
- {
- JABBER_LIST_ITEM *item = ppro->ListGetItemPtr(LIST_BOOKMARK, gch->pDest->ptszID);
+ item = ppro->ListGetItemPtr(LIST_BOOKMARK, gch->pDest->ptszID);
if (item == NULL) {
item = ppro->ListGetItemPtr(LIST_CHATROOM, gch->pDest->ptszID);
if (item != NULL) {
@@ -1310,7 +1308,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g
}
}
break;
- }
+
case IDM_DESTROY:
szTitle.Format(TranslateT("Reason to destroy %s"), gch->pDest->ptszID);
if (ppro->EnterString(szBuffer, szTitle, ESF_MULTILINE, "gcReason_"))
@@ -1318,6 +1316,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g
XmlNodeIq(_T("set"), ppro->SerialNext(), gch->pDest->ptszID) << XQUERY(JABBER_FEAT_MUC_OWNER)
<< XCHILD(_T("destroy")) << XCHILD(_T("reason"), szBuffer));
+ // fall through
case IDM_LEAVE:
ppro->GcQuit(item, 200, NULL);
break;
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp
index eb6de79073..cfa0000bcc 100644
--- a/protocols/JabberG/src/jabber_file.cpp
+++ b/protocols/JabberG/src/jabber_file.cpp
@@ -83,7 +83,6 @@ void __cdecl CJabberProto::FileReceiveThread(filetransfer *ft)
int CJabberProto::FileReceiveParse(filetransfer *ft, char* buffer, int datalen)
{
char* p, *q, *s, *eob;
- char* str;
int num, code;
eob = buffer + datalen;
@@ -92,57 +91,52 @@ int CJabberProto::FileReceiveParse(filetransfer *ft, char* buffer, int datalen)
while (true) {
if (ft->state == FT_CONNECTING || ft->state == FT_INITIALIZING) {
for (q = p; q + 1 < eob && (*q != '\r' || *(q + 1) != '\n'); q++);
- if (q + 1 < eob) {
- if ((str = (char*)mir_alloc(q - p + 1)) != NULL) {
- strncpy_s(str, q - p, p, _TRUNCATE);
- str[q - p] = '\0';
- debugLogA("FT Got: %s", str);
- if (ft->state == FT_CONNECTING) {
- // looking for "HTTP/1.1 200 OK"
- if (sscanf(str, "HTTP/%*d.%*d %d %*s", &code) == 1 && code == 200) {
- ft->state = FT_INITIALIZING;
- ft->std.currentFileSize = -1;
- debugLogA("Change to FT_INITIALIZING");
- ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, ft, 0);
- }
- }
- else { // FT_INITIALIZING
- if (str[0] == '\0') {
- TCHAR *s;
- if ((s = _tcsrchr(ft->httpPath, '/')) != NULL)
- s++;
- else
- s = ft->httpPath;
- ft->std.tszCurrentFile = mir_tstrdup(s);
- JabberHttpUrlDecode(ft->std.tszCurrentFile);
- if (ft->create() == -1) {
- ft->state = FT_ERROR;
- break;
- }
- ft->state = FT_RECEIVING;
- ft->std.currentFileProgress = 0;
- debugLogA("Change to FT_RECEIVING");
- }
- else if ((s = strchr(str, ':')) != NULL) {
- *s = '\0';
- if (!strcmp(str, "Content-Length"))
- ft->std.totalBytes = ft->std.currentFileSize = _atoi64(s + 1);
- }
- }
+ if (q + 1 >= eob)
+ break;
- mir_free(str);
- q += 2;
- num += (q - p);
- p = q;
- }
- else {
- ft->state = FT_ERROR;
- break;
+ ptrA str(mir_strndup(p, size_t(q - p)));
+ if (str == NULL) {
+ ft->state = FT_ERROR;
+ break;
+ }
+
+ debugLogA("FT Got: %s", str);
+ if (ft->state == FT_CONNECTING) {
+ // looking for "HTTP/1.1 200 OK"
+ if (sscanf(str, "HTTP/%*d.%*d %d %*s", &code) == 1 && code == 200) {
+ ft->state = FT_INITIALIZING;
+ ft->std.currentFileSize = -1;
+ debugLogA("Change to FT_INITIALIZING");
+ ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, ft, 0);
}
}
- else {
- break;
+ else { // FT_INITIALIZING
+ if (str[0] == '\0') {
+ TCHAR *s;
+ if ((s = _tcsrchr(ft->httpPath, '/')) != NULL)
+ s++;
+ else
+ s = ft->httpPath;
+ ft->std.tszCurrentFile = mir_tstrdup(s);
+ JabberHttpUrlDecode(ft->std.tszCurrentFile);
+ if (ft->create() == -1) {
+ ft->state = FT_ERROR;
+ break;
+ }
+ ft->state = FT_RECEIVING;
+ ft->std.currentFileProgress = 0;
+ debugLogA("Change to FT_RECEIVING");
+ }
+ else if ((s = strchr(str, ':')) != NULL) {
+ *s = '\0';
+ if (!strcmp(str, "Content-Length"))
+ ft->std.totalBytes = ft->std.currentFileSize = _atoi64(s + 1);
+ }
}
+
+ q += 2;
+ num += (q - p);
+ p = q;
}
else if (ft->state == FT_RECEIVING) {
int bufferSize, writeSize;
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp
index d9680fe64a..e56643ce38 100644
--- a/protocols/JabberG/src/jabber_form.cpp
+++ b/protocols/JabberG/src/jabber_form.cpp
@@ -28,11 +28,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static LRESULT CALLBACK JabberFormMultiLineWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- //case WM_GETDLGCODE:
- // return DLGC_WANTARROWS|DLGC_WANTCHARS|DLGC_HASSETSEL|DLGC_WANTALLKEYS;
+ //case WM_GETDLGCODE:
+ // return DLGC_WANTARROWS|DLGC_WANTCHARS|DLGC_HASSETSEL|DLGC_WANTALLKEYS;
case WM_KEYDOWN:
if (wParam == VK_TAB) {
- SetFocus(GetNextDlgTabItem(GetParent(GetParent(hwnd)), hwnd, GetKeyState(VK_SHIFT)<0?TRUE:FALSE));
+ SetFocus(GetNextDlgTabItem(GetParent(GetParent(hwnd)), hwnd, GetKeyState(VK_SHIFT) < 0 ? TRUE : FALSE));
return TRUE;
};
break;
@@ -61,53 +61,47 @@ struct TJabberFormLayoutInfo
void JabberFormCenterContent(HWND hwndStatic)
{
RECT rcWindow;
- int minX;
- GetWindowRect(hwndStatic,&rcWindow);
- minX=rcWindow.right;
- HWND oldChild=NULL;
- HWND hWndChild=GetWindow(hwndStatic,GW_CHILD);
- while (hWndChild!=oldChild && hWndChild != NULL)
- {
- DWORD style=GetWindowLongPtr(hWndChild, GWL_STYLE);
- RECT rc;
- GetWindowRect(hWndChild,&rc);
- if ((style&SS_RIGHT) && !(style&WS_TABSTOP))
- {
- TCHAR * text;
- RECT calcRect=rc;
- int len=GetWindowTextLength(hWndChild);
- text=(TCHAR*)malloc(sizeof(TCHAR)*(len+1));
- GetWindowText(hWndChild,text,len+1);
- HDC hdc=GetDC(hWndChild);
- HFONT hfntSave = (HFONT)SelectObject(hdc, (HFONT)SendMessage(hWndChild, WM_GETFONT, 0, 0));
- DrawText(hdc,text,-1,&calcRect,DT_CALCRECT|DT_WORDBREAK);
- minX=min(minX, rc.right-(calcRect.right-calcRect.left));
- SelectObject(hdc, hfntSave);
- ReleaseDC(hWndChild,hdc);
- }
- else
- {
- minX=min(minX,rc.left);
- }
- oldChild=hWndChild;
- hWndChild=GetWindow(hWndChild,GW_HWNDNEXT);
+ GetWindowRect(hwndStatic, &rcWindow);
+ int minX = rcWindow.right;
+
+ HWND oldChild = NULL;
+ HWND hWndChild = GetWindow(hwndStatic, GW_CHILD);
+ while (hWndChild != oldChild && hWndChild != NULL) {
+ DWORD style = GetWindowLongPtr(hWndChild, GWL_STYLE);
+ RECT rc;
+ GetWindowRect(hWndChild, &rc);
+ if ((style & SS_RIGHT) && !(style & WS_TABSTOP)) {
+ RECT calcRect = rc;
+ int len = GetWindowTextLength(hWndChild);
+ TCHAR *text = (TCHAR*)_alloca(sizeof(TCHAR)*(len + 1));
+ GetWindowText(hWndChild, text, len + 1);
+ HDC hdc = GetDC(hWndChild);
+ HFONT hfntSave = (HFONT)SelectObject(hdc, (HFONT)SendMessage(hWndChild, WM_GETFONT, 0, 0));
+ DrawText(hdc, text, -1, &calcRect, DT_CALCRECT | DT_WORDBREAK);
+ minX = min(minX, rc.right - (calcRect.right - calcRect.left));
+ SelectObject(hdc, hfntSave);
+ ReleaseDC(hWndChild, hdc);
+ }
+ else minX = min(minX, rc.left);
+
+ oldChild = hWndChild;
+ hWndChild = GetWindow(hWndChild, GW_HWNDNEXT);
}
- if (minX>rcWindow.left+5)
- {
- int dx=(minX-rcWindow.left)/2;
- oldChild=NULL;
- hWndChild=GetWindow(hwndStatic,GW_CHILD);
- while (hWndChild!=oldChild && hWndChild != NULL)
- {
- DWORD style=GetWindowLongPtr(hWndChild, GWL_STYLE);
+
+ if (minX > rcWindow.left + 5) {
+ int dx = (minX - rcWindow.left) / 2;
+ oldChild = NULL;
+ hWndChild = GetWindow(hwndStatic, GW_CHILD);
+ while (hWndChild != oldChild && hWndChild != NULL) {
+ DWORD style = GetWindowLongPtr(hWndChild, GWL_STYLE);
RECT rc;
- GetWindowRect(hWndChild,&rc);
- if ((style&SS_RIGHT) && !(style&WS_TABSTOP))
- MoveWindow(hWndChild,rc.left-rcWindow.left,rc.top-rcWindow.top, rc.right-rc.left-dx, rc.bottom-rc.top, TRUE);
+ GetWindowRect(hWndChild, &rc);
+ if ((style & SS_RIGHT) && !(style & WS_TABSTOP))
+ MoveWindow(hWndChild, rc.left - rcWindow.left, rc.top - rcWindow.top, rc.right - rc.left - dx, rc.bottom - rc.top, TRUE);
else
- MoveWindow(hWndChild,rc.left-dx-rcWindow.left,rc.top-rcWindow.top, rc.right-rc.left, rc.bottom-rc.top, TRUE);
- oldChild=hWndChild;
- hWndChild=GetWindow(hWndChild,GW_HWNDNEXT);
+ MoveWindow(hWndChild, rc.left - dx - rcWindow.left, rc.top - rcWindow.top, rc.right - rc.left, rc.bottom - rc.top, TRUE);
+ oldChild = hWndChild;
+ hWndChild = GetWindow(hWndChild, GW_HWNDNEXT);
}
}
}
@@ -121,12 +115,12 @@ void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text)
for (int i = 1; i < len; i++)
if ((text[i - 1] == _T('\n')) && (text[i] != _T('\r')))
++fixedLen;
-
+
TCHAR *fixedText = NULL;
if (fixedLen != len) {
- fixedText = (TCHAR *)mir_alloc(sizeof(TCHAR) * (fixedLen+1));
+ fixedText = (TCHAR *)mir_alloc(sizeof(TCHAR) * (fixedLen + 1));
TCHAR *p = fixedText;
- for (int i=0; i < len; i++) {
+ for (int i = 0; i < len; i++) {
*p = text[i];
if (i && (text[i] == _T('\n')) && (text[i] != _T('\r'))) {
*p++ = _T('\r');
@@ -142,41 +136,40 @@ void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text)
RECT rcText;
GetWindowRect(GetDlgItem(hwndForm, IDC_INSTRUCTION), &rcText);
- int oldWidth = rcText.right-rcText.left;
- int deltaHeight = -(rcText.bottom-rcText.top);
+ int oldWidth = rcText.right - rcText.left;
+ int deltaHeight = -(rcText.bottom - rcText.top);
- SetRect(&rcText, 0, 0, rcText.right-rcText.left, 0);
+ SetRect(&rcText, 0, 0, rcText.right - rcText.left, 0);
HDC hdcEdit = GetDC(GetDlgItem(hwndForm, IDC_INSTRUCTION));
HFONT hfntSave = (HFONT)SelectObject(hdcEdit, (HFONT)SendDlgItemMessage(hwndForm, IDC_INSTRUCTION, WM_GETFONT, 0, 0));
- DrawTextEx(hdcEdit, (TCHAR *)text, (int)mir_tstrlen(text), &rcText,
- DT_CALCRECT|DT_EDITCONTROL|DT_TOP|DT_WORDBREAK, NULL);
+ DrawTextEx(hdcEdit, (TCHAR *)text, (int)mir_tstrlen(text), &rcText, DT_CALCRECT | DT_EDITCONTROL | DT_TOP | DT_WORDBREAK, NULL);
SelectObject(hdcEdit, hfntSave);
ReleaseDC(GetDlgItem(hwndForm, IDC_INSTRUCTION), hdcEdit);
RECT rcWindow; GetClientRect(hwndForm, &rcWindow);
- if (rcText.bottom-rcText.top > (rcWindow.bottom-rcWindow.top)/5) {
+ if (rcText.bottom - rcText.top > (rcWindow.bottom - rcWindow.top) / 5) {
HWND hwndEdit = GetDlgItem(hwndForm, IDC_INSTRUCTION);
SetWindowLongPtr(hwndEdit, GWL_STYLE, WS_VSCROLL | GetWindowLongPtr(hwndEdit, GWL_STYLE));
- rcText.bottom = rcText.top + (rcWindow.bottom-rcWindow.top)/5;
+ rcText.bottom = rcText.top + (rcWindow.bottom - rcWindow.top) / 5;
}
else {
HWND hwndEdit = GetDlgItem(hwndForm, IDC_INSTRUCTION);
SetWindowLongPtr(hwndEdit, GWL_STYLE, ~WS_VSCROLL & GetWindowLongPtr(hwndEdit, GWL_STYLE));
}
- deltaHeight += rcText.bottom-rcText.top;
+ deltaHeight += rcText.bottom - rcText.top;
SetWindowPos(GetDlgItem(hwndForm, IDC_INSTRUCTION), 0, 0, 0,
oldWidth,
- rcText.bottom-rcText.top,
- SWP_NOMOVE|SWP_NOZORDER);
+ rcText.bottom - rcText.top,
+ SWP_NOMOVE | SWP_NOZORDER);
GetWindowRect(GetDlgItem(hwndForm, IDC_WHITERECT), &rcText);
MapWindowPoints(NULL, hwndForm, (LPPOINT)&rcText, 2);
rcText.bottom += deltaHeight;
SetWindowPos(GetDlgItem(hwndForm, IDC_WHITERECT), 0, 0, 0,
- rcText.right-rcText.left,
- rcText.bottom-rcText.top,
- SWP_NOMOVE|SWP_NOZORDER);
+ rcText.right - rcText.left,
+ rcText.bottom - rcText.top,
+ SWP_NOMOVE | SWP_NOZORDER);
GetWindowRect(GetDlgItem(hwndForm, IDC_FRAME1), &rcText);
MapWindowPoints(NULL, hwndForm, (LPPOINT)&rcText, 2);
@@ -185,7 +178,7 @@ void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text)
rcText.left,
rcText.top,
0, 0,
- SWP_NOSIZE|SWP_NOZORDER);
+ SWP_NOSIZE | SWP_NOZORDER);
GetWindowRect(GetDlgItem(hwndForm, IDC_FRAME), &rcText);
MapWindowPoints(NULL, hwndForm, (LPPOINT)&rcText, 2);
@@ -193,8 +186,8 @@ void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text)
SetWindowPos(GetDlgItem(hwndForm, IDC_FRAME), 0,
rcText.left,
rcText.top,
- rcText.right-rcText.left,
- rcText.bottom-rcText.top,
+ rcText.right - rcText.left,
+ rcText.bottom - rcText.top,
SWP_NOZORDER);
GetWindowRect(GetDlgItem(hwndForm, IDC_VSCROLL), &rcText);
@@ -203,8 +196,8 @@ void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text)
SetWindowPos(GetDlgItem(hwndForm, IDC_VSCROLL), 0,
rcText.left,
rcText.top,
- rcText.right-rcText.left,
- rcText.bottom-rcText.top,
+ rcText.right - rcText.left,
+ rcText.bottom - rcText.top,
SWP_NOZORDER);
if (fixedText) mir_free(fixedText);
@@ -232,25 +225,23 @@ static TJabberFormControlType JabberFormTypeNameToId(const TCHAR *type)
void JabberFormLayoutSingleControl(TJabberFormControlInfo *item, TJabberFormLayoutInfo *layout_info, const TCHAR *labelStr, const TCHAR *valueStr)
{
- RECT rcLabel = {0}, rcCtrl = {0};
- if (item->hLabel)
- {
+ RECT rcLabel = { 0 }, rcCtrl = { 0 };
+ if (item->hLabel) {
SetRect(&rcLabel, 0, 0, layout_info->width, 0);
HDC hdc = GetDC(item->hLabel);
HFONT hfntSave = (HFONT)SelectObject(hdc, (HFONT)SendMessage(item->hLabel, WM_GETFONT, 0, 0));
- DrawText(hdc, labelStr, -1, &rcLabel, DT_CALCRECT|DT_WORDBREAK);
+ DrawText(hdc, labelStr, -1, &rcLabel, DT_CALCRECT | DT_WORDBREAK);
SelectObject(hdc, hfntSave);
ReleaseDC(item->hLabel, hdc);
}
int indent = layout_info->compact ? 10 : 20;
- if ((layout_info->compact && (item->type != JFORM_CTYPE_BOOLEAN) && (item->type != JFORM_CTYPE_FIXED))||
+ if ((layout_info->compact && (item->type != JFORM_CTYPE_BOOLEAN) && (item->type != JFORM_CTYPE_FIXED)) ||
(rcLabel.right >= layout_info->maxLabelWidth) ||
(rcLabel.bottom > layout_info->ctrlHeight) ||
(item->type == JFORM_CTYPE_LIST_MULTI) ||
- (item->type == JFORM_CTYPE_TEXT_MULTI))
- {
+ (item->type == JFORM_CTYPE_TEXT_MULTI)) {
int height = layout_info->ctrlHeight;
if ((item->type == JFORM_CTYPE_LIST_MULTI) || (item->type == JFORM_CTYPE_TEXT_MULTI)) height *= 3;
SetRect(&rcCtrl, indent, rcLabel.bottom, layout_info->width, rcLabel.bottom + height);
@@ -281,7 +272,7 @@ void JabberFormLayoutSingleControl(TJabberFormControlInfo *item, TJabberFormLayo
if (item->hLabel)
SetWindowPos(item->hLabel, 0, 0, 0, rcLabel.right - rcLabel.left, rcLabel.bottom - rcLabel.top, SWP_NOZORDER | SWP_NOMOVE);
if (item->hCtrl)
- SetWindowPos(item->hCtrl, 0, 0, 0, rcCtrl.right - rcCtrl.left, rcCtrl.bottom - rcCtrl.top, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(item->hCtrl, 0, 0, 0, rcCtrl.right - rcCtrl.left, rcCtrl.bottom - rcCtrl.top, SWP_NOZORDER | SWP_NOMOVE);
item->ptLabel.x = rcLabel.left;
item->ptLabel.y = rcLabel.top;
@@ -471,7 +462,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp
if (mir_tstrcmp(xmlGetName(n), _T("field")))
continue;
-
+
varStr = xmlGetAttrValue(n, _T("var"));
if ((typeName = xmlGetAttrValue(n, _T("type"))) == NULL)
continue;
@@ -522,7 +513,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp
HXML o = xmlGetChild(n, j);
if (o == NULL)
break;
-
+
if (mir_tstrcmp(xmlGetName(o), _T("option")))
continue;
if ((v = xmlGetChild(o, "value")) == NULL || xmlGetText(v) == NULL)
@@ -573,7 +564,7 @@ void JabberFormDestroyUI(HWND hwndStatic)
{
TJabberFormControlList *controls = (TJabberFormControlList *)GetWindowLongPtr(hwndStatic, GWLP_USERDATA);
if (controls) {
- for (int i=0; i < controls->getCount(); i++)
+ for (int i = 0; i < controls->getCount(); i++)
mir_free((*controls)[i]);
delete controls;
SetWindowLongPtr(hwndStatic, GWLP_USERDATA, 0);
@@ -596,8 +587,8 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode)
XmlNode x(_T("x"));
x << XATTR(_T("xmlns"), JABBER_FEAT_DATA_FORMS) << XATTR(_T("type"), _T("submit"));
- for (int i=0; ; i++) {
- n = xmlGetChild(xNode ,i);
+ for (int i = 0;; i++) {
+ n = xmlGetChild(xNode, i);
if (!n)
break;
@@ -613,14 +604,14 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode)
if (!_tcscmp(type, _T("text-multi")) || !_tcscmp(type, _T("jid-multi"))) {
len = GetWindowTextLength(GetDlgItem(hFrame, id));
- str = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len+1));
- GetDlgItemText(hFrame, id, str, len+1);
+ str = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len + 1));
+ GetDlgItemText(hFrame, id, str, len + 1);
p = str;
while (p != NULL) {
if ((q = _tcsstr(p, _T("\r\n"))) != NULL)
*q = '\0';
field << XCHILD(_T("value"), p);
- p = q ? q+2 : NULL;
+ p = q ? q + 2 : NULL;
}
mir_free(str);
id++;
@@ -634,20 +625,22 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode)
else if (!_tcscmp(type, _T("list-single"))) {
len = GetWindowTextLength(GetDlgItem(hFrame, id));
str = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len + 1));
- GetDlgItemText(hFrame, id, str, len+1);
+ GetDlgItemText(hFrame, id, str, len + 1);
v = NULL;
- for (j=0; ; j++) {
- o = xmlGetChild(n,j);
+ for (j = 0;; j++) {
+ o = xmlGetChild(n, j);
if (!o)
break;
if (!mir_tstrcmp(xmlGetName(o), _T("option"))) {
- if ((v = xmlGetChild(o , "value")) != NULL && xmlGetText(v)) {
+ if ((v = xmlGetChild(o, "value")) != NULL && xmlGetText(v)) {
if ((str2 = xmlGetAttrValue(o, _T("label"))) == NULL)
str2 = xmlGetText(v);
if (!mir_tstrcmp(str2, str))
break;
- } } }
+ }
+ }
+ }
if (o)
field << XCHILD(_T("value"), xmlGetText(v));
@@ -657,27 +650,31 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode)
}
else if (!_tcscmp(type, _T("list-multi"))) {
int count = SendMessage(hCtrl, LB_GETCOUNT, 0, 0);
- for (j=0; j<count; j++) {
+ for (j = 0; j < count; j++) {
if (SendMessage(hCtrl, LB_GETSEL, j, 0) > 0) {
// an entry is selected
len = SendMessage(hCtrl, LB_GETTEXTLEN, j, 0);
- if ((str = (TCHAR*)mir_alloc((len+1)*sizeof(TCHAR))) != NULL) {
+ 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);
+ for (k = 0;; k++) {
+ o = xmlGetChild(n, k);
if (!o)
break;
if (xmlGetName(o) && !mir_tstrcmp(xmlGetName(o), _T("option"))) {
- if ((v = xmlGetChild(o , "value")) != NULL && xmlGetText(v)) {
+ if ((v = xmlGetChild(o, "value")) != NULL && xmlGetText(v)) {
if ((labelText = xmlGetAttrValue(o, _T("label"))) == NULL)
labelText = xmlGetText(v);
if (!mir_tstrcmp(labelText, str))
field << XCHILD(_T("value"), xmlGetText(v));
- } } }
+ }
+ }
+ }
mir_free(str);
- } } }
+ }
+ }
+ }
id++;
}
else if (!_tcscmp(type, _T("fixed")) || !_tcscmp(type, _T("hidden"))) {
@@ -687,12 +684,13 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode)
}
else { // everything else is considered "text-single" or "text-private"
len = GetWindowTextLength(GetDlgItem(hFrame, id));
- str = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len+1));
- GetDlgItemText(hFrame, id, str, len+1);
+ str = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len + 1));
+ GetDlgItemText(hFrame, id, str, len + 1);
field << XCHILD(_T("value"), str);
mir_free(str);
id++;
- } }
+ }
+ }
return xi.copyNode(x);
}
@@ -718,74 +716,73 @@ static INT_PTR CALLBACK JabberFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
switch (msg) {
case WM_INITDIALOG:
- // lParam is (JABBER_FORM_INFO *)
- TranslateDialogDefault(hwndDlg);
- ShowWindow(GetDlgItem(hwndDlg, IDC_FRAME_TEXT), SW_HIDE);
- jfi = (JABBER_FORM_INFO*)lParam;
- if (jfi != NULL) {
- HXML n;
- LONG frameExStyle;
- // Set dialog title
- if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode , _T("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 , _T("instructions"))) != NULL && xmlGetText(n) != NULL)
+ // lParam is (JABBER_FORM_INFO *)
+ TranslateDialogDefault(hwndDlg);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_FRAME_TEXT), SW_HIDE);
+ jfi = (JABBER_FORM_INFO*)lParam;
+ if (jfi != NULL) {
+ HXML n;
+ LONG frameExStyle;
+ // Set dialog title
+ if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode, _T("title"))) != NULL && xmlGetText(n) != NULL)
+ SetWindowText(hwndDlg, xmlGetText(n));
+ else
+ SetWindowText(hwndDlg, TranslateTS(jfi->defTitle));
+
+ // Set instruction field
+ if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode, _T("instructions"))) != NULL && xmlGetText(n) != NULL)
+ JabberFormSetInstruction(hwndDlg, xmlGetText(n));
+ else {
+ if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode, _T("title"))) != NULL && xmlGetText(n) != NULL)
JabberFormSetInstruction(hwndDlg, xmlGetText(n));
- else {
- if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode, _T("title"))) != NULL && xmlGetText(n) != NULL)
- JabberFormSetInstruction(hwndDlg, xmlGetText(n));
- else
- JabberFormSetInstruction(hwndDlg, TranslateTS(jfi->defTitle));
- }
+ else
+ JabberFormSetInstruction(hwndDlg, TranslateTS(jfi->defTitle));
+ }
- // Create form
- if (jfi->xNode != NULL) {
- RECT rect;
- GetClientRect(GetDlgItem(hwndDlg, IDC_FRAME), &(jfi->frameRect));
- GetClientRect(GetDlgItem(hwndDlg, IDC_VSCROLL), &rect);
- jfi->frameRect.right -= (rect.right - rect.left);
- GetClientRect(GetDlgItem(hwndDlg, IDC_FRAME), &rect);
- jfi->frameHeight = rect.bottom - rect.top;
- JabberFormCreateUI(GetDlgItem(hwndDlg, IDC_FRAME), jfi->xNode, &(jfi->formHeight));
- }
+ // Create form
+ if (jfi->xNode != NULL) {
+ RECT rect;
+ GetClientRect(GetDlgItem(hwndDlg, IDC_FRAME), &(jfi->frameRect));
+ GetClientRect(GetDlgItem(hwndDlg, IDC_VSCROLL), &rect);
+ jfi->frameRect.right -= (rect.right - rect.left);
+ GetClientRect(GetDlgItem(hwndDlg, IDC_FRAME), &rect);
+ jfi->frameHeight = rect.bottom - rect.top;
+ JabberFormCreateUI(GetDlgItem(hwndDlg, IDC_FRAME), jfi->xNode, &(jfi->formHeight));
+ }
- if (jfi->formHeight > jfi->frameHeight) {
- HWND hwndScroll = GetDlgItem(hwndDlg, IDC_VSCROLL);
- EnableWindow(hwndScroll, TRUE);
- SetScrollRange(hwndScroll, SB_CTL, 0, jfi->formHeight - jfi->frameHeight, FALSE);
- jfi->curPos = 0;
- }
+ if (jfi->formHeight > jfi->frameHeight) {
+ HWND hwndScroll = GetDlgItem(hwndDlg, IDC_VSCROLL);
+ EnableWindow(hwndScroll, TRUE);
+ SetScrollRange(hwndScroll, SB_CTL, 0, jfi->formHeight - jfi->frameHeight, FALSE);
+ jfi->curPos = 0;
+ }
- // Enable WS_EX_CONTROLPARENT on IDC_FRAME (so tab stop goes through all its children)
- frameExStyle = GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FRAME), GWL_EXSTYLE);
- frameExStyle |= WS_EX_CONTROLPARENT;
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FRAME), GWL_EXSTYLE, frameExStyle);
+ // Enable WS_EX_CONTROLPARENT on IDC_FRAME (so tab stop goes through all its children)
+ frameExStyle = GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FRAME), GWL_EXSTYLE);
+ frameExStyle |= WS_EX_CONTROLPARENT;
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FRAME), GWL_EXSTYLE, frameExStyle);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) jfi);
- if (jfi->pfnSubmit != NULL)
- EnableWindow(GetDlgItem(hwndDlg, IDC_SUBMIT), TRUE);
- }
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)jfi);
+ if (jfi->pfnSubmit != NULL)
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SUBMIT), TRUE);
+ }
return TRUE;
case WM_CTLCOLORSTATIC:
if ((GetWindowLongPtr((HWND)lParam, GWL_ID) == IDC_WHITERECT) ||
(GetWindowLongPtr((HWND)lParam, GWL_ID) == IDC_INSTRUCTION) ||
- (GetWindowLongPtr((HWND)lParam, GWL_ID) == IDC_TITLE))
- {
+ (GetWindowLongPtr((HWND)lParam, GWL_ID) == IDC_TITLE)) {
return (INT_PTR)GetStockObject(WHITE_BRUSH);
}
-
return NULL;
case WM_MOUSEWHEEL:
{
short zDelta = GET_WHEEL_DELTA_WPARAM(wParam);
if (zDelta) {
- int nScrollLines=0;
+ int nScrollLines = 0;
SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, (void*)&nScrollLines, 0);
- for (int i=0; i < (nScrollLines + 1) / 2; i++)
+ for (int i = 0; i < (nScrollLines + 1) / 2; i++)
SendMessage(hwndDlg, WM_VSCROLL, (zDelta < 0) ? SB_LINEDOWN : SB_LINEUP, 0);
}
}
diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp
index 6fffd5e4ff..55e4f939d1 100644
--- a/protocols/JabberG/src/jabber_frame.cpp
+++ b/protocols/JabberG/src/jabber_frame.cpp
@@ -29,25 +29,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/////////////////////////////////////////////////////////////////////////////////////////
// CJabberInfoFrame
-class CJabberInfoFrameItem
+class CJabberInfoFrameItem : public MZeroedObject
{
public:
- char *m_pszName;
+ char *m_pszName;
HANDLE m_hIcolibIcon;
TCHAR *m_pszText;
LPARAM m_pUserData;
- bool m_bCompact;
- bool m_bShow;
- void (CJabberProto::*m_onEvent)(CJabberInfoFrame_Event *);
- RECT m_rcItem;
- int m_tooltipId;
+ bool m_bCompact;
+ bool m_bShow;
+ RECT m_rcItem;
+ int m_tooltipId;
+
+ void (CJabberProto::*m_onEvent)(CJabberInfoFrame_Event*);
public:
- CJabberInfoFrameItem(char *pszName, bool bCompact=false, LPARAM pUserData=0):
- m_pszName(NULL), m_hIcolibIcon(NULL), m_pszText(NULL), m_bShow(true), m_bCompact(bCompact), m_pUserData(pUserData), m_onEvent(NULL)
+ CJabberInfoFrameItem(char *pszName, bool bCompact = false, LPARAM pUserData = 0) :
+ m_bShow(true), m_bCompact(bCompact), m_pUserData(pUserData)
{
m_pszName = mir_strdup(pszName);
}
+
~CJabberInfoFrameItem()
{
mir_free(m_pszName);
@@ -71,12 +73,7 @@ CJabberInfoFrame::CJabberInfoFrame(CJabberProto *proto):
m_pItems(3, CJabberInfoFrameItem::cmp), m_compact(false)
{
m_proto = proto;
- m_hwnd = m_hwndToolTip = NULL;
m_clickedItem = -1;
- m_hiddenItemCount = 0;
- m_bLocked = false;
- m_nextTooltipId = 0;
- m_hhkFontsChanged = 0;
if (!proto->m_options.DisableFrame && ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
InitClass();
@@ -244,20 +241,21 @@ void CJabberInfoFrame::ReloadFonts()
FontIDT fontid = {0};
fontid.cbSize = sizeof(fontid);
- mir_tstrncpy(fontid.group, _T("Jabber"), SIZEOF(fontid.group));
- mir_tstrncpy(fontid.name, _T("Frame title"), SIZEOF(fontid.name));
+ _tcsncpy_s(fontid.group, _T("Jabber"), _TRUNCATE);
+ _tcsncpy_s(fontid.name, _T("Frame title"), _TRUNCATE);
m_clTitle = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lfFont);
DeleteObject(m_hfntTitle);
m_hfntTitle = CreateFontIndirect(&lfFont);
- mir_tstrncpy(fontid.name, _T("Frame text"), SIZEOF(fontid.name));
+
+ _tcsncpy_s(fontid.name, _T("Frame text"), _TRUNCATE);
m_clText = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lfFont);
DeleteObject(m_hfntText);
m_hfntText = CreateFontIndirect(&lfFont);
ColourIDT colourid = {0};
colourid.cbSize = sizeof(colourid);
- mir_tstrncpy(colourid.group, _T("Jabber"), SIZEOF(colourid.group));
- mir_tstrncpy(colourid.name, _T("Background"), SIZEOF(colourid.name));
+ _tcsncpy_s(colourid.group, _T("Jabber"), _TRUNCATE);
+ _tcsncpy_s(colourid.name, _T("Background"), _TRUNCATE);
m_clBack = CallService(MS_COLOUR_GETT, (WPARAM)&colourid, 0);
UpdateSize();
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index 80e6391a3f..8b57f93873 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -385,6 +385,7 @@ class CJabberDlgGcJoin: public CJabberDlgBase
public:
CJabberDlgGcJoin(CJabberProto *proto, TCHAR *jid);
+ ~CJabberDlgGcJoin();
protected:
TCHAR *m_jid;
@@ -402,6 +403,11 @@ CJabberDlgGcJoin::CJabberDlgGcJoin(CJabberProto *proto, TCHAR *jid) :
m_autoClose = 0;
}
+CJabberDlgGcJoin::~CJabberDlgGcJoin()
+{
+ mir_free(m_jid);
+}
+
void CJabberDlgGcJoin::OnInitDialog()
{
CSuper::OnInitDialog();
diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp
index 0feeee81c7..d1cff5c24a 100644
--- a/protocols/JabberG/src/jabber_iq.cpp
+++ b/protocols/JabberG/src/jabber_iq.cpp
@@ -43,7 +43,8 @@ static int ComparePermanent(const CJabberIqPermanentInfo *p1, const CJabberIqPer
CJabberIqManager::CJabberIqManager(CJabberProto *proto) :
m_arIqs(10, CompareIqs),
- m_arHandlers(10, ComparePermanent)
+ m_arHandlers(10, ComparePermanent),
+ m_bExpirerThreadShutdownRequest(false)
{
m_dwLastUsedHandle = 0;
m_hExpirerThread = NULL;
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp
index 65b656a594..60460591a1 100644
--- a/protocols/JabberG/src/jabber_iq_handlers.cpp
+++ b/protocols/JabberG/src/jabber_iq_handlers.cpp
@@ -124,7 +124,7 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE)
{
OSVERSIONINFOEX osvi = { 0 };
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
- BOOL bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi);
+ BOOL bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *)&osvi);
if (!bOsVersionInfoEx) {
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (!GetVersionEx((OSVERSIONINFO*)&osvi))
@@ -172,11 +172,11 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE)
DWORD dwType = 0;
HMODULE hKernel = GetModuleHandle(TEXT("kernel32.dll"));
- PGPI pGPI = (PGPI) GetProcAddress(hKernel, "GetProductInfo");
+ PGPI pGPI = (PGPI)GetProcAddress(hKernel, "GetProductInfo");
if (pGPI != NULL)
pGPI(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType);
- switch(dwType) {
+ switch (dwType) {
case PRODUCT_ULTIMATE:
StringCchCat(pszOS, BUFSIZE, TEXT("Ultimate Edition"));
break;
@@ -244,9 +244,9 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE)
if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) {
if (GetSystemMetrics(SM_SERVERR2))
StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2003 R2, "));
- else if (osvi.wSuiteMask==VER_SUITE_STORAGE_SERVER)
+ else if (osvi.wSuiteMask == VER_SUITE_STORAGE_SERVER)
StringCchCat(pszOS, BUFSIZE, TEXT("Windows Storage Server 2003"));
- else if (osvi.wSuiteMask==VER_SUITE_WH_SERVER)
+ else if (osvi.wSuiteMask == VER_SUITE_WH_SERVER)
StringCchCat(pszOS, BUFSIZE, TEXT("Windows Home Server"));
else if (osvi.wProductType == VER_NT_WORKSTATION && si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
StringCchCat(pszOS, BUFSIZE, TEXT("Windows XP Professional x64 Edition"));
@@ -305,7 +305,7 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE)
// Include service pack (if any) and build number.
- if ( _tcslen(osvi.szCSDVersion) > 0) {
+ if (_tcslen(osvi.szCSDVersion) > 0) {
StringCchCat(pszOS, BUFSIZE, TEXT(" "));
StringCchCat(pszOS, BUFSIZE, osvi.szCSDVersion);
}
@@ -334,7 +334,7 @@ BOOL CJabberProto::OnIqRequestVersion(HXML, CJabberIqInfo *pInfo)
query << XCHILD(_T("version"), szCoreVersion);
if (m_options.ShowOSVersion) {
- TCHAR os[256] = {0};
+ TCHAR os[256] = { 0 };
if (!GetOSDisplayString(os, SIZEOF(os)))
mir_tstrncpy(os, _T("Microsoft Windows"), SIZEOF(os));
query << XCHILD(_T("os"), os);
@@ -349,14 +349,14 @@ BOOL CJabberProto::OnIqRequestLastActivity(HXML, CJabberIqInfo *pInfo)
{
m_ThreadInfo->send(
XmlNodeIq(_T("result"), pInfo) << XQUERY(JABBER_FEAT_LAST_ACTIVITY)
- << XATTRI(_T("seconds"), m_tmJabberIdleStartTime ? time(0) - m_tmJabberIdleStartTime : 0));
+ << XATTRI(_T("seconds"), m_tmJabberIdleStartTime ? time(0) - m_tmJabberIdleStartTime : 0));
return TRUE;
}
// XEP-0199: XMPP Ping support
BOOL CJabberProto::OnIqRequestPing(HXML, CJabberIqInfo *pInfo)
{
- m_ThreadInfo->send( XmlNodeIq(_T("result"), pInfo) << XATTR(_T("from"), m_ThreadInfo->fullJID));
+ m_ThreadInfo->send(XmlNodeIq(_T("result"), pInfo) << XATTR(_T("from"), m_ThreadInfo->fullJID));
return TRUE;
}
@@ -366,9 +366,9 @@ int GetGMTOffset(void)
TIME_ZONE_INFORMATION tzinfo;
int nOffset = 0;
- DWORD dwResult= GetTimeZoneInformation(&tzinfo);
+ DWORD dwResult = GetTimeZoneInformation(&tzinfo);
- switch(dwResult) {
+ switch (dwResult) {
case TIME_ZONE_ID_STANDARD:
nOffset = tzinfo.Bias + tzinfo.StandardBias;
break;
@@ -412,7 +412,7 @@ BOOL CJabberProto::OnIqProcessIqOldTime(HXML, CJabberIqInfo *pInfo)
{
struct tm *gmt;
time_t ltime;
- TCHAR stime[ 100 ], *dtime;
+ TCHAR stime[100], *dtime;
_tzset();
time(&ltime);
@@ -421,7 +421,7 @@ BOOL CJabberProto::OnIqProcessIqOldTime(HXML, CJabberIqInfo *pInfo)
gmt->tm_year + 1900, gmt->tm_mon + 1,
gmt->tm_mday, gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
dtime = _tctime(&ltime);
- dtime[ 24 ] = 0;
+ dtime[24] = 0;
XmlNodeIq iq(_T("result"), pInfo);
HXML queryNode = iq << XQUERY(JABBER_FEAT_ENTITY_TIME_OLD);
@@ -444,15 +444,15 @@ BOOL CJabberProto::OnIqRequestAvatar(HXML, CJabberIqInfo *pInfo)
return TRUE;
TCHAR *szMimeType;
- switch(pictureType) {
- case PA_FORMAT_JPEG: szMimeType = _T("image/jpeg"); break;
- case PA_FORMAT_GIF: szMimeType = _T("image/gif"); break;
- case PA_FORMAT_PNG: szMimeType = _T("image/png"); break;
- case PA_FORMAT_BMP: szMimeType = _T("image/bmp"); break;
- default: return TRUE;
+ switch (pictureType) {
+ case PA_FORMAT_JPEG: szMimeType = _T("image/jpeg"); break;
+ case PA_FORMAT_GIF: szMimeType = _T("image/gif"); break;
+ case PA_FORMAT_PNG: szMimeType = _T("image/png"); break;
+ case PA_FORMAT_BMP: szMimeType = _T("image/bmp"); break;
+ default: return TRUE;
}
- TCHAR szFileName[ MAX_PATH ];
+ TCHAR szFileName[MAX_PATH];
GetAvatarFileName(NULL, szFileName, SIZEOF(szFileName));
FILE* in = _tfopen(szFileName, _T("rb"));
@@ -460,7 +460,7 @@ BOOL CJabberProto::OnIqRequestAvatar(HXML, CJabberIqInfo *pInfo)
return TRUE;
long bytes = _filelength(_fileno(in));
- ptrA buffer((char*)mir_alloc(bytes*4/3 + bytes + 1000));
+ ptrA buffer((char*)mir_alloc(bytes * 4 / 3 + bytes + 1000));
if (buffer == NULL) {
fclose(in);
return TRUE;
@@ -469,8 +469,8 @@ BOOL CJabberProto::OnIqRequestAvatar(HXML, CJabberIqInfo *pInfo)
fread(buffer, bytes, 1, in);
fclose(in);
- ptrA str( mir_base64_encode((PBYTE)(char*)buffer, bytes));
- m_ThreadInfo->send( XmlNodeIq(_T("result"), pInfo) << XQUERY(JABBER_FEAT_AVATAR) << XCHILD(_T("query"), _A2T(str)) << XATTR(_T("mimetype"), szMimeType));
+ ptrA str(mir_base64_encode((PBYTE)(char*)buffer, bytes));
+ m_ThreadInfo->send(XmlNodeIq(_T("result"), pInfo) << XQUERY(JABBER_FEAT_AVATAR) << XCHILD(_T("query"), _A2T(str)) << XATTR(_T("mimetype"), szMimeType));
return TRUE;
}
@@ -529,8 +529,8 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo)
const TCHAR *jid, *str;
debugLogA("<iq/> Got roster push, query has %d children", xmlGetChildCount(queryNode));
- for (int i=0; ; i++) {
- HXML itemNode = xmlGetChild(queryNode ,i);
+ for (int i = 0;; i++) {
+ HXML itemNode = xmlGetChild(queryNode, i);
if (!itemNode)
break;
@@ -641,11 +641,11 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo)
TCHAR *p = str + 7, *q;
if ((q = _tcschr(p, '/')) != NULL) {
TCHAR text[1024];
- if (q-p < SIZEOF(text)) {
- _tcsncpy_s(text, p, q-p);
- text[q-p] = '\0';
+ if (q - p < SIZEOF(text)) {
+ _tcsncpy_s(text, p, q - p);
+ text[q - p] = '\0';
if ((p = _tcschr(text, ':')) != NULL) {
- ft->httpPort = (WORD)_ttoi(p+1);
+ ft->httpPort = (WORD)_ttoi(p + 1);
*p = '\0';
}
ft->httpHostName = mir_t2a(text);
@@ -709,8 +709,8 @@ BOOL CJabberProto::OnHandleDiscoInfoRequest(HXML iqNode, CJabberIqInfo *pInfo)
// another request, send empty result
m_ThreadInfo->send(
XmlNodeIq(_T("error"), pInfo)
- << XCHILD(_T("error")) << XATTRI(_T("code"), 404) << XATTR(_T("type"), _T("cancel"))
- << XCHILDNS(_T("item-not-found"), _T("urn:ietf:params:xml:ns:xmpp-stanzas")));
+ << XCHILD(_T("error")) << XATTRI(_T("code"), 404) << XATTR(_T("type"), _T("cancel"))
+ << XCHILDNS(_T("item-not-found"), _T("urn:ietf:params:xml:ns:xmpp-stanzas")));
return TRUE;
}
@@ -732,7 +732,7 @@ BOOL CJabberProto::OnHandleDiscoItemsRequest(HXML iqNode, CJabberIqInfo *pInfo)
if (!szNode && m_options.EnableRemoteControl)
resultQuery << XCHILD(_T("item")) << XATTR(_T("jid"), m_ThreadInfo->fullJID)
- << XATTR(_T("node"), JABBER_FEAT_COMMANDS) << XATTR(_T("name"), _T("Ad-hoc commands"));
+ << XATTR(_T("node"), JABBER_FEAT_COMMANDS) << XATTR(_T("name"), _T("Ad-hoc commands"));
m_ThreadInfo->send(iq);
return TRUE;
@@ -740,11 +740,12 @@ BOOL CJabberProto::OnHandleDiscoItemsRequest(HXML iqNode, CJabberIqInfo *pInfo)
BOOL CJabberProto::AddClistHttpAuthEvent(CJabberHttpAuthParams *pParams)
{
- CLISTEVENT cle = {0};
char szService[256];
mir_snprintf(szService, SIZEOF(szService), "%s%s", m_szModuleName, JS_HTTP_AUTH);
+
+ CLISTEVENT cle = { 0 };
cle.cbSize = sizeof(CLISTEVENT);
- cle.hIcon = (HICON) LoadIconEx("openid");
+ cle.hIcon = (HICON)LoadIconEx("openid");
cle.flags = CLEF_PROTOCOLGLOBAL | CLEF_TCHAR;
cle.hDbEvent = -99;
cle.lParam = (LPARAM)pParams;
@@ -762,7 +763,7 @@ BOOL CJabberProto::OnIqHttpAuth(HXML node, CJabberIqInfo *pInfo)
if (!node || !pInfo->GetChildNode() || !pInfo->GetFrom() || !pInfo->GetIdStr())
return TRUE;
- HXML pConfirm = xmlGetChild(node , "confirm");
+ HXML pConfirm = xmlGetChild(node, "confirm");
if (!pConfirm)
return TRUE;
diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp
index d39556199e..a25abd5969 100644
--- a/protocols/JabberG/src/jabber_notes.cpp
+++ b/protocols/JabberG/src/jabber_notes.cpp
@@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "jabber_privacy.h"
#include "jabber_notes.h"
-static TCHAR *StrTrimCopy(TCHAR *str)
+static TCHAR* StrTrimCopy(TCHAR *str)
{
if (!str) return 0;
while (*str && _istspace(*str)) ++str;
@@ -284,7 +284,13 @@ class CCtrlNotebookList: public CCtrlListBox
HFONT m_hfntNormal, m_hfntSmall, m_hfntBold;
public:
- CCtrlNotebookList(CDlgBase* dlg, int ctrlId): CCtrlListBox(dlg, ctrlId) {}
+ CCtrlNotebookList(CDlgBase* dlg, int ctrlId)
+ : CCtrlListBox(dlg, ctrlId),
+ m_adding(false)
+ {
+ m_hfntNormal = m_hfntSmall = m_hfntBold = NULL;
+ }
+
void SetFonts(HFONT hfntNormal, HFONT hfntSmall, HFONT hfntBold)
{
m_hfntNormal = hfntNormal;
@@ -628,7 +634,6 @@ CJabberDlgNotes::CJabberDlgNotes(CJabberProto *proto) :
void CJabberDlgNotes::UpdateData()
{
RebuildTree();
- //ListItems(NULL);
EnableControls();
}
diff --git a/protocols/JabberG/src/jabber_notes.h b/protocols/JabberG/src/jabber_notes.h
index 9038c83cb1..b0aea48305 100644
--- a/protocols/JabberG/src/jabber_notes.h
+++ b/protocols/JabberG/src/jabber_notes.h
@@ -65,7 +65,10 @@ private:
bool m_bIsModified;
public:
- CNoteList(): OBJLIST<CNoteItem>(10, CNoteItem::cmp) {}
+ CNoteList() :
+ OBJLIST<CNoteItem>(10, CNoteItem::cmp),
+ m_bIsModified(false)
+ {}
void remove(CNoteItem *p)
{
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index dd907ce349..61190c27d7 100644
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -386,8 +386,8 @@ public:
m_btnRegister(this, IDC_BUTTON_REGISTER),
m_btnUnregister(this, IDC_UNREGISTER),
m_btnChangePassword(this, IDC_BUTTON_CHANGE_PASSWORD),
+ m_gotservers(false),
m_lnkServers(this, IDC_LINK_PUBLIC_SERVER, "http://xmpp.org/services/")
-
{
CreateLink(m_txtUsername, "LoginName", _T(""));
CreateLink(m_txtPriority, "Priority", DBVT_WORD, 0);
@@ -426,10 +426,6 @@ protected:
{
CSuper::OnInitDialog();
- int i;
-
- m_gotservers = false;
-
SendDlgItemMessage(m_hwnd, IDC_PRIORITY_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(127, -128));
TCHAR *passw = m_proto->getTStringA(NULL, "Password");
@@ -442,7 +438,7 @@ protected:
// fill predefined resources
TCHAR *szResources[] = { _T("Home"), _T("Work"), _T("Office"), _T("Miranda") };
- for (i=0; i < SIZEOF(szResources); i++)
+ for (int i=0; i < SIZEOF(szResources); i++)
m_cbResource.AddString(szResources[i]);
// append computer name to the resource list
@@ -459,7 +455,7 @@ protected:
}
else m_cbResource.SetText(_T("Miranda"));
- for (i=0; g_LanguageCodes[i].szCode; i++) {
+ for (int i=0; g_LanguageCodes[i].szCode; i++) {
int iItem = m_cbLocale.AddString(TranslateTS(g_LanguageCodes[i].szDescription), (LPARAM)g_LanguageCodes[i].szCode);
if (!_tcscmp(m_proto->m_tszSelectedLang, g_LanguageCodes[i].szCode))
m_cbLocale.SetCurSel(iItem);
@@ -1758,8 +1754,6 @@ protected:
break;
case ACC_FBOOK:
- m_proto->m_options.IgnoreRosterGroups = TRUE;
-
case ACC_OK:
m_proto->m_options.IgnoreRosterGroups = TRUE;
m_proto->m_options.UseSSL = FALSE;
diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp
index 6524052d4b..54f783b2bc 100644
--- a/protocols/JabberG/src/jabber_secur.cpp
+++ b/protocols/JabberG/src/jabber_secur.cpp
@@ -42,17 +42,16 @@ TNtlmAuth::TNtlmAuth(ThreadData *info, const char* mechanism, const TCHAR *hostn
else if (!strcmp(mechanism, "NTLM"))
szProvider = _T("NTLM");
else {
+LBL_Invalid:
bIsValid = false;
+ hProvider = NULL;
return;
}
TCHAR szSpn[1024] = _T("");
- if (strcmp(mechanism, "NTLM")) {
- if (!getSpn(szSpn, SIZEOF(szSpn)) && !strcmp(mechanism, "GSSAPI")) {
- bIsValid = false;
- return;
- }
- }
+ if (strcmp(mechanism, "NTLM"))
+ if (!getSpn(szSpn, SIZEOF(szSpn)) && !strcmp(mechanism, "GSSAPI"))
+ goto LBL_Invalid;
if ((hProvider = Netlib_InitSecurityProvider2(szProvider, szSpn)) == NULL)
bIsValid = false;
@@ -357,6 +356,7 @@ char* TPlainAuth::getInitialRequest()
TJabberAuth::TJabberAuth(ThreadData* pInfo) :
bIsValid(true),
+ complete(0),
szName(NULL),
info(pInfo)
{
diff --git a/protocols/JabberG/src/jabber_secur.h b/protocols/JabberG/src/jabber_secur.h
index 56f40fe28e..c69e130ac6 100644
--- a/protocols/JabberG/src/jabber_secur.h
+++ b/protocols/JabberG/src/jabber_secur.h
@@ -28,12 +28,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
class TJabberAuth
{
-
-protected: bool bIsValid;
+protected: bool bIsValid;
const char* szName;
- unsigned complete;
- ThreadData *info;
-
+ unsigned complete;
+ ThreadData *info;
public:
TJabberAuth(ThreadData*);
virtual ~TJabberAuth();
diff --git a/protocols/JabberG/src/jabber_std.cpp b/protocols/JabberG/src/jabber_std.cpp
index 284730a048..ecda372e98 100644
--- a/protocols/JabberG/src/jabber_std.cpp
+++ b/protocols/JabberG/src/jabber_std.cpp
@@ -78,7 +78,8 @@ void CJabberProto::ConvertPasswords()
break;
mir_snprintf(varName, SIZEOF(varName), "rcMuc_%d", i);
- if ((passw = JSetStringCrypt(m_szModuleName, NULL, varName)) != NULL) {
+ ptrT passw(JSetStringCrypt(m_szModuleName, NULL, varName));
+ if (passw != NULL) {
delSetting(varName);
mir_snprintf(varName, SIZEOF(varName), "password_rcMuc_%d", i);
diff --git a/protocols/JabberG/src/jabber_treelist.cpp b/protocols/JabberG/src/jabber_treelist.cpp
index 1f05b48a2b..1c3059e9d7 100644
--- a/protocols/JabberG/src/jabber_treelist.cpp
+++ b/protocols/JabberG/src/jabber_treelist.cpp
@@ -71,6 +71,7 @@ struct TTreeList_Data
filter = NULL;
mode = TLM_TREE;
root = NULL;
+ hItemSelected = NULL;
}
~TTreeList_Data()
{
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp
index 651eeef617..2f128c7720 100644
--- a/protocols/JabberG/src/jabber_xstatus.cpp
+++ b/protocols/JabberG/src/jabber_xstatus.cpp
@@ -56,7 +56,8 @@ private:
CJabberDlgPepBase::CJabberDlgPepBase(CJabberProto *proto, int id):
CJabberDlgBase(proto, id, NULL),
m_btnOk(this, IDOK),
- m_btnCancel(this, IDCANCEL)
+ m_btnCancel(this, IDCANCEL),
+ m_time(5)
{
}
@@ -64,7 +65,6 @@ void CJabberDlgPepBase::OnInitDialog()
{
CSuper::OnInitDialog();
- m_time = 5;
SetTimer(m_hwnd, 1, 1000, NULL);
TCHAR buf[128];
@@ -114,6 +114,7 @@ void CJabberDlgPepBase::StopTimer()
///////////////////////////////////////////////////////////////////////////////
// Simple PEP status
+
class CJabberDlgPepSimple: public CJabberDlgPepBase
{
typedef CJabberDlgPepBase CSuper;
@@ -374,7 +375,8 @@ CPepService::CPepService(CJabberProto *proto, char *name, TCHAR *node):
m_proto(proto),
m_name(name),
m_node(node),
- m_hMenuItem(NULL)
+ m_hMenuItem(NULL),
+ m_wasPublished(false)
{
}
@@ -391,7 +393,7 @@ void CPepService::Publish()
<< XCHILD(_T("item")) << XATTR(_T("id"), _T("current")));
m_proto->m_ThreadInfo->send(iq);
- m_wasPublished = TRUE;
+ m_wasPublished = true;
}
void CPepService::Retract()
@@ -411,7 +413,7 @@ void CPepService::Retract()
void CPepService::ResetPublish()
{
- m_wasPublished = FALSE;
+ m_wasPublished = false;
}
void CPepService::ForceRepublishOnLogin()
diff --git a/protocols/JabberG/src/jabber_xstatus.h b/protocols/JabberG/src/jabber_xstatus.h
index d7a41e8129..1fd27d5c2b 100644
--- a/protocols/JabberG/src/jabber_xstatus.h
+++ b/protocols/JabberG/src/jabber_xstatus.h
@@ -50,12 +50,11 @@ public:
protected:
CJabberProto *m_proto;
+ bool m_wasPublished;
char *m_name;
TCHAR *m_node;
HGENMENU m_hMenuItem;
- int m_wasPublished;
-
virtual void CreateData(HXML) = 0;
void ForceRepublishOnLogin();
};