summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-10 23:33:35 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-10 23:33:35 +0000
commit18448e7014c32235db05465f1bf76b30f9954029 (patch)
treeebf78a23f27c92eeff9ad3d185258ea8fe029e97 /protocols/JabberG
parent452fb59c22573ddf7939bea02b5e58f4f2e3916c (diff)
GCDEST::pszModule and GCDEST::ptszID must be constant
git-svn-id: http://svn.miranda-ng.org/main/trunk@7586 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG')
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp2
-rw-r--r--protocols/JabberG/src/jabber_form.cpp393
2 files changed, 191 insertions, 204 deletions
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index abc5ac5dcf..8fadba06dc 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -699,7 +699,7 @@ class CGroupchatInviteDlg : public CJabberDlgBase
}
public:
- CGroupchatInviteDlg(CJabberProto *ppro, TCHAR *room) :
+ CGroupchatInviteDlg(CJabberProto *ppro, const TCHAR *room) :
CSuper(ppro, IDD_GROUPCHAT_INVITE, NULL),
m_newJids(1),
m_btnInvite(this, IDC_INVITE),
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp
index 69f79832f8..90d06a099a 100644
--- a/protocols/JabberG/src/jabber_form.cpp
+++ b/protocols/JabberG/src/jabber_form.cpp
@@ -224,7 +224,7 @@ static TJabberFormControlType JabberFormTypeNameToId(const TCHAR *type)
return JFORM_CTYPE_FIXED;
if (!_tcscmp(type, _T("hidden")))
return JFORM_CTYPE_HIDDEN;
- // else
+
return JFORM_CTYPE_TEXT_SINGLE;
}
@@ -252,40 +252,34 @@ void JabberFormLayoutSingleControl(TJabberFormControlInfo *item, TJabberFormLayo
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);
- } else
- if (item->type == JFORM_CTYPE_BOOLEAN)
- {
- SetRect(&rcCtrl, 0, 0, layout_info->width-20, 0);
+ }
+ else if (item->type == JFORM_CTYPE_BOOLEAN) {
+ SetRect(&rcCtrl, 0, 0, layout_info->width - 20, 0);
HDC hdc = GetDC(item->hCtrl);
HFONT hfntSave = (HFONT)SelectObject(hdc, (HFONT)SendMessage(item->hCtrl, WM_GETFONT, 0, 0));
- DrawText(hdc, labelStr, -1, &rcCtrl, DT_CALCRECT|DT_RIGHT|DT_WORDBREAK);
+ DrawText(hdc, labelStr, -1, &rcCtrl, DT_CALCRECT | DT_RIGHT | DT_WORDBREAK);
SelectObject(hdc, hfntSave);
ReleaseDC(item->hCtrl, hdc);
rcCtrl.right += 20;
- } else
- if (item->type == JFORM_CTYPE_FIXED)
- {
+ }
+ else if (item->type == JFORM_CTYPE_FIXED) {
SetRect(&rcCtrl, 0, 0, layout_info->width, 0);
HDC hdc = GetDC(item->hCtrl);
HFONT hfntSave = (HFONT)SelectObject(hdc, (HFONT)SendMessage(item->hCtrl, WM_GETFONT, 0, 0));
- DrawText(hdc, valueStr, -1, &rcCtrl, DT_CALCRECT|DT_EDITCONTROL);
+ DrawText(hdc, valueStr, -1, &rcCtrl, DT_CALCRECT | DT_EDITCONTROL);
rcCtrl.right += 20;
SelectObject(hdc, hfntSave);
ReleaseDC(item->hCtrl, hdc);
- } else
- {
- SetRect(&rcCtrl, rcLabel.right+5, 0, layout_info->width, layout_info->ctrlHeight);
+ }
+ else {
+ SetRect(&rcCtrl, rcLabel.right + 5, 0, layout_info->width, layout_info->ctrlHeight);
rcLabel.bottom = rcCtrl.bottom;
}
if (item->hLabel)
- SetWindowPos(item->hLabel, 0,
- 0, 0, rcLabel.right-rcLabel.left, rcLabel.bottom-rcLabel.top,
- SWP_NOZORDER|SWP_NOMOVE);
+ 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;
@@ -302,8 +296,7 @@ void JabberFormLayoutSingleControl(TJabberFormControlInfo *item, TJabberFormLayo
TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayoutInfo *layout_info, TJabberFormControlType type, const TCHAR *labelStr, const TCHAR *valueStr)
{
TJabberFormControlList *controls = (TJabberFormControlList *)GetWindowLongPtr(hwndStatic, GWLP_USERDATA);
- if (!controls)
- {
+ if (!controls) {
controls = new TJabberFormControlList(5);
SetWindowLongPtr(hwndStatic, GWLP_USERDATA, (LONG_PTR)controls);
}
@@ -312,82 +305,72 @@ TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayo
item->type = type;
item->hLabel = item->hCtrl = NULL;
- switch (type)
- {
- case JFORM_CTYPE_TEXT_PRIVATE:
- {
- item->hLabel = JabberFormCreateLabel();
- item->hCtrl = CreateWindowEx(WS_EX_CLIENTEDGE, _T("edit"), valueStr,
- WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_LEFT|ES_AUTOHSCROLL|ES_PASSWORD,
- 0, 0, 0, 0,
- hwndStatic, (HMENU) layout_info->id, hInst, NULL);
- ++layout_info->id;
- break;
- }
- case JFORM_CTYPE_TEXT_MULTI:
- {
- item->hLabel = JabberFormCreateLabel();
- item->hCtrl = CreateWindowEx(WS_EX_CLIENTEDGE, _T("edit"), valueStr,
- WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_VSCROLL|ES_LEFT|ES_MULTILINE|ES_AUTOVSCROLL|ES_WANTRETURN,
- 0, 0, 0, 0,
- hwndStatic, (HMENU) layout_info->id, hInst, NULL);
- mir_subclassWindow(item->hCtrl, JabberFormMultiLineWndProc);
- ++layout_info->id;
- break;
- }
- case JFORM_CTYPE_BOOLEAN:
- {
- item->hCtrl = CreateWindowEx(0, _T("button"), labelStr,
- WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_AUTOCHECKBOX|BS_MULTILINE,
- 0, 0, 0, 0,
- hwndStatic, (HMENU) layout_info->id, hInst, NULL);
- if (valueStr && !_tcscmp(valueStr, _T("1")))
- SendMessage(item->hCtrl, BM_SETCHECK, 1, 0);
- ++layout_info->id;
- break;
- }
- case JFORM_CTYPE_LIST_SINGLE:
- {
- item->hLabel = JabberFormCreateLabel();
- item->hCtrl = CreateWindowExA(WS_EX_CLIENTEDGE, "combobox", NULL,
- WS_CHILD|WS_VISIBLE|WS_TABSTOP|CBS_DROPDOWNLIST,
- 0, 0, 0, 0,
- hwndStatic, (HMENU) layout_info->id, hInst, NULL);
- ++layout_info->id;
- break;
- }
- case JFORM_CTYPE_LIST_MULTI:
- {
- item->hLabel = JabberFormCreateLabel();
- item->hCtrl = CreateWindowExA(WS_EX_CLIENTEDGE, "listbox",
- NULL, WS_CHILD|WS_VISIBLE|WS_TABSTOP|LBS_MULTIPLESEL,
- 0, 0, 0, 0,
- hwndStatic, (HMENU) layout_info->id, hInst, NULL);
- ++layout_info->id;
- break;
- }
- case JFORM_CTYPE_FIXED:
- {
- item->hCtrl = CreateWindow(_T("edit"), valueStr,
- WS_CHILD|WS_VISIBLE|ES_MULTILINE|ES_READONLY|ES_AUTOHSCROLL,
- 0, 0, 0, 0,
- hwndStatic, (HMENU)-1, hInst, NULL);
- break;
- }
- case JFORM_CTYPE_HIDDEN:
- {
- break;
- }
- case JFORM_CTYPE_TEXT_SINGLE:
- {
- item->hLabel = labelStr ? (JabberFormCreateLabel()) : NULL;
- item->hCtrl = CreateWindowEx(WS_EX_CLIENTEDGE, _T("edit"), valueStr,
- WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_LEFT|ES_AUTOHSCROLL,
- 0, 0, 0, 0,
- hwndStatic, (HMENU) layout_info->id, hInst, NULL);
- ++layout_info->id;
- break;
- }
+ switch (type) {
+ case JFORM_CTYPE_TEXT_PRIVATE:
+ item->hLabel = JabberFormCreateLabel();
+ item->hCtrl = CreateWindowEx(WS_EX_CLIENTEDGE, _T("edit"), valueStr,
+ WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_AUTOHSCROLL | ES_PASSWORD,
+ 0, 0, 0, 0,
+ hwndStatic, (HMENU)layout_info->id, hInst, NULL);
+ ++layout_info->id;
+ break;
+
+ case JFORM_CTYPE_TEXT_MULTI:
+ item->hLabel = JabberFormCreateLabel();
+ item->hCtrl = CreateWindowEx(WS_EX_CLIENTEDGE, _T("edit"), valueStr,
+ WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN,
+ 0, 0, 0, 0,
+ hwndStatic, (HMENU)layout_info->id, hInst, NULL);
+ mir_subclassWindow(item->hCtrl, JabberFormMultiLineWndProc);
+ ++layout_info->id;
+ break;
+
+ case JFORM_CTYPE_BOOLEAN:
+ item->hCtrl = CreateWindowEx(0, _T("button"), labelStr,
+ WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX | BS_MULTILINE,
+ 0, 0, 0, 0,
+ hwndStatic, (HMENU)layout_info->id, hInst, NULL);
+ if (valueStr && !_tcscmp(valueStr, _T("1")))
+ SendMessage(item->hCtrl, BM_SETCHECK, 1, 0);
+ ++layout_info->id;
+ break;
+
+ case JFORM_CTYPE_LIST_SINGLE:
+ item->hLabel = JabberFormCreateLabel();
+ item->hCtrl = CreateWindowExA(WS_EX_CLIENTEDGE, "combobox", NULL,
+ WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST,
+ 0, 0, 0, 0,
+ hwndStatic, (HMENU)layout_info->id, hInst, NULL);
+ ++layout_info->id;
+ break;
+
+ case JFORM_CTYPE_LIST_MULTI:
+ item->hLabel = JabberFormCreateLabel();
+ item->hCtrl = CreateWindowExA(WS_EX_CLIENTEDGE, "listbox",
+ NULL, WS_CHILD | WS_VISIBLE | WS_TABSTOP | LBS_MULTIPLESEL,
+ 0, 0, 0, 0,
+ hwndStatic, (HMENU)layout_info->id, hInst, NULL);
+ ++layout_info->id;
+ break;
+
+ case JFORM_CTYPE_FIXED:
+ item->hCtrl = CreateWindow(_T("edit"), valueStr,
+ WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_READONLY | ES_AUTOHSCROLL,
+ 0, 0, 0, 0,
+ hwndStatic, (HMENU)-1, hInst, NULL);
+ break;
+
+ case JFORM_CTYPE_HIDDEN:
+ break;
+
+ case JFORM_CTYPE_TEXT_SINGLE:
+ item->hLabel = labelStr ? (JabberFormCreateLabel()) : NULL;
+ item->hCtrl = CreateWindowEx(WS_EX_CLIENTEDGE, _T("edit"), valueStr,
+ WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_AUTOHSCROLL,
+ 0, 0, 0, 0,
+ hwndStatic, (HMENU)layout_info->id, hInst, NULL);
+ ++layout_info->id;
+ break;
}
HFONT hFont = (HFONT)SendMessage(GetParent(hwndStatic), WM_GETFONT, 0, 0);
@@ -400,11 +383,10 @@ TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayo
return item;
}
-void JabberFormAddListItem(TJabberFormControlInfo *item, TCHAR *text, bool selected)
+void JabberFormAddListItem(TJabberFormControlInfo *item, const TCHAR *text, bool selected)
{
DWORD dwIndex;
- switch (item->type)
- {
+ switch (item->type) {
case JFORM_CTYPE_LIST_MULTI:
dwIndex = SendMessage(item->hCtrl, LB_ADDSTRING, 0, (LPARAM)text);
if (selected) SendMessage(item->hCtrl, LB_SETSEL, TRUE, dwIndex);
@@ -421,16 +403,15 @@ void JabberFormLayoutControls(HWND hwndStatic, TJabberFormLayoutInfo *layout_inf
TJabberFormControlList *controls = (TJabberFormControlList *)GetWindowLongPtr(hwndStatic, GWLP_USERDATA);
if (!controls) return;
- for (int i=0; i < controls->getCount(); i++)
- {
+ for (int i = 0; i < controls->getCount(); i++) {
if ((*controls)[i]->hLabel)
SetWindowPos((*controls)[i]->hLabel, 0,
- layout_info->offset+(*controls)[i]->ptLabel.x, layout_info->y_pos+(*controls)[i]->ptLabel.y, 0, 0,
- SWP_NOZORDER|SWP_NOSIZE);
+ layout_info->offset + (*controls)[i]->ptLabel.x, layout_info->y_pos + (*controls)[i]->ptLabel.y, 0, 0,
+ SWP_NOZORDER | SWP_NOSIZE);
if ((*controls)[i]->hCtrl)
SetWindowPos((*controls)[i]->hCtrl, 0,
- layout_info->offset+(*controls)[i]->ptCtrl.x, layout_info->y_pos+(*controls)[i]->ptCtrl.y, 0, 0,
- SWP_NOZORDER|SWP_NOSIZE);
+ layout_info->offset + (*controls)[i]->ptCtrl.x, layout_info->y_pos + (*controls)[i]->ptCtrl.y, 0, 0,
+ SWP_NOZORDER | SWP_NOSIZE);
layout_info->y_pos += (*controls)[i]->szBlock.cy;
layout_info->y_pos += layout_info->y_spacing;
@@ -450,7 +431,7 @@ HJFORMLAYOUT JabberFormCreateLayout(HWND hwndStatic)
layout_info->id = 0;
layout_info->width = frameRect.right - frameRect.left - 20 - 10;
layout_info->y_spacing = 5;
- layout_info->maxLabelWidth = layout_info->width*2/5;
+ layout_info->maxLabelWidth = layout_info->width * 2 / 5;
layout_info->offset = 10;
layout_info->y_pos = 14;
return layout_info;
@@ -462,12 +443,12 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp
HXML v, vs;
- int i, j, k;
const TCHAR *label, *typeName, *varStr, *str, *valueText;
- TCHAR *labelStr, *valueStr, *p;
+ TCHAR *labelStr, *valueStr;
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);
@@ -478,99 +459,110 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp
layout_info.width = frameRect.right - frameRect.left - 20;
if (!bCompact) layout_info.width -= 10;
layout_info.y_spacing = bCompact ? 1 : 5;
- layout_info.maxLabelWidth = layout_info.width*2/5;
+ layout_info.maxLabelWidth = layout_info.width * 2 / 5;
layout_info.offset = 10;
layout_info.y_pos = bCompact ? 0 : 14;
- for (i=0; ; i++) {
- HXML n = xmlGetChild(xNode ,i);
+ for (int i = 0;; i++) {
+ HXML n = xmlGetChild(xNode, i);
if (!n)
break;
- if (xmlGetName(n)) {
- if (!lstrcmp(xmlGetName(n), _T("field"))) {
- varStr = xmlGetAttrValue(n, _T("var"));
- if ((typeName = xmlGetAttrValue(n, _T("type"))) != NULL) {
- if ((label = xmlGetAttrValue(n, _T("label"))) != NULL)
- labelStr = mir_tstrdup(label);
- else
- labelStr = mir_tstrdup(varStr);
-
- TJabberFormControlType type = JabberFormTypeNameToId(typeName);
-
- if ((v = xmlGetChild(n, "value")) != NULL) {
- valueText = xmlGetText(v);
- if (type != JFORM_CTYPE_TEXT_MULTI)
- valueStr = mir_tstrdup(valueText);
- else {
- size_t size = 1;
- for (j=0; ; j++) {
- v = xmlGetChild(n,j);
- if (!v)
- break;
- if (xmlGetName(v) && !lstrcmp(xmlGetName(v), _T("value")) && xmlGetText(v))
- size += _tcslen(xmlGetText(v)) + 2;
- }
- valueStr = (TCHAR*)mir_alloc(sizeof(TCHAR)*size);
- valueStr[0] = '\0';
- for (j=0; ; j++) {
- v = xmlGetChild(n,j);
- if (!v)
- break;
- if (xmlGetName(v) && !lstrcmp(xmlGetName(v), _T("value")) && xmlGetText(v)) {
- if (valueStr[0])
- _tcscat(valueStr, _T("\r\n"));
- _tcscat(valueStr, xmlGetText(v));
- } }
- }
+ if (lstrcmp(xmlGetName(n), _T("field")))
+ continue;
+
+ varStr = xmlGetAttrValue(n, _T("var"));
+ if ((typeName = xmlGetAttrValue(n, _T("type"))) == NULL)
+ continue;
+
+ if ((label = xmlGetAttrValue(n, _T("label"))) != NULL)
+ labelStr = mir_tstrdup(label);
+ else
+ labelStr = mir_tstrdup(varStr);
+
+ TJabberFormControlType type = JabberFormTypeNameToId(typeName);
+
+ if ((v = xmlGetChild(n, "value")) != NULL) {
+ valueText = xmlGetText(v);
+ if (type != JFORM_CTYPE_TEXT_MULTI)
+ valueStr = mir_tstrdup(valueText);
+ else {
+ size_t size = 1;
+ for (int j = 0;; j++) {
+ v = xmlGetChild(n, j);
+ if (!v)
+ break;
+ if (xmlGetName(v) && !lstrcmp(xmlGetName(v), _T("value")) && xmlGetText(v))
+ size += _tcslen(xmlGetText(v)) + 2;
+ }
+ valueStr = (TCHAR*)mir_alloc(sizeof(TCHAR)*size);
+ valueStr[0] = '\0';
+ for (int j = 0;; j++) {
+ v = xmlGetChild(n, j);
+ if (!v)
+ break;
+ if (xmlGetName(v) && !lstrcmp(xmlGetName(v), _T("value")) && xmlGetText(v)) {
+ if (valueStr[0])
+ _tcscat(valueStr, _T("\r\n"));
+ _tcscat(valueStr, xmlGetText(v));
}
- else valueText = valueStr = NULL;
+ }
+ }
+ }
+ else valueText = valueStr = NULL;
- TJabberFormControlInfo *item = JabberFormAppendControl(hwndStatic, &layout_info, type, labelStr, valueStr);
+ TJabberFormControlInfo *item = JabberFormAppendControl(hwndStatic, &layout_info, type, labelStr, valueStr);
- mir_free(labelStr);
- mir_free(valueStr);
+ mir_free(labelStr);
+ mir_free(valueStr);
- if (type == JFORM_CTYPE_LIST_SINGLE) {
- for (j=0; ; j++) {
- 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)) {
- if ((str = xmlGetAttrValue(o, _T("label"))) == NULL)
- str = xmlGetText(v);
- if ((p = mir_tstrdup(str)) != NULL) {
- bool selected = false;
- if (valueText != NULL && !_tcscmp(valueText, xmlGetText(v)))
- selected = true;
- JabberFormAddListItem(item, p, selected);
- mir_free(p);
- } } } }
+ if (type == JFORM_CTYPE_LIST_SINGLE) {
+ for (int j = 0;; j++) {
+ HXML o = xmlGetChild(n, j);
+ if (o == NULL)
+ break;
+
+ if (lstrcmp(xmlGetName(o), _T("option")))
+ continue;
+ if ((v = xmlGetChild(o, "value")) == NULL || xmlGetText(v) == NULL)
+ continue;
+ if ((str = xmlGetAttrValue(o, _T("label"))) == NULL)
+ str = xmlGetText(v);
+ if (str == NULL)
+ continue;
+
+ bool selected = !lstrcmp(valueText, xmlGetText(v));
+ JabberFormAddListItem(item, str, selected);
+ }
+ }
+ else if (type == JFORM_CTYPE_LIST_MULTI) {
+ for (int j = 0;; j++) {
+ HXML o = xmlGetChild(n, j);
+ if (o == NULL)
+ break;
+
+ if (lstrcmp(xmlGetName(o), _T("option")))
+ continue;
+ if ((v = xmlGetChild(o, "value")) == NULL || xmlGetText(v) == NULL)
+ continue;
+ if ((str = xmlGetAttrValue(o, _T("label"))) == NULL)
+ str = xmlGetText(v);
+ if (str == NULL)
+ continue;
+
+ bool selected = false;
+ for (int k = 0;; k++) {
+ vs = xmlGetChild(n, k);
+ if (!vs)
+ break;
+ if (!lstrcmp(xmlGetName(vs), _T("value")) && !lstrcmp(xmlGetText(vs), xmlGetText(v))) {
+ selected = true;
+ break;
}
- else if (type == JFORM_CTYPE_LIST_MULTI) {
- for (j=0; ; j++) {
- 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)) {
- if ((str = xmlGetAttrValue(o, _T("label"))) == NULL)
- str = xmlGetText(v);
- if ((p = mir_tstrdup(str)) != NULL) {
- bool selected = false;
- for (k=0; ; k++) {
- vs = xmlGetChild(n,k);
- if (!vs)
- break;
- if (!lstrcmp(xmlGetName(vs), _T("value")) && xmlGetText(vs) && !_tcscmp(xmlGetText(vs), xmlGetText(v)))
- {
- selected = true;
- break;
- }
- }
- JabberFormAddListItem(item, p, selected);
- mir_free(p);
- } } } } } } } } }
+ }
+ JabberFormAddListItem(item, str, selected);
+ }
+ }
+ }
JabberFormLayoutControls(hwndStatic, &layout_info, formHeight);
}
@@ -720,7 +712,7 @@ struct JABBER_FORM_INFO
static INT_PTR CALLBACK JabberFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- JABBER_FORM_INFO *jfi;
+ JABBER_FORM_INFO *jfi = (JABBER_FORM_INFO*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
@@ -731,7 +723,7 @@ static INT_PTR CALLBACK JabberFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
// lParam is (JABBER_FORM_INFO *)
TranslateDialogDefault(hwndDlg);
ShowWindow(GetDlgItem(hwndDlg, IDC_FRAME_TEXT), SW_HIDE);
- jfi = (JABBER_FORM_INFO *) lParam;
+ jfi = (JABBER_FORM_INFO*)lParam;
if (jfi != NULL) {
// Set dialog title
if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode , "title")) != NULL && xmlGetText(n) != NULL)
@@ -741,9 +733,8 @@ static INT_PTR CALLBACK JabberFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
// Set instruction field
if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode , "instructions")) != NULL && xmlGetText(n) != NULL)
JabberFormSetInstruction(hwndDlg, xmlGetText(n));
- else
- {
- if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode , "title")) != NULL && xmlGetText(n) != NULL)
+ else {
+ if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode, "title")) != NULL && xmlGetText(n) != NULL)
JabberFormSetInstruction(hwndDlg, xmlGetText(n));
else if (jfi->defTitle != NULL)
JabberFormSetInstruction(hwndDlg, TranslateTS(jfi->defTitle));
@@ -752,7 +743,6 @@ static INT_PTR CALLBACK JabberFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
// 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);
@@ -805,7 +795,6 @@ static INT_PTR CALLBACK JabberFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
case WM_VSCROLL:
- jfi = (JABBER_FORM_INFO *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (jfi != NULL) {
int pos = jfi->curPos;
switch (LOWORD(wParam)) {
@@ -840,7 +829,6 @@ static INT_PTR CALLBACK JabberFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_SUBMIT:
- jfi = (JABBER_FORM_INFO *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (jfi != NULL) {
HXML n = JabberFormGetData(GetDlgItem(hwndDlg, IDC_FRAME), jfi->xNode);
(jfi->ppro->*(jfi->pfnSubmit))(n, jfi->userdata);
@@ -860,7 +848,6 @@ static INT_PTR CALLBACK JabberFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
case WM_DESTROY:
JabberFormDestroyUI(GetDlgItem(hwndDlg, IDC_FRAME));
- jfi = (JABBER_FORM_INFO *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
delete jfi;
break;
}
@@ -893,4 +880,4 @@ JABBER_FORM_INFO::~JABBER_FORM_INFO()
{
xi.destroyNode(xNode);
mir_free(userdata);
-} \ No newline at end of file
+}