diff options
Diffstat (limited to 'protocols/JabberG')
-rw-r--r-- | protocols/JabberG/res/jabber.rc | 92 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_chat.cpp | 248 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_groupchat.cpp | 359 | ||||
-rw-r--r-- | protocols/JabberG/src/resource.h | 43 |
4 files changed, 305 insertions, 437 deletions
diff --git a/protocols/JabberG/res/jabber.rc b/protocols/JabberG/res/jabber.rc index 3bc42153e4..c10fb82dc0 100644 --- a/protocols/JabberG/res/jabber.rc +++ b/protocols/JabberG/res/jabber.rc @@ -163,13 +163,6 @@ BEGIN CONTROL "",IDC_TV_INFO,"SysTreeView32",TVS_HASBUTTONS | TVS_DISABLEDRAGDROP | TVS_FULLROWSELECT | WS_BORDER | WS_TABSTOP,5,5,211,141
END
-IDD_DATAFORM_PAGE DIALOGEX 0, 0, 250, 239
-STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_SYSMENU
-EXSTYLE WS_EX_CONTROLPARENT | WS_EX_STATICEDGE
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
-END
-
IDD_OPT_REGISTER DIALOGEX 0, 0, 173, 69
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION
CAPTION "Jabber Account Registration"
@@ -180,31 +173,6 @@ BEGIN DEFPUSHBUTTON "OK",IDOK,55,50,50,14
END
-IDD_AGENTS DIALOGEX 0, 0, 294, 254
-STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-EXSTYLE WS_EX_CONTROLPARENT
-CAPTION "Jabber Agents"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- GROUPBOX "Register/Search Jabber Agents",IDC_STATIC,7,7,280,115
- LTEXT "Jabber server:",IDC_STATIC,13,20,47,8
- EDITTEXT IDC_AGENT_SERVER,65,19,136,12,ES_AUTOHSCROLL
- DEFPUSHBUTTON "Browse",IDC_AGENT_BROWSE,209,19,46,13,WS_DISABLED
- CONTROL "List1",IDC_AGENT_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,13,36,267,60
- PUSHBUTTON "Register...",IDC_AGENT_REGISTER,13,100,50,14,WS_DISABLED
- PUSHBUTTON "Browse/Join chat room...",IDC_JOIN,69,100,93,14,WS_DISABLED
- PUSHBUTTON "Search...",IDC_AGENT_SEARCH,171,100,50,14,NOT WS_VISIBLE | WS_DISABLED
- GROUPBOX "Registered Jabber Transports",IDC_STATIC,7,128,280,99
- CONTROL "List1",IDC_AGENT_TRANSPORT,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,13,142,267,60
- PUSHBUTTON "Log on",IDC_AGENT_LOGON,13,206,50,14,WS_DISABLED
- PUSHBUTTON "Log off",IDC_AGENT_LOGOFF,69,206,50,14,WS_DISABLED
- PUSHBUTTON "Unregister",IDC_AGENT_UNREGISTER,125,206,50,14,WS_DISABLED
- PUSHBUTTON "Register with a new service...",IDC_MANUAL_REGISTER,7,233,106,14
- PUSHBUTTON "Close",IDCLOSE,237,233,50,14
- PUSHBUTTON "Command",IDC_COMMANDS1,230,100,50,14,WS_DISABLED
- PUSHBUTTON "Command",IDC_COMMANDS2,231,206,50,14,WS_DISABLED
-END
-
IDD_FORM DIALOGEX 0, 0, 258, 224
STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
@@ -239,14 +207,6 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,229,70,50,14
END
-IDD_DATAFORM_TEST DIALOGEX 0, 0, 153, 148
-STYLE DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
-CAPTION "Data form test"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "Custom1",IDC_DATAFORM,"JabberDataFormControl",WS_TABSTOP,7,6,139,135
-END
-
IDD_VCARD_HOME DIALOGEX 0, 0, 222, 132
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
@@ -401,19 +361,6 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,92,58,50,14
END
-IDD_GROUPCHAT DIALOGEX 0, 0, 306, 208
-STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-EXSTYLE WS_EX_CONTROLPARENT
-CAPTION "Jabber Multi-User Conference"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- LTEXT "Conference server:",-1,5,8,70,8
- COMBOBOX IDC_SERVER,80,7,168,79,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
- DEFPUSHBUTTON "Browse",IDC_BROWSE,253,7,46,13
- CONTROL "List1",IDC_ROOM,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,5,24,294,160
- PUSHBUTTON "Close",IDCLOSE,249,189,50,14
-END
-
IDD_GROUPCHAT_JOIN DIALOGEX 0, 0, 258, 211
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
@@ -453,17 +400,6 @@ BEGIN CONTROL "Reset Filter",IDC_BTN_FILTERRESET,"MButtonClass",WS_TABSTOP,187,146,16,14
END
-IDD_AGENT_MANUAL_REGISTER DIALOGEX 0, 0, 186, 45
-STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION "Jabber Agent Registration"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- LTEXT "JID:",IDC_STATIC,5,9,17,8
- EDITTEXT IDC_JID,29,7,150,12,ES_AUTOHSCROLL
- DEFPUSHBUTTON "Register",IDOK,75,24,50,14,WS_DISABLED
- PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14
-END
-
IDD_GROUPCHAT_INVITE DIALOGEX 0, 0, 215, 275
STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Invite Users"
@@ -628,16 +564,6 @@ BEGIN CONTROL "",IDC_TREE_DISCO,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,5,21,343,180
END
-IDD_SETMOODMSG DIALOGEX 0, 0, 187, 72
-STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-EXSTYLE WS_EX_CONTROLPARENT
-CAPTION "Change %s Message"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- EDITTEXT IDC_MSG_MOOD,5,5,177,43,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
- DEFPUSHBUTTON "Closing in %d",IDOK,61,53,65,14
-END
-
IDD_MODERNOPT DIALOGEX 0, 0, 260, 164
STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
@@ -718,24 +644,6 @@ BEGIN PUSHBUTTON "Deny",IDCANCEL,160,156,50,14
END
-IDD_GROUPCHAT_INFO_TABS DIALOGEX 0, 0, 265, 242
-STYLE DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
-CAPTION "Data form test"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "",IDC_TABS,"SysTabControl32",TCS_MULTILINE,7,6,251,203
-END
-
-IDD_GROUPCHAT_ADMLIST DIALOGEX 0, 0, 208, 165
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- EDITTEXT IDC_FILTER,5,147,161,12,ES_AUTOHSCROLL
- CONTROL "Apply Filter",IDC_BTN_FILTERAPPLY,"MButtonClass",WS_TABSTOP,171,146,16,14
- CONTROL "Reset Filter",IDC_BTN_FILTERRESET,"MButtonClass",WS_TABSTOP,187,146,16,14
- CONTROL "",IDC_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,5,5,198,136
-END
-
IDD_PEP_SIMPLE DIALOGEX 0, 0, 201, 140
STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_CONTROLPARENT
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 32e77d3c0b..c19efb423d 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -80,17 +80,17 @@ struct TRoleOrAffiliationInfo static TRoleOrAffiliationInfo sttAffiliationItems[] =
{
- { AFFILIATION_NONE, IDM_SET_NONE, LPGENT("None"), ROLE_NONE, AFFILIATION_ADMIN },
- { AFFILIATION_MEMBER, IDM_SET_MEMBER, LPGENT("Member"), ROLE_NONE, AFFILIATION_ADMIN },
- { AFFILIATION_ADMIN, IDM_SET_ADMIN, LPGENT("Admin"), ROLE_NONE, AFFILIATION_OWNER },
- { AFFILIATION_OWNER, IDM_SET_OWNER, LPGENT("Owner"), ROLE_NONE, AFFILIATION_OWNER },
+ { AFFILIATION_NONE, IDM_SET_NONE, LPGENT("None"), ROLE_NONE, AFFILIATION_ADMIN },
+ { AFFILIATION_MEMBER, IDM_SET_MEMBER, LPGENT("Member"), ROLE_NONE, AFFILIATION_ADMIN },
+ { AFFILIATION_ADMIN, IDM_SET_ADMIN, LPGENT("Admin"), ROLE_NONE, AFFILIATION_OWNER },
+ { AFFILIATION_OWNER, IDM_SET_OWNER, LPGENT("Owner"), ROLE_NONE, AFFILIATION_OWNER },
};
static TRoleOrAffiliationInfo sttRoleItems[] =
{
- { ROLE_VISITOR, IDM_SET_VISITOR, LPGENT("Visitor"), ROLE_MODERATOR, AFFILIATION_NONE },
- { ROLE_PARTICIPANT, IDM_SET_PARTICIPANT, LPGENT("Participant"), ROLE_MODERATOR, AFFILIATION_NONE },
- { ROLE_MODERATOR, IDM_SET_MODERATOR, LPGENT("Moderator"), ROLE_MODERATOR, AFFILIATION_ADMIN },
+ { ROLE_VISITOR, IDM_SET_VISITOR, LPGENT("Visitor"), ROLE_MODERATOR, AFFILIATION_NONE },
+ { ROLE_PARTICIPANT, IDM_SET_PARTICIPANT, LPGENT("Participant"), ROLE_MODERATOR, AFFILIATION_NONE },
+ { ROLE_MODERATOR, IDM_SET_MODERATOR, LPGENT("Moderator"), ROLE_MODERATOR, AFFILIATION_ADMIN },
};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -100,16 +100,13 @@ static const TCHAR *sttStatuses[] = { LPGENT("Visitors"), LPGENT("Participants") int JabberGcGetStatus(JABBER_GC_AFFILIATION a, JABBER_GC_ROLE r)
{
- switch (a) {
- case AFFILIATION_OWNER: return 3;
+ if (a == AFFILIATION_OWNER)
+ return 3;
- default:
- switch (r) {
- case ROLE_MODERATOR: return 2;
- case ROLE_PARTICIPANT: return 1;
- }
+ switch (r) {
+ case ROLE_MODERATOR: return 2;
+ case ROLE_PARTICIPANT: return 1;
}
-
return 0;
}
@@ -282,23 +279,23 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const TCHAR * if (jid != NULL)
gce.ptszUserInfo = jid;
gce.ptszText = szReason;
- if (item->bChatActive == 2) {
+ if (item->bChatActive == 2) {
gce.dwFlags |= GCEF_ADDTOLOG;
gce.time = time(0);
}
- switch(gcd.iType = action) {
+ switch (gcd.iType = action) {
case GC_EVENT_PART: break;
case GC_EVENT_KICK:
gce.ptszStatus = TranslateT("Moderator");
break;
default:
mir_cslock lck(m_csLists);
- for (int i=0; i < item->arResources.getCount(); i++) {
+ for (int i = 0; i < item->arResources.getCount(); i++) {
JABBER_RESOURCE_STATUS *JS = item->arResources[i];
- if ( !lstrcmp(resource, JS->m_tszResourceName)) {
+ if (!lstrcmp(resource, JS->m_tszResourceName)) {
if (action != GC_EVENT_JOIN) {
- switch(action) {
+ switch (action) {
case 0:
gcd.iType = GC_EVENT_ADDSTATUS;
case GC_EVENT_REMOVESTATUS:
@@ -345,14 +342,14 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason) CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
CallServiceSync(MS_GC_EVENT, WINDOW_CLEARLOG, (LPARAM)&gce);
- ptrT tszMessage( getTStringA("GcMsgQuit"));
+ ptrT tszMessage(getTStringA("GcMsgQuit"));
if (tszMessage != NULL)
szMessage = NEWTSTR_ALLOCA(tszMessage);
else
szMessage = TranslateTS(JABBER_GC_MSG_QUIT);
}
else {
- ptrT myNick( JabberNickFromJID(m_szJabberJID));
+ ptrT myNick(JabberNickFromJID(m_szJabberJID));
GcLogUpdateMemberStatus(item, myNick, myNick, NULL, GC_EVENT_KICK, reason);
CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
}
@@ -366,10 +363,11 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason) m_ThreadInfo->send(
XmlNode(_T("presence")) << XATTR(_T("to"), szPresenceTo) << XATTR(_T("type"), _T("unavailable"))
- << XCHILD(_T("status"), szMessage));
+ << XCHILD(_T("status"), szMessage));
ListRemove(LIST_CHATROOM, item->jid);
-} }
+ }
+}
/////////////////////////////////////////////////////////////////////////////////////////
// Context menu hooks
@@ -713,8 +711,8 @@ public: m_room = mir_tstrdup(room);
m_btnAddJid.OnClick = Callback(this, &CGroupchatInviteDlg::OnCommand_AddJid);
m_btnInvite.OnClick = Callback(this, &CGroupchatInviteDlg::OnCommand_Invite);
- m_clc.OnNewContact =
- m_clc.OnListRebuilt = Callback(this, &CGroupchatInviteDlg::FilterList);
+ m_clc.OnNewContact =
+ m_clc.OnListRebuilt = Callback(this, &CGroupchatInviteDlg::FilterList);
m_clc.OnOptionsChanged = Callback(this, &CGroupchatInviteDlg::ResetListOptions);
}
@@ -765,31 +763,31 @@ public: JabberGcLogInviteDlgJidData *jidData = (JabberGcLogInviteDlgJidData *)mir_alloc(sizeof(JabberGcLogInviteDlgJidData));
lstrcpy(jidData->jid, buf);
- CLCINFOITEM cii = {0};
+ CLCINFOITEM cii = { 0 };
cii.cbSize = sizeof(cii);
cii.flags = CLCIIF_CHECKBOX;
mir_sntprintf(buf, SIZEOF(buf), TranslateT("%s (not on roster)"), jidData->jid);
cii.pszText = buf;
- jidData->hItem = SendDlgItemMessage(m_hwnd,IDC_CLIST,CLM_ADDINFOITEM,0,(LPARAM)&cii);
+ jidData->hItem = SendDlgItemMessage(m_hwnd, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
SendDlgItemMessage(m_hwnd, IDC_CLIST, CLM_SETCHECKMARK, jidData->hItem, 1);
m_newJids.insert(jidData);
}
void OnCommand_Invite(CCtrlButton*)
{
- if ( !m_room) return;
+ if (!m_room) return;
TCHAR *text = m_txtReason.GetText();
HWND hwndList = GetDlgItem(m_hwnd, IDC_CLIST);
// invite users from roster
for (HANDLE hContact = db_find_first(m_proto->m_szModuleName); hContact; hContact = db_find_next(hContact, m_proto->m_szModuleName)) {
- if ( m_proto->isChatRoom(hContact))
+ if (m_proto->isChatRoom(hContact))
continue;
if (int hItem = SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0)) {
if (SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) {
- ptrT jid( m_proto->getTStringA(hContact, "jid"));
+ ptrT jid(m_proto->getTStringA(hContact, "jid"));
if (jid != NULL)
InviteUser(jid, text);
}
@@ -797,9 +795,9 @@ public: }
// invite others
- for (int i=0; i < m_newJids.getCount(); i++)
- if (SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)m_newJids[i]->hItem, 0))
- InviteUser(m_newJids[i]->jid, text);
+ for (int i = 0; i < m_newJids.getCount(); i++)
+ if (SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)m_newJids[i]->hItem, 0))
+ InviteUser(m_newJids[i]->jid, text);
mir_free(text);
Close();
@@ -811,16 +809,17 @@ public: void CJabberProto::AdminSet(const TCHAR *to, const TCHAR *ns, const TCHAR *szItem, const TCHAR *itemVal, const TCHAR *var, const TCHAR *varVal)
{
- m_ThreadInfo->send( XmlNodeIq(_T("set"), SerialNext(), to) << XQUERY(ns) << XCHILD(_T("item")) << XATTR(szItem, itemVal) << XATTR(var, varVal));
+ m_ThreadInfo->send(XmlNodeIq(_T("set"), SerialNext(), to) << XQUERY(ns) << XCHILD(_T("item")) << XATTR(szItem, itemVal) << XATTR(var, varVal));
}
-void CJabberProto::AdminSetReason(const TCHAR *to, const TCHAR *ns, const TCHAR *szItem, const TCHAR *itemVal, const TCHAR *var, const TCHAR *varVal , const TCHAR *rsn)
-{ m_ThreadInfo->send( XmlNodeIq(_T("set"), SerialNext(), to) << XQUERY(ns) << XCHILD(_T("item")) << XATTR(szItem, itemVal) << XATTR(var, varVal) << XCHILD(_T("reason"), rsn));
+void CJabberProto::AdminSetReason(const TCHAR *to, const TCHAR *ns, const TCHAR *szItem, const TCHAR *itemVal, const TCHAR *var, const TCHAR *varVal, const TCHAR *rsn)
+{
+ m_ThreadInfo->send(XmlNodeIq(_T("set"), SerialNext(), to) << XQUERY(ns) << XCHILD(_T("item")) << XATTR(szItem, itemVal) << XATTR(var, varVal) << XCHILD(_T("reason"), rsn));
}
void CJabberProto::AdminGet(const TCHAR *to, const TCHAR *ns, const TCHAR *var, const TCHAR *varVal, JABBER_IQ_HANDLER foo)
{
- m_ThreadInfo->send( XmlNodeIq( AddIQ(foo, JABBER_IQ_TYPE_GET, to))
+ m_ThreadInfo->send(XmlNodeIq(AddIQ(foo, JABBER_IQ_TYPE_GET, to))
<< XQUERY(ns) << XCHILD(_T("item")) << XATTR(var, varVal));
}
@@ -835,77 +834,69 @@ struct TUserInfoData static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
TUserInfoData *dat = (TUserInfoData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- int value;
+ int value, i, idx;
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- {
- int i, idx;
- TCHAR buf[256];
-
-
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- dat = (TUserInfoData *)lParam;
-
- WindowSetIcon(hwndDlg, dat->ppro, "group");
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+ dat = (TUserInfoData *)lParam;
+ WindowSetIcon(hwndDlg, dat->ppro, "group");
+ {
LOGFONT lf;
GetObject((HFONT)SendDlgItemMessage(hwndDlg, IDC_TXT_NICK, WM_GETFONT, 0, 0), sizeof(lf), &lf);
lf.lfWeight = FW_BOLD;
HFONT hfnt = CreateFontIndirect(&lf);
SendDlgItemMessage(hwndDlg, IDC_TXT_NICK, WM_SETFONT, (WPARAM)hfnt, TRUE);
+ }
- SendDlgItemMessage(hwndDlg, IDC_BTN_AFFILIATION, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinnedIcon(SKINICON_EVENT_FILE));
- SendDlgItemMessage(hwndDlg, IDC_BTN_AFFILIATION, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_BTN_AFFILIATION, BUTTONADDTOOLTIP, (WPARAM)"Apply", 0);
-
- SendDlgItemMessage(hwndDlg, IDC_BTN_ROLE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinnedIcon(SKINICON_EVENT_FILE));
- SendDlgItemMessage(hwndDlg, IDC_BTN_ROLE, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_BTN_ROLE, BUTTONADDTOOLTIP, (WPARAM)"Apply", 0);
-
- SendDlgItemMessage(hwndDlg, IDC_ICO_STATUS, STM_SETICON, (WPARAM)LoadSkinnedProtoIcon(dat->ppro->m_szModuleName, dat->him->m_iStatus), 0);
-
- mir_sntprintf(buf, SIZEOF(buf), TranslateT("Member Info: %s"), dat->him->m_tszResourceName);
- SetWindowText(hwndDlg, buf);
+ SendDlgItemMessage(hwndDlg, IDC_BTN_AFFILIATION, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinnedIcon(SKINICON_EVENT_FILE));
+ SendDlgItemMessage(hwndDlg, IDC_BTN_AFFILIATION, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_BTN_AFFILIATION, BUTTONADDTOOLTIP, (WPARAM)"Apply", 0);
- mir_sntprintf(buf, SIZEOF(buf), TranslateT("Member Information\n%s from %s"), dat->him->m_tszResourceName, dat->item->jid);
- SetDlgItemText(hwndDlg, IDC_HEADERBAR, buf);
+ SendDlgItemMessage(hwndDlg, IDC_BTN_ROLE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinnedIcon(SKINICON_EVENT_FILE));
+ SendDlgItemMessage(hwndDlg, IDC_BTN_ROLE, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_BTN_ROLE, BUTTONADDTOOLTIP, (WPARAM)"Apply", 0);
- SetDlgItemText(hwndDlg, IDC_TXT_NICK, dat->him->m_tszResourceName);
- SetDlgItemText(hwndDlg, IDC_TXT_JID, dat->him->m_tszRealJid ? dat->him->m_tszRealJid : TranslateT("Real JID not available"));
- SetDlgItemText(hwndDlg, IDC_TXT_STATUS, dat->him->m_tszStatusMessage);
+ SendDlgItemMessage(hwndDlg, IDC_ICO_STATUS, STM_SETICON, (WPARAM)LoadSkinnedProtoIcon(dat->ppro->m_szModuleName, dat->him->m_iStatus), 0);
- for (i=0; i < SIZEOF(sttRoleItems); i++)
- {
- if ((sttRoleItems[i].value == dat->him->m_role) || sttRoleItems[i].check(dat->me, dat->him))
- {
- SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_SETITEMDATA,
- idx = SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_ADDSTRING, 0, (LPARAM)sttRoleItems[i].title),
- sttRoleItems[i].value);
- if (sttRoleItems[i].value == dat->him->m_role)
- SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_SETCURSEL, idx, 0);
- }
+ TCHAR buf[256];
+ mir_sntprintf(buf, SIZEOF(buf), TranslateT("Member Info: %s"), dat->him->m_tszResourceName);
+ SetWindowText(hwndDlg, buf);
+
+ mir_sntprintf(buf, SIZEOF(buf), TranslateT("Member Information\n%s from %s"), dat->him->m_tszResourceName, dat->item->jid);
+ SetDlgItemText(hwndDlg, IDC_HEADERBAR, buf);
+
+ SetDlgItemText(hwndDlg, IDC_TXT_NICK, dat->him->m_tszResourceName);
+ SetDlgItemText(hwndDlg, IDC_TXT_JID, dat->him->m_tszRealJid ? dat->him->m_tszRealJid : TranslateT("Real JID not available"));
+ SetDlgItemText(hwndDlg, IDC_TXT_STATUS, dat->him->m_tszStatusMessage);
+
+ for (i = 0; i < SIZEOF(sttRoleItems); i++) {
+ if ((sttRoleItems[i].value == dat->him->m_role) || sttRoleItems[i].check(dat->me, dat->him)) {
+ SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_SETITEMDATA,
+ idx = SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_ADDSTRING, 0, (LPARAM)sttRoleItems[i].title),
+ sttRoleItems[i].value);
+ if (sttRoleItems[i].value == dat->him->m_role)
+ SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_SETCURSEL, idx, 0);
}
- for (i=0; i < SIZEOF(sttAffiliationItems); i++)
- {
- if ((sttAffiliationItems[i].value == dat->him->m_affiliation) || sttAffiliationItems[i].check(dat->me, dat->him))
- {
- SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_SETITEMDATA,
- idx = SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_ADDSTRING, 0, (LPARAM)sttAffiliationItems[i].title),
- sttAffiliationItems[i].value);
- if (sttAffiliationItems[i].value == dat->him->m_affiliation)
- SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_SETCURSEL, idx, 0);
- }
+ }
+ for (i = 0; i < SIZEOF(sttAffiliationItems); i++) {
+ if ((sttAffiliationItems[i].value == dat->him->m_affiliation) || sttAffiliationItems[i].check(dat->me, dat->him)) {
+ SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_SETITEMDATA,
+ idx = SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_ADDSTRING, 0, (LPARAM)sttAffiliationItems[i].title),
+ sttAffiliationItems[i].value);
+ if (sttAffiliationItems[i].value == dat->him->m_affiliation)
+ SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_SETCURSEL, idx, 0);
}
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_ROLE), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_AFFILIATION), FALSE);
}
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_ROLE), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_AFFILIATION), FALSE);
break;
case WM_COMMAND:
- if ( !dat)
+ if (!dat)
break;
switch (LOWORD(wParam)) {
@@ -1005,7 +996,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* gch)
{
- pResourceStatus me( item->findResource(item->nick)), him( item->findResource(gch->ptszUID));
+ pResourceStatus me(item->findResource(item->nick)), him(item->findResource(gch->ptszUID));
if (him == NULL || me == NULL)
return;
@@ -1023,31 +1014,31 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* return;
}
- switch(gch->dwData) {
+ switch (gch->dwData) {
case IDM_SLAP:
if (ppro->m_bJabberOnline) {
- ptrT szMessage( ppro->getTStringA("GcMsgSlap"));
+ ptrT szMessage(ppro->getTStringA("GcMsgSlap"));
if (szMessage == NULL)
- szMessage = mir_tstrdup( TranslateTS(JABBER_GC_MSG_SLAP));
+ szMessage = mir_tstrdup(TranslateTS(JABBER_GC_MSG_SLAP));
TCHAR buf[256];
// do not use snprintf to avoid possible problems with % symbol
if (TCHAR *p = _tcsstr(szMessage, _T("%s"))) {
*p = 0;
- mir_sntprintf(buf, SIZEOF(buf), _T("%s%s%s"), szMessage, him->m_tszResourceName, p+2);
+ mir_sntprintf(buf, SIZEOF(buf), _T("%s%s%s"), szMessage, him->m_tszResourceName, p + 2);
}
else lstrcpyn(buf, szMessage, SIZEOF(buf));
UnEscapeChatTags(buf);
ppro->m_ThreadInfo->send(
XmlNode(_T("message")) << XATTR(_T("to"), item->jid) << XATTR(_T("type"), _T("groupchat"))
- << XCHILD(_T("body"), buf));
+ << XCHILD(_T("body"), buf));
}
break;
case IDM_VCARD:
{
- JABBER_SEARCH_RESULT jsr = {0};
+ JABBER_SEARCH_RESULT jsr = { 0 };
mir_sntprintf(jsr.jid, SIZEOF(jsr.jid), _T("%s/%s"), item->jid, him->m_tszResourceName);
jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
@@ -1158,9 +1149,9 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* if (ppro->EnterString(szBuffer, SIZEOF(szBuffer), szTitle, JES_MULTINE, "gcReason_")) {
ppro->m_ThreadInfo->send(
- XmlNodeIq(_T("set"), ppro->SerialNext(), item->jid) << XQUERY(JABBER_FEAT_MUC_ADMIN)
- << XCHILD(_T("item")) << XATTR(_T("jid"), szVictimBareJid) << XATTR(_T("affiliation"), _T("outcast"))
- << XCHILD(_T("reason"), szBuffer));
+ XmlNodeIq(_T("set"), ppro->SerialNext(), item->jid) << XQUERY(JABBER_FEAT_MUC_ADMIN)
+ << XCHILD(_T("item")) << XATTR(_T("jid"), szVictimBareJid) << XATTR(_T("affiliation"), _T("outcast"))
+ << XCHILD(_T("reason"), szBuffer));
}
}
}
@@ -1187,7 +1178,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* mir_sntprintf(szTitle, SIZEOF(szTitle), TranslateT("Invite %s to %s"), him->m_tszResourceName, szInviteTo);
*szBuffer = 0;
- if ( !ppro->EnterString(szBuffer, SIZEOF(szBuffer), szTitle, JES_MULTINE))
+ if (!ppro->EnterString(szBuffer, SIZEOF(szBuffer), szTitle, JES_MULTINE))
break;
mir_sntprintf(szTitle, SIZEOF(szTitle), _T("%s/%s"), item->jid, resourceName_copy);
@@ -1220,7 +1211,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_RJID_VCARD:
if (him->m_tszRealJid && *him->m_tszRealJid) {
HANDLE hContact;
- JABBER_SEARCH_RESULT jsr ={0};
+ JABBER_SEARCH_RESULT jsr = { 0 };
jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
mir_sntprintf(jsr.jid, SIZEOF(jsr.jid), _T("%s"), him->m_tszRealJid);
if (TCHAR *tmp = _tcschr(jsr.jid, _T('/'))) *tmp = 0;
@@ -1235,14 +1226,14 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_RJID_ADD:
if (him->m_tszRealJid && *him->m_tszRealJid) {
- JABBER_SEARCH_RESULT jsr={0};
+ JABBER_SEARCH_RESULT jsr = { 0 };
jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
jsr.hdr.flags = PSR_TCHAR;
mir_sntprintf(jsr.jid, SIZEOF(jsr.jid), _T("%s"), him->m_tszRealJid);
if (TCHAR *tmp = _tcschr(jsr.jid, _T('/'))) *tmp = 0;
jsr.hdr.nick = jsr.jid;
- ADDCONTACTSTRUCT acs={0};
+ ADDCONTACTSTRUCT acs = { 0 };
acs.handleType = HANDLE_SEARCHRESULT;
acs.szProto = ppro->m_szModuleName;
acs.psr = (PROTOSEARCHRESULT *)&jsr;
@@ -1257,7 +1248,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g TCHAR szCaption[1024], szBuffer[1024];
szBuffer[0] = 0;
- switch(gch->dwData) {
+ switch (gch->dwData) {
case IDM_LST_PARTICIPANT:
ppro->AdminGet(gch->pDest->ptszID, JABBER_FEAT_MUC_ADMIN, _T("role"), _T("participant"), &CJabberProto::OnIqResultMucGetVoiceList);
break;
@@ -1284,14 +1275,14 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g case IDM_TOPIC:
mir_sntprintf(szCaption, SIZEOF(szCaption), TranslateT("Set topic for %s"), gch->pDest->ptszID);
- {
+ {
LPCTSTR s = item->getTemp()->m_tszStatusMessage;
- size_t cbLen = 2048 + lstrlen(s)*2;
- TCHAR *ptszBuf = (TCHAR*)_alloca(sizeof(TCHAR) * cbLen);
+ size_t cbLen = 2048 + lstrlen(s) * 2;
+ TCHAR *ptszBuf = (TCHAR*)_alloca(sizeof(TCHAR)* cbLen);
if (s) {
TCHAR *d = ptszBuf;
- for (size_t i=0; i < cbLen && s[i] != 0; i++) {
- if (s[i] != '\n' || (i && s[i-1] == '\r'))
+ for (size_t i = 0; i < cbLen && s[i] != 0; i++) {
+ if (s[i] != '\n' || (i && s[i - 1] == '\r'))
*d++ = s[i];
else {
*d++ = '\r';
@@ -1304,8 +1295,8 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g if (ppro->EnterString(ptszBuf, cbLen, szCaption, JES_RICHEDIT, "gcTopic_"))
ppro->m_ThreadInfo->send(
- XmlNode(_T("message")) << XATTR(_T("to"), gch->pDest->ptszID) << XATTR(_T("type"), _T("groupchat"))
- << XCHILD(_T("subject"), ptszBuf));
+ XmlNode(_T("message")) << XATTR(_T("to"), gch->pDest->ptszID) << XATTR(_T("type"), _T("groupchat"))
+ << XCHILD(_T("subject"), ptszBuf));
}
break;
@@ -1316,10 +1307,11 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g if (ppro->EnterString(szBuffer, SIZEOF(szBuffer), szCaption, JES_COMBO, "gcNick_")) {
JABBER_LIST_ITEM *item = ppro->ListGetItemPtr(LIST_CHATROOM, gch->pDest->ptszID);
if (item != NULL) {
- TCHAR text[ 1024 ];
+ 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);
- } }
+ }
+ }
break;
case IDM_INVITE:
@@ -1328,7 +1320,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g case IDM_CONFIG:
ppro->m_ThreadInfo->send(
- XmlNodeIq( ppro->AddIQ(&CJabberProto::OnIqResultGetMuc, JABBER_IQ_TYPE_GET, gch->pDest->ptszID))
+ XmlNodeIq(ppro->AddIQ(&CJabberProto::OnIqResultGetMuc, JABBER_IQ_TYPE_GET, gch->pDest->ptszID))
<< XQUERY(JABBER_FEAT_MUC_OWNER));
break;
@@ -1348,7 +1340,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g }
case IDM_DESTROY:
mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("Reason to destroy %s"), gch->pDest->ptszID);
- if ( !ppro->EnterString(szBuffer, SIZEOF(szBuffer), NULL, JES_MULTINE, "gcReason_"))
+ if (!ppro->EnterString(szBuffer, SIZEOF(szBuffer), NULL, JES_MULTINE, "gcReason_"))
break;
ppro->m_ThreadInfo->send(
@@ -1391,6 +1383,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g case IDM_CPY_RJID:
JabberCopyText((HWND)CallService(MS_CLUI_GETHWND, 0, 0), item->jid);
break;
+
case IDM_CPY_TOPIC:
JabberCopyText((HWND)CallService(MS_CLUI_GETHWND, 0, 0), item->getTemp()->m_tszStatusMessage);
break;
@@ -1406,7 +1399,7 @@ static void sttSendPrivateMessage(CJabberProto *ppro, JABBER_LIST_ITEM *item, co mir_sntprintf(szFullJid, SIZEOF(szFullJid), _T("%s/%s"), item->jid, nick);
HANDLE hContact = ppro->DBCreateContact(szFullJid, NULL, TRUE, FALSE);
if (hContact != NULL) {
- pResourceStatus r( item->findResource(nick));
+ pResourceStatus r(item->findResource(nick));
if (r)
ppro->setWord(hContact, "Status", r->m_iStatus);
@@ -1414,7 +1407,8 @@ static void sttSendPrivateMessage(CJabberProto *ppro, JABBER_LIST_ITEM *item, co ppro->setTString(hContact, "Nick", nick);
db_set_dw(hContact, "Ignore", "Mask1", 0);
CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
-} }
+ }
+}
/////////////////////////////////////////////////////////////////////////////////////////
// General chat event processing hook
@@ -1443,7 +1437,8 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam) m_ThreadInfo->send(
XmlNode(_T("message")) << XATTR(_T("to"), item->jid) << XATTR(_T("type"), _T("groupchat"))
<< XCHILD(_T("body"), buf));
- } }
+ }
+ }
break;
case GC_USER_PRIVMESS:
@@ -1460,8 +1455,8 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam) case GC_USER_CHANMGR:
m_ThreadInfo->send(
- XmlNodeIq( AddIQ(&CJabberProto::OnIqResultGetMuc, JABBER_IQ_TYPE_GET, item->jid))
- << XQUERY(JABBER_FEAT_MUC_OWNER));
+ XmlNodeIq(AddIQ(&CJabberProto::OnIqResultGetMuc, JABBER_IQ_TYPE_GET, item->jid))
+ << XQUERY(JABBER_FEAT_MUC_OWNER));
break;
}
@@ -1469,9 +1464,10 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam) }
/////////////////////////////////////////////////////////////////////////////////////////////////
-void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, TCHAR* str , TCHAR* rsn)
+
+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");
+ const TCHAR *field = (jidListInfo->type == MUC_BANLIST || _tcschr(str, '@')) ? _T("jid") : _T("nick");
TCHAR *roomJid = jidListInfo->roomJid;
if (jidListInfo->type == MUC_BANLIST) {
AdminSetReason(roomJid, JABBER_FEAT_MUC_ADMIN, field, str, _T("affiliation"), _T("outcast"), rsn);
@@ -1481,7 +1477,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");
+ const TCHAR *field = (jidListInfo->type == MUC_BANLIST || _tcschr(str, '@')) ? _T("jid") : _T("nick");
TCHAR *roomJid = jidListInfo->roomJid;
switch (jidListInfo->type) {
@@ -1509,7 +1505,8 @@ void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, TCHAR* s AdminSet(roomJid, JABBER_FEAT_MUC_ADMIN, field, str, _T("affiliation"), _T("owner"));
AdminGet(roomJid, JABBER_FEAT_MUC_ADMIN, _T("affiliation"), _T("owner"), &CJabberProto::OnIqResultMucGetOwnerList);
break;
-} }
+ }
+}
void CJabberProto::DeleteMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, TCHAR* jid)
{
@@ -1532,4 +1529,5 @@ void CJabberProto::DeleteMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, TCHAR case MUC_OWNERLIST: // change affiliation to admin (from owner)
AdminSet(roomJid, JABBER_FEAT_MUC_ADMIN, _T("jid"), jid, _T("affiliation"), _T("admin"));
break;
-} }
+ }
+}
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 3a1c740926..ad2091d41e 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -95,12 +95,12 @@ struct JabberGcRecentInfo this->room = mir_tstrdup(room);
this->server = mir_tstrdup(server);
this->nick = mir_tstrdup(nick);
- this->password = mir_tstrdup(password);
+ this->password = mir_tstrdup(password);
}
void fillData(const TCHAR *jid)
{
- TCHAR *room, *server, *nick=NULL;
+ TCHAR *room, *server, *nick = NULL;
room = NEWTSTR_ALLOCA(jid);
server = _tcschr(room, _T('@'));
if (server) {
@@ -211,7 +211,7 @@ INT_PTR __cdecl CJabberProto::OnJoinChat(WPARAM wParam, LPARAM) INT_PTR __cdecl CJabberProto::OnLeaveChat(WPARAM wParam, LPARAM)
{
HANDLE hContact = (HANDLE)wParam;
- ptrT jid( getTStringA(hContact, "ChatRoomID"));
+ ptrT jid(getTStringA(hContact, "ChatRoomID"));
if (jid != NULL) {
if (getWord(hContact, "Status", 0) != ID_STATUS_OFFLINE) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, jid);
@@ -227,8 +227,8 @@ void CJabberProto::GroupchatJoinRoom(const TCHAR *server, const TCHAR *room, con JabberGcRecentInfo info(this);
bool found = false;
- for (int i=0 ; i < 5; i++) {
- if ( !info.loadRecent(i))
+ for (int i = 0; i < 5; i++) {
+ if (!info.loadRecent(i))
continue;
if (info.equals(room, server, nick, password)) {
@@ -290,38 +290,32 @@ static int sttRoomListAppend(HWND hwndList, RoomInfo::Overlay overlay, const TCH void CJabberProto::OnIqResultDiscovery(HXML iqNode, CJabberIqInfo *pInfo)
{
- if ( !iqNode || !pInfo)
+ if (!iqNode || !pInfo)
return;
HWND hwndList = (HWND)pInfo->GetUserData();
SendMessage(hwndList, CB_SHOWDROPDOWN, FALSE, 0);
SendMessage(hwndList, CB_RESETCONTENT, 0, 0);
- if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT)
- {
- HXML query = xmlGetChild(iqNode , "query");
- if (query == NULL)
- {
+ if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
+ HXML query = xmlGetChild(iqNode, "query");
+ if (query == NULL) {
sttRoomListAppend(hwndList, RoomInfo::ROOM_FAIL,
TranslateT("Jabber Error"),
TranslateT("Failed to retrieve room list from server."),
_T(""));
- } else
- {
+ }
+ else {
bool found = false;
HXML item;
- for (int i = 1; item = xmlGetNthChild(query, _T("item"), i); i++)
- {
+ for (int i = 1; item = xmlGetNthChild(query, _T("item"), i); i++) {
const TCHAR *jid = xmlGetAttrValue(item, _T("jid"));
TCHAR *name = NEWTSTR_ALLOCA(jid);
- if (name)
- {
+ if (name) {
if (TCHAR *p = _tcschr(name, _T('@')))
*p = 0;
- } else
- {
- name = _T("");
}
+ else name = _T("");
sttRoomListAppend(hwndList,
ListGetItemPtr(LIST_BOOKMARK, jid) ? RoomInfo::ROOM_BOOKMARK : RoomInfo::ROOM_DEFAULT,
@@ -331,31 +325,28 @@ void CJabberProto::OnIqResultDiscovery(HXML iqNode, CJabberIqInfo *pInfo) found = true;
}
- if ( !found)
- {
+ if (!found) {
sttRoomListAppend(hwndList, RoomInfo::ROOM_FAIL,
TranslateT("Jabber Error"),
TranslateT("No rooms available on server."),
_T(""));
}
}
- } else
- if (pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR)
- {
- HXML errorNode = xmlGetChild(iqNode , "error");
+ }
+ else if (pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR) {
+ HXML errorNode = xmlGetChild(iqNode, "error");
TCHAR *str = JabberErrorMsg(errorNode);
sttRoomListAppend(hwndList, RoomInfo::ROOM_FAIL,
TranslateT("Jabber Error"),
str,
_T(""));
mir_free(str);
- } else
- {
+ }
+ else
sttRoomListAppend(hwndList, RoomInfo::ROOM_FAIL,
TranslateT("Jabber Error"),
TranslateT("Room list request timed out."),
_T(""));
- }
SendMessage(hwndList, CB_SHOWDROPDOWN, TRUE, 0);
}
@@ -374,20 +365,20 @@ static void sttJoinDlgShowRecentItems(HWND hwndDlg, int newCount) int curRecentHeight = rcLastItem.bottom - rcTitle.top - (5 - oldCount) * (rcLastItem.bottom - rcLastItem.top);
int newRecentHeight = rcLastItem.bottom - rcTitle.top - (5 - newCount) * (rcLastItem.bottom - rcLastItem.top);
- if ( !newCount) newRecentHeight = 0;
+ if (!newCount)
+ newRecentHeight = 0;
int offset = newRecentHeight - curRecentHeight;
RECT rc;
int ctrls[] = { IDC_BOOKMARKS, IDOK, IDCANCEL };
- for (int i=0; i < SIZEOF(ctrls); i++)
- {
+ for (int i = 0; i < SIZEOF(ctrls); i++) {
GetWindowRect(GetDlgItem(hwndDlg, ctrls[i]), &rc);
MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rc, 2);
- SetWindowPos(GetDlgItem(hwndDlg, ctrls[i]), NULL, rc.left, rc.top + offset, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hwndDlg, ctrls[i]), NULL, rc.left, rc.top + offset, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
GetWindowRect(hwndDlg, &rc);
- SetWindowPos(hwndDlg, NULL, 0, 0, rc.right-rc.left, rc.bottom-rc.top+offset, SWP_NOMOVE|SWP_NOZORDER);
+ SetWindowPos(hwndDlg, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top + offset, SWP_NOMOVE | SWP_NOZORDER);
}
class CJabberDlgGcJoin: public CJabberDlgBase
@@ -440,19 +431,19 @@ void CJabberDlgGcJoin::OnInitDialog() delete info;
}
- ptrT tszNick( m_proto->getTStringA("Nick"));
+ ptrT tszNick(m_proto->getTStringA("Nick"));
if (tszNick == NULL)
tszNick = JabberNickFromJID(m_proto->m_szJabberJID);
SetDlgItemText(m_hwnd, IDC_NICK, tszNick);
- TEXTMETRIC tm = {0};
+ TEXTMETRIC tm = { 0 };
HDC hdc = GetDC(m_hwnd);
GetTextMetrics(hdc, &tm);
ReleaseDC(m_hwnd, hdc);
sttTextLineHeight = tm.tmHeight;
- SendDlgItemMessage(m_hwnd, IDC_ROOM, CB_SETITEMHEIGHT, -1, sttTextLineHeight-1);
+ SendDlgItemMessage(m_hwnd, IDC_ROOM, CB_SETITEMHEIGHT, -1, sttTextLineHeight - 1);
- LOGFONT lf = {0};
+ LOGFONT lf = { 0 };
HFONT hfnt = (HFONT)SendDlgItemMessage(m_hwnd, IDC_TXT_RECENT, WM_GETFONT, 0, 0);
GetObject(hfnt, sizeof(lf), &lf);
lf.lfWeight = FW_BOLD;
@@ -466,16 +457,16 @@ void CJabberDlgGcJoin::OnInitDialog() m_proto->ComboLoadRecentStrings(m_hwnd, IDC_SERVER, "joinWnd_rcSvr");
int i;
- for (i=0; i < 5; i++) {
+ for (i = 0; i < 5; i++) {
TCHAR jid[JABBER_MAX_JID_LEN];
JabberGcRecentInfo info(m_proto);
- if ( !info.loadRecent(i))
+ if (!info.loadRecent(i))
break;
mir_sntprintf(jid, SIZEOF(jid), _T("%s@%s (%s)"),
info.room, info.server,
info.nick ? info.nick : TranslateT("<no nick>"));
- SetDlgItemText(m_hwnd, IDC_RECENT1+i, jid);
+ SetDlgItemText(m_hwnd, IDC_RECENT1 + i, jid);
}
sttJoinDlgShowRecentItems(m_hwnd, i);
}
@@ -502,89 +493,83 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) switch (msg) {
case WM_DELETEITEM:
- {
- LPDELETEITEMSTRUCT lpdis = (LPDELETEITEMSTRUCT)lParam;
- if (lpdis->CtlID != IDC_ROOM)
- break;
+ {
+ LPDELETEITEMSTRUCT lpdis = (LPDELETEITEMSTRUCT)lParam;
+ if (lpdis->CtlID != IDC_ROOM)
+ break;
- RoomInfo *info = (RoomInfo *)lpdis->itemData;
- mir_free(info->line1);
- mir_free(info->line2);
- mir_free(info);
+ RoomInfo *info = (RoomInfo *)lpdis->itemData;
+ mir_free(info->line1);
+ mir_free(info->line2);
+ mir_free(info);
+ }
break;
- }
case WM_MEASUREITEM:
- {
- LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT)lParam;
- if (lpmis->CtlID != IDC_ROOM)
- break;
+ {
+ LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT)lParam;
+ if (lpmis->CtlID != IDC_ROOM)
+ break;
- lpmis->itemHeight = 2*sttTextLineHeight;
- if (lpmis->itemID == -1)
- lpmis->itemHeight = sttTextLineHeight-1;
+ lpmis->itemHeight = 2*sttTextLineHeight;
+ if (lpmis->itemID == -1)
+ lpmis->itemHeight = sttTextLineHeight-1;
+ }
break;
- }
case WM_DRAWITEM:
- {
- LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam;
- if (lpdis->CtlID != IDC_ROOM)
- break;
-
- if (lpdis->itemID < 0)
- break;
+ {
+ LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam;
+ if (lpdis->CtlID != IDC_ROOM || lpdis->itemID < 0)
+ break;
- RoomInfo *info = (RoomInfo *)SendDlgItemMessage(m_hwnd, IDC_ROOM, CB_GETITEMDATA, lpdis->itemID, 0);
- COLORREF clLine1, clLine2, clBack;
+ RoomInfo *info = (RoomInfo *)SendDlgItemMessage(m_hwnd, IDC_ROOM, CB_GETITEMDATA, lpdis->itemID, 0);
+ COLORREF clLine1, clBack;
- if (lpdis->itemState & ODS_SELECTED)
- {
- FillRect(lpdis->hDC, &lpdis->rcItem, GetSysColorBrush(COLOR_HIGHLIGHT));
- clBack = GetSysColor(COLOR_HIGHLIGHT);
- clLine1 = GetSysColor(COLOR_HIGHLIGHTTEXT);
- } else
- {
- FillRect(lpdis->hDC, &lpdis->rcItem, GetSysColorBrush(COLOR_WINDOW));
- clBack = GetSysColor(COLOR_WINDOW);
- clLine1 = GetSysColor(COLOR_WINDOWTEXT);
- }
- clLine2 = RGB(
- GetRValue(clLine1) * 0.66 + GetRValue(clBack) * 0.34,
- GetGValue(clLine1) * 0.66 + GetGValue(clBack) * 0.34,
- GetBValue(clLine1) * 0.66 + GetBValue(clBack) * 0.34
- );
-
- SetBkMode(lpdis->hDC, TRANSPARENT);
-
- RECT rc;
-
- rc = lpdis->rcItem;
- rc.bottom -= (rc.bottom - rc.top) / 2;
- rc.left += 20;
- SetTextColor(lpdis->hDC, clLine1);
- DrawText(lpdis->hDC, info->line1, lstrlen(info->line1), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
-
- rc = lpdis->rcItem;
- rc.top += (rc.bottom - rc.top) / 2;
- rc.left += 20;
- SetTextColor(lpdis->hDC, clLine2);
- DrawText(lpdis->hDC, info->line2, lstrlen(info->line2), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
-
- DrawIconEx(lpdis->hDC, lpdis->rcItem.left+1, lpdis->rcItem.top+1, m_proto->LoadIconEx("group"), 16, 16, 0, NULL, DI_NORMAL);
- switch (info->overlay) {
- case RoomInfo::ROOM_WAIT:
- DrawIconEx(lpdis->hDC, lpdis->rcItem.left+1, lpdis->rcItem.top+1, m_proto->LoadIconEx("disco_progress"), 16, 16, 0, NULL, DI_NORMAL);
- break;
- case RoomInfo::ROOM_FAIL:
- DrawIconEx(lpdis->hDC, lpdis->rcItem.left+1, lpdis->rcItem.top+1, m_proto->LoadIconEx("disco_fail"), 16, 16, 0, NULL, DI_NORMAL);
- break;
- case RoomInfo::ROOM_BOOKMARK:
- DrawIconEx(lpdis->hDC, lpdis->rcItem.left+1, lpdis->rcItem.top+1, m_proto->LoadIconEx("disco_ok"), 16, 16, 0, NULL, DI_NORMAL);
- break;
+ if (lpdis->itemState & ODS_SELECTED) {
+ FillRect(lpdis->hDC, &lpdis->rcItem, GetSysColorBrush(COLOR_HIGHLIGHT));
+ clBack = GetSysColor(COLOR_HIGHLIGHT);
+ clLine1 = GetSysColor(COLOR_HIGHLIGHTTEXT);
+ }
+ else {
+ FillRect(lpdis->hDC, &lpdis->rcItem, GetSysColorBrush(COLOR_WINDOW));
+ clBack = GetSysColor(COLOR_WINDOW);
+ clLine1 = GetSysColor(COLOR_WINDOWTEXT);
+ }
+ COLORREF clLine2 = RGB(
+ GetRValue(clLine1) * 0.66 + GetRValue(clBack) * 0.34,
+ GetGValue(clLine1) * 0.66 + GetGValue(clBack) * 0.34,
+ GetBValue(clLine1) * 0.66 + GetBValue(clBack) * 0.34);
+
+ SetBkMode(lpdis->hDC, TRANSPARENT);
+
+ RECT rc = lpdis->rcItem;
+ rc.bottom -= (rc.bottom - rc.top) / 2;
+ rc.left += 20;
+ SetTextColor(lpdis->hDC, clLine1);
+ DrawText(lpdis->hDC, info->line1, lstrlen(info->line1), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
+
+ rc = lpdis->rcItem;
+ rc.top += (rc.bottom - rc.top) / 2;
+ rc.left += 20;
+ SetTextColor(lpdis->hDC, clLine2);
+ DrawText(lpdis->hDC, info->line2, lstrlen(info->line2), &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS);
+
+ DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, m_proto->LoadIconEx("group"), 16, 16, 0, NULL, DI_NORMAL);
+ switch (info->overlay) {
+ case RoomInfo::ROOM_WAIT:
+ DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, m_proto->LoadIconEx("disco_progress"), 16, 16, 0, NULL, DI_NORMAL);
+ break;
+ case RoomInfo::ROOM_FAIL:
+ DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, m_proto->LoadIconEx("disco_fail"), 16, 16, 0, NULL, DI_NORMAL);
+ break;
+ case RoomInfo::ROOM_BOOKMARK:
+ DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, m_proto->LoadIconEx("disco_ok"), 16, 16, 0, NULL, DI_NORMAL);
+ break;
+ }
}
- }
+ break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
@@ -594,8 +579,7 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case CBN_SELCHANGE:
{
int iqid = GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_ROOM), GWLP_USERDATA);
- if (iqid)
- {
+ if (iqid) {
m_proto->m_iqManager.ExpireIq(iqid);
SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_ROOM), GWLP_USERDATA, 0);
}
@@ -608,11 +592,9 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case IDC_ROOM:
switch (HIWORD(wParam)) {
case CBN_DROPDOWN:
- if ( !SendDlgItemMessage(m_hwnd, IDC_ROOM, CB_GETCOUNT, 0, 0))
- {
+ if (!SendDlgItemMessage(m_hwnd, IDC_ROOM, CB_GETCOUNT, 0, 0)) {
int iqid = GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_ROOM), GWLP_USERDATA);
- if (iqid)
- {
+ if (iqid) {
m_proto->m_iqManager.ExpireIq(iqid);
SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_ROOM), GWLP_USERDATA, 0);
}
@@ -623,8 +605,7 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) TCHAR *server = (TCHAR *)_alloca(len * sizeof(TCHAR));
GetWindowText(GetDlgItem(m_hwnd, IDC_SERVER), server, len);
- if (*server)
- {
+ if (*server) {
sttRoomListAppend(GetDlgItem(m_hwnd, IDC_ROOM), RoomInfo::ROOM_WAIT, TranslateT("Loading..."), TranslateT("Please wait for room list to download."), _T(""));
CJabberIqInfo *pInfo = m_proto->AddIQ(&CJabberProto::OnIqResultDiscovery, JABBER_IQ_TYPE_GET, server, 0, -1, (void*)GetDlgItem(m_hwnd, IDC_ROOM));
@@ -634,13 +615,12 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) m_proto->m_ThreadInfo->send(iq);
SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_ROOM), GWLP_USERDATA, pInfo->GetIqId());
- } else
- {
+ }
+ else
sttRoomListAppend(GetDlgItem(m_hwnd, IDC_ROOM), RoomInfo::ROOM_FAIL,
TranslateT("Jabber Error"),
TranslateT("Please specify group chat directory first."),
_T(""));
- }
}
break;
}
@@ -697,8 +677,8 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if (GetAsyncKeyState(VK_CONTROL))
break;
}
- // fall through
+ // fall through
case IDOK:
{
GetDlgItemText(m_hwnd, IDC_SERVER, text, SIZEOF(text));
@@ -722,8 +702,9 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break;
}
break;
+
case WM_JABBER_CHECK_ONLINE:
- if ( !m_proto->m_bJabberOnline)
+ if (!m_proto->m_bJabberOnline)
EndDialog(m_hwnd, 0);
break;
}
@@ -767,9 +748,9 @@ static VOID CALLBACK JabberGroupchatChangeNickname(void* arg) JABBER_LIST_ITEM *item = param->ppro->ListGetItemPtr(LIST_CHATROOM, param->jid);
if (item != NULL) {
- TCHAR szBuffer[ 1024 ];
- TCHAR szCaption[ 1024 ];
- szBuffer[ 0 ] = _T('\0');
+ TCHAR szBuffer[1024];
+ TCHAR szCaption[1024];
+ szBuffer[0] = _T('\0');
TCHAR *roomName = item->name ? item->name : item->jid;
mir_sntprintf(szCaption, SIZEOF(szCaption), TranslateT("Change nickname in <%s>"), roomName);
@@ -777,18 +758,19 @@ static VOID CALLBACK JabberGroupchatChangeNickname(void* arg) mir_sntprintf(szBuffer, SIZEOF(szBuffer), _T("%s"), item->nick);
if (param->ppro->EnterString(szBuffer, SIZEOF(szBuffer), szCaption, JES_COMBO, "gcNick_")) {
- TCHAR text[ 1024 ];
+ TCHAR text[1024];
replaceStrT(item->nick, szBuffer);
mir_sntprintf(text, SIZEOF(text), _T("%s/%s"), item->jid, szBuffer);
param->ppro->SendPresenceTo(param->ppro->m_iStatus, text, NULL);
- } }
+ }
+ }
delete param;
}
static int sttGetStatusCode(HXML node)
{
- HXML statusNode = xmlGetChild(node , "status");
+ HXML statusNode = xmlGetChild(node, "status");
if (statusNode == NULL)
return -1;
@@ -806,13 +788,13 @@ void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const TCHAR *ol if (newNick == NULL)
return;
- pResourceStatus r( item->findResource(oldNick));
+ pResourceStatus r(item->findResource(oldNick));
if (r == NULL)
return;
r->m_tszResourceName = mir_tstrdup(newNick);
- if ( !lstrcmp(item->nick, oldNick)) {
+ if (!lstrcmp(item->nick, oldNick)) {
replaceStrT(item->nick, newNick);
HANDLE hContact = HContactFromJID(item->jid);
@@ -840,7 +822,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) {
const TCHAR *from;
- if ( !node || !xmlGetName(node) || lstrcmp(xmlGetName(node), _T("presence"))) return;
+ if (!node || !xmlGetName(node) || lstrcmp(xmlGetName(node), _T("presence"))) return;
if ((from = xmlGetAttrValue(node, _T("from"))) == NULL) return;
const TCHAR *resource = _tcschr(from, '/');
@@ -851,7 +833,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) if (item == NULL)
return;
- pResourceStatus r( item->findResource(resource));
+ pResourceStatus r(item->findResource(resource));
HXML nNode = xmlGetChildByTag(node, "nick", "xmlns", JABBER_FEAT_NICK);
const TCHAR *cnick = xmlGetText(nNode);
@@ -862,7 +844,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) r->m_tszNick = mir_tstrdup(cnick);
HXML xNode = xmlGetChildByTag(node, "x", "xmlns", JABBER_FEAT_MUC_USER);
- HXML itemNode = xmlGetChild(xNode , "item");
+ HXML itemNode = xmlGetChild(xNode, "item");
const TCHAR *type = xmlGetAttrValue(node, _T("type"));
@@ -877,26 +859,26 @@ void CJabberProto::GroupchatProcessPresence(HXML node) // Update status of room participant
int status = ID_STATUS_ONLINE;
- LPCTSTR ptszShow = xmlGetText( xmlGetChild(node , "show"));
+ LPCTSTR ptszShow = xmlGetText(xmlGetChild(node, "show"));
if (ptszShow) {
- if ( !_tcscmp(ptszShow, _T("away"))) status = ID_STATUS_AWAY;
- else if ( !_tcscmp(ptszShow, _T("xa"))) status = ID_STATUS_NA;
- else if ( !_tcscmp(ptszShow, _T("dnd"))) status = ID_STATUS_DND;
- else if ( !_tcscmp(ptszShow, _T("chat"))) status = ID_STATUS_FREECHAT;
+ if (!_tcscmp(ptszShow, _T("away"))) status = ID_STATUS_AWAY;
+ else if (!_tcscmp(ptszShow, _T("xa"))) status = ID_STATUS_NA;
+ else if (!_tcscmp(ptszShow, _T("dnd"))) status = ID_STATUS_DND;
+ else if (!_tcscmp(ptszShow, _T("chat"))) status = ID_STATUS_FREECHAT;
}
- LPCTSTR str = xmlGetText( xmlGetChild(node , "status"));
+ LPCTSTR str = xmlGetText(xmlGetChild(node, "status"));
char priority = 0;
- if (LPCTSTR ptszPriority = xmlGetText( xmlGetChild(node , "priority")))
+ if (LPCTSTR ptszPriority = xmlGetText(xmlGetChild(node, "priority")))
priority = (char)_ttoi(ptszPriority);
bool bStatusChanged = false, bRoomCreated = false, bAffiliationChanged = false, bRoleChanged = false;
int newRes = ListAddResource(LIST_CHATROOM, from, status, str, priority, cnick) ? GC_EVENT_JOIN : 0;
if (pResourceStatus oldRes = ListFindResource(LIST_CHATROOM, from))
- if ((oldRes->m_iStatus != status) || lstrcmp_null(oldRes->m_tszStatusMessage, str))
- bStatusChanged = true;
+ if ((oldRes->m_iStatus != status) || lstrcmp_null(oldRes->m_tszStatusMessage, str))
+ bStatusChanged = true;
// Check additional MUC info for this user
if (itemNode != NULL) {
@@ -907,22 +889,22 @@ void CJabberProto::GroupchatProcessPresence(HXML node) JABBER_GC_ROLE role = r->m_role;
if ((str = xmlGetAttrValue(itemNode, _T("affiliation"))) != NULL) {
- if ( !_tcscmp(str, _T("owner"))) affiliation = AFFILIATION_OWNER;
- else if ( !_tcscmp(str, _T("admin"))) affiliation = AFFILIATION_ADMIN;
- else if ( !_tcscmp(str, _T("member"))) affiliation = AFFILIATION_MEMBER;
- else if ( !_tcscmp(str, _T("none"))) affiliation = AFFILIATION_NONE;
- else if ( !_tcscmp(str, _T("outcast"))) affiliation = AFFILIATION_OUTCAST;
+ if (!_tcscmp(str, _T("owner"))) affiliation = AFFILIATION_OWNER;
+ else if (!_tcscmp(str, _T("admin"))) affiliation = AFFILIATION_ADMIN;
+ else if (!_tcscmp(str, _T("member"))) affiliation = AFFILIATION_MEMBER;
+ else if (!_tcscmp(str, _T("none"))) affiliation = AFFILIATION_NONE;
+ else if (!_tcscmp(str, _T("outcast"))) affiliation = AFFILIATION_OUTCAST;
}
if ((str = xmlGetAttrValue(itemNode, _T("role"))) != NULL) {
- if ( !_tcscmp(str, _T("moderator"))) role = ROLE_MODERATOR;
- else if ( !_tcscmp(str, _T("participant"))) role = ROLE_PARTICIPANT;
- else if ( !_tcscmp(str, _T("visitor"))) role = ROLE_VISITOR;
+ if (!_tcscmp(str, _T("moderator"))) role = ROLE_MODERATOR;
+ else if (!_tcscmp(str, _T("participant"))) role = ROLE_PARTICIPANT;
+ else if (!_tcscmp(str, _T("visitor"))) role = ROLE_VISITOR;
else role = ROLE_NONE;
}
if ((role != ROLE_NONE) && (JabberGcGetStatus(r) != JabberGcGetStatus(affiliation, role))) {
GcLogUpdateMemberStatus(item, resource, nick, NULL, GC_EVENT_REMOVESTATUS, NULL);
- if ( !newRes) newRes = GC_EVENT_ADDSTATUS;
+ if (!newRes) newRes = GC_EVENT_ADDSTATUS;
}
if (affiliation != r->m_affiliation) {
@@ -946,8 +928,8 @@ void CJabberProto::GroupchatProcessPresence(HXML node) // show status change if needed
if (bStatusChanged)
- if (pResourceStatus res = ListFindResource(LIST_CHATROOM, from))
- GcLogShowInformation(item, res, INFO_STATUS);
+ if (pResourceStatus res = ListFindResource(LIST_CHATROOM, from))
+ GcLogShowInformation(item, res, INFO_STATUS);
// Update groupchat log window
GcLogUpdateMemberStatus(item, resource, nick, str, newRes, NULL);
@@ -959,40 +941,33 @@ void CJabberProto::GroupchatProcessPresence(HXML node) if (hContact != NULL)
setWord(hContact, "Status", status);
- // Update room status
- //if (item->status != ID_STATUS_ONLINE) {
- // item->status = ID_STATUS_ONLINE;
- // setWord(hContact, "Status", (WORD)ID_STATUS_ONLINE);
- // JabberLog("Room %s online", from);
- //}
-
// Check <created/>
if (bRoomCreated) {
- HXML n = xmlGetChild(node , "created");
+ HXML n = xmlGetChild(node, "created");
if (n != NULL && (str = xmlGetAttrValue(n, _T("xmlns"))) != NULL && !_tcscmp(str, JABBER_FEAT_MUC_OWNER))
// A new room just created by me
// Request room config
m_ThreadInfo->send(
- XmlNodeIq( AddIQ(&CJabberProto::OnIqResultGetMuc, JABBER_IQ_TYPE_GET, item->jid))
- << XQUERY(JABBER_FEAT_MUC_OWNER));
+ XmlNodeIq(AddIQ(&CJabberProto::OnIqResultGetMuc, JABBER_IQ_TYPE_GET, item->jid))
+ << XQUERY(JABBER_FEAT_MUC_OWNER));
}
mir_free(room);
}
// leaving room
- else if ( !_tcscmp(type, _T("unavailable"))) {
+ else if (!_tcscmp(type, _T("unavailable"))) {
const TCHAR *str = 0;
if (xNode != NULL && item->nick != NULL) {
- HXML reasonNode = xmlGetChild(itemNode , "reason");
+ HXML reasonNode = xmlGetChild(itemNode, "reason");
str = xmlGetAttrValue(itemNode, _T("jid"));
int iStatus = sttGetStatusCode(xNode);
if (iStatus == 301 && r != NULL)
GcLogShowInformation(item, r, INFO_BAN);
- if ( !lstrcmp(resource, item->nick)) {
- switch(iStatus) {
+ if (!lstrcmp(resource, item->nick)) {
+ switch (iStatus) {
case 301:
case 307:
GcQuit(item, iStatus, reasonNode);
@@ -1001,9 +976,10 @@ void CJabberProto::GroupchatProcessPresence(HXML node) case 303:
RenameParticipantNick(item, resource, itemNode);
return;
- } }
+ }
+ }
else {
- switch(iStatus) {
+ switch (iStatus) {
case 303:
RenameParticipantNick(item, resource, itemNode);
return;
@@ -1014,9 +990,11 @@ void CJabberProto::GroupchatProcessPresence(HXML node) ListRemoveResource(LIST_CHATROOM, from);
GcLogUpdateMemberStatus(item, resource, nick, str, GC_EVENT_KICK, reasonNode, iStatus);
return;
- } } }
+ }
+ }
+ }
- HXML statusNode = xmlGetChild(node , "status");
+ HXML statusNode = xmlGetChild(node, "status");
GcLogUpdateMemberStatus(item, resource, nick, str, GC_EVENT_PART, statusNode);
ListRemoveResource(LIST_CHATROOM, from);
@@ -1026,13 +1004,13 @@ void CJabberProto::GroupchatProcessPresence(HXML node) }
// processing room errors
- else if ( !_tcscmp(type, _T("error"))) {
+ else if (!_tcscmp(type, _T("error"))) {
int errorCode = 0;
- HXML errorNode = xmlGetChild(node , "error");
- ptrT str( JabberErrorMsg(errorNode, &errorCode));
+ HXML errorNode = xmlGetChild(node, "error");
+ ptrT str(JabberErrorMsg(errorNode, &errorCode));
if (errorCode == JABBER_ERROR_CONFLICT) {
- ptrT newNick( getTStringA("GcAltNick"));
+ ptrT newNick(getTStringA("GcAltNick"));
if (++item->iChatState == 1 && newNick != NULL && newNick[0] != 0) {
replaceStrT(item->nick, newNick);
TCHAR text[1024] = { 0 };
@@ -1059,12 +1037,12 @@ void CJabberProto::GroupchatProcessMessage(HXML node) const TCHAR *from, *type, *p, *nick, *resource;
JABBER_LIST_ITEM *item;
- if ( !xmlGetName(node) || lstrcmp(xmlGetName(node), _T("message"))) return;
+ if (!xmlGetName(node) || lstrcmp(xmlGetName(node), _T("message"))) return;
if ((from = xmlGetAttrValue(node, _T("from"))) == NULL) return;
if ((item = ListGetItemPtr(LIST_CHATROOM, from)) == NULL) return;
if ((type = xmlGetAttrValue(node, _T("type"))) == NULL) return;
- if ( !lstrcmp(type, _T("error")))
+ if (!lstrcmp(type, _T("error")))
return;
GCDEST gcd = { m_szModuleName, item->jid, 0 };
@@ -1075,7 +1053,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) if (resource != NULL && *++resource == '\0')
resource = NULL;
- if ((n = xmlGetChild(node , "subject")) != NULL) {
+ if ((n = xmlGetChild(node, "subject")) != NULL) {
msgText = xmlGetText(n);
if (msgText == NULL || msgText[0] == '\0')
return;
@@ -1098,8 +1076,8 @@ void CJabberProto::GroupchatProcessMessage(HXML node) item->getTemp()->m_tszStatusMessage = mir_tstrdup(msgText);
}
else {
- if ((n = xmlGetChildByTag(node , "body", "xml:lang", m_tszSelectedLang)) == NULL)
- if ((n = xmlGetChild(node , "body")) == NULL)
+ if ((n = xmlGetChildByTag(node, "body", "xml:lang", m_tszSelectedLang)) == NULL)
+ if ((n = xmlGetChild(node, "body")) == NULL)
return;
msgText = xmlGetText(n);
@@ -1118,7 +1096,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) GcLogCreate(item);
time_t msgTime = 0;
- if ( !JabberReadXep203delay(node, msgTime)) {
+ if (!JabberReadXep203delay(node, msgTime)) {
HXML xDelay = xmlGetChildByTag(node, "x", "xmlns", _T("jabber:x:delay"));
if (xDelay && (p = xmlGetAttrValue(xDelay, _T("stamp"))) != NULL)
msgTime = JabberIsoToUnixTime(p);
@@ -1130,7 +1108,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) msgTime = now;
if (resource != NULL) {
- pResourceStatus r( item->findResource(resource));
+ pResourceStatus r(item->findResource(resource));
nick = (r && r->m_tszNick) ? r->m_tszNick : resource;
}
else nick = NULL;
@@ -1230,10 +1208,10 @@ void CJabberProto::GroupchatProcessInvite(const TCHAR *roomJid, const TCHAR *fro return;
if (m_options.AutoAcceptMUC == FALSE) {
- JABBER_GROUPCHAT_INVITE_INFO* inviteInfo = (JABBER_GROUPCHAT_INVITE_INFO *) mir_alloc(sizeof(JABBER_GROUPCHAT_INVITE_INFO));
- inviteInfo->roomJid = mir_tstrdup(roomJid);
- inviteInfo->from = mir_tstrdup(from);
- inviteInfo->reason = mir_tstrdup(reason);
+ JABBER_GROUPCHAT_INVITE_INFO* inviteInfo = (JABBER_GROUPCHAT_INVITE_INFO *)mir_alloc(sizeof(JABBER_GROUPCHAT_INVITE_INFO));
+ inviteInfo->roomJid = mir_tstrdup(roomJid);
+ inviteInfo->from = mir_tstrdup(from);
+ inviteInfo->reason = mir_tstrdup(reason);
inviteInfo->password = mir_tstrdup(password);
ForkThread((MyThreadFunc)&CJabberProto::GroupchatInviteAcceptThread, inviteInfo);
}
@@ -1241,7 +1219,8 @@ void CJabberProto::GroupchatProcessInvite(const TCHAR *roomJid, const TCHAR *fro TCHAR *myNick = JabberNickFromJID(m_szJabberJID);
AcceptGroupchatInvite(roomJid, myNick, password);
mir_free(myNick);
-} }
+ }
+}
void CJabberProto::AcceptGroupchatInvite(const TCHAR *roomJid, const TCHAR *reason, const TCHAR *password)
{
diff --git a/protocols/JabberG/src/resource.h b/protocols/JabberG/src/resource.h index bae55ddb9b..aa0b90632c 100644 --- a/protocols/JabberG/src/resource.h +++ b/protocols/JabberG/src/resource.h @@ -8,13 +8,23 @@ #define IDD_OPT_REGISTER 105
#define IDD_AGENTS 106
#define IDD_FORM 107
+#define IDD_NOTEBOOK 108
#define IDI_USER2ROOM 109
#define IDI_REFRESH 110
#define IDD_PASSWORD 111
+#define IDD_CAPTCHAFORM 112
+#define IDI_BOOKMARKS 113
+#define IDD_BOOKMARKS 114
+#define IDD_BOOKMARK_ADD 115
+#define IDD_PRIVACY_LISTS 116
+#define IDD_PRIVACY_RULE 117
+#define IDD_PRIVACY_ADD_LIST 118
+#define IDD_SERVICE_DISCOVERY 119
+#define IDD_NOTE_EDIT 120
+#define IDD_MODERNOPT 121
#define IDI_ADDCONTACT 122
#define IDI_DELETE 123
#define IDI_EDIT 124
-#define IDD_DATAFORM_TEST 125
#define IDD_VCARD_HOME 126
#define IDD_VCARD_PERSONAL 127
#define IDD_VCARD_WORK 128
@@ -24,10 +34,10 @@ #define IDI_OPEN 131
#define IDD_VCARD_PHOTO 132
#define IDD_VCARD_NOTE 133
+#define IDD_PEP_SIMPLE 134
#define IDD_CHANGEPASSWORD 136
#define IDD_SEARCHUSER 138
#define IDD_OPT_JABBER2 140
-#define IDD_GROUPCHAT 141
#define IDI_KEYS 144
#define IDI_GROUP 147
#define IDD_GROUPCHAT_JOIN 148
@@ -36,7 +46,6 @@ #define IDI_SAVE 166
#define IDD_GROUPCHAT_INPUT 167
#define IDD_JIDLIST 171
-#define IDD_AGENT_MANUAL_REGISTER 182
#define IDD_GROUPCHAT_INVITE 183
#define IDD_GROUPCHAT_INVITE_ACCEPT 184
#define IDD_OPT_JABBER3 185
@@ -58,7 +67,6 @@ #define IDI_NODE_WEATHER 203
#define IDD_CONSOLE 205
#define IDI_CONSOLE 207
-#define IDD_DATAFORM_PAGE 208
#define IDI_PL_MSG_ALLOW 209
#define IDI_PL_MSG_DENY 210
#define IDI_PL_PRIN_ALLOW 211
@@ -66,7 +74,6 @@ #define IDI_PL_PROUT_ALLOW 213
#define IDI_PL_PROUT_DENY 214
#define IDI_PL_QUERY_ALLOW 215
-#define IDD_SETMOODMSG 216
#define IDI_PL_QUERY_DENY 216
#define IDI_PL_LIST_ACTIVE 217
#define IDI_PL_LIST_ANY 218
@@ -80,9 +87,6 @@ #define IDD_ACCMGRUI 227
#define IDD_HTTP_AUTH 228
#define IDI_HTTP_AUTH 229
-#define IDD_PEP_SIMPLE 230
-#define IDD_NOTEBOOK 231
-#define IDD_NOTE_EDIT 232
#define IDI_NOTES 233
#define IDI_SEND_NOTE 234
#define IDC_STATUSBAR 999
@@ -96,14 +100,6 @@ #define IDC_LINK_PUBLIC_SERVER 1009
#define IDC_NAME 1009
#define IDC_PROGRESS_REG 1011
-#define IDC_AGENT_TRANSPORT 1015
-#define IDC_AGENT_REGISTER 1016
-#define IDC_AGENT_LOGON 1017
-#define IDC_AGENT_UNREGISTER 1018
-#define IDC_AGENT_SERVER 1019
-#define IDC_AGENT_LOGOFF 1020
-#define IDC_AGENT_LIST 1021
-#define IDC_AGENT_SEARCH 1022
#define IDC_SUBMIT 1023
#define IDC_NEXT 1025
#define IDC_PREV 1026
@@ -172,7 +168,6 @@ #define IDC_PRIORITY_LABEL 1106
#define IDC_NEWPASSWD 1107
#define IDC_COMBO_ACCTYPE 1108
-#define IDD_MODERNOPT 1110
#define IDC_PROXY_ADDR 1112
#define IDC_DIRECT_ADDR 1114
#define IDC_DIRECT_MANUAL 1121
@@ -182,7 +177,6 @@ #define IDC_ROOM 1124
#define IDC_PROXY_MANUAL 1124
#define IDC_SERVER 1125
-#define IDC_BROWSE 1126
#define IDC_VSCROLL 1128
#define IDC_NICK 1129
#define IDC_EDIT 1131
@@ -246,7 +240,6 @@ #define IDC_BTN_VIEWLIST 1255
#define IDC_BTN_FILTERAPPLY 1258
#define IDC_ROSTER 1261
-#define IDC_MSG_MOOD 1262
#define IDC_OPTTREE 1263
#define IDC_LB_LISTS 1264
#define IDC_LST_NOTES 1264
@@ -316,34 +309,24 @@ #define IDC_USEDOMAINLOGIN 1323
#define IDC_TXT_ALTNICK 1323
#define IDC_SAVE_PERM 1324
-#define IDI_BOOKMARKS 3000
-#define IDD_BOOKMARKS 3001
#define IDC_BM_LIST 3002
#define IDC_ADD 3004
#define IDC_REMOVE 3005
-#define IDD_BOOKMARK_ADD 3006
#define IDC_UP_RULE 3006
#define IDC_ROOM_JID 3007
-#define IDD_PRIVACY_LISTS 3007
#define IDC_DOWN_RULE 3007
#define IDC_APPLY 3008
-#define IDD_PRIVACY_RULE 3008
#define IDC_ROOM_RADIO 3009
-#define IDD_PRIVACY_ADD_LIST 3009
-#define IDD_SERVICE_DISCOVERY 3010
#define IDC_URL_RADIO 3011
-#define IDD_GROUPCHAT_INFO_TABS 3011
#define IDC_AGENT_RADIO 3012
-#define IDD_GROUPCHAT_ADMLIST 3012
#define IDC_BOOKMARK_TYPE 3013
#define IDC_CHECK_BM_AUTOJOIN 3014
#define IDI_PRIVACY_LISTS 3016
#define IDI_SERVICE_DISCOVERY 3017
-#define IDD_CAPTCHAFORM 3018
#define IDC_VALUE 3019
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
|