summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_iqid_muc.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-15 21:18:48 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-15 21:18:48 +0000
commit7ebaebba8520e457bf374ca245f52332fbb008be (patch)
tree55cf960e4981d9413befb1bf275a3fd067bf2534 /protocols/JabberG/src/jabber_iqid_muc.cpp
parent8353de363fc22940685b334cbb38c0378e9c1b71 (diff)
bye-bye old coding style in Jabber
git-svn-id: http://svn.miranda-ng.org/main/trunk@2322 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_iqid_muc.cpp')
-rw-r--r--protocols/JabberG/src/jabber_iqid_muc.cpp372
1 files changed, 186 insertions, 186 deletions
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp
index 3621506d29..689ce8ef54 100644
--- a/protocols/JabberG/src/jabber_iqid_muc.cpp
+++ b/protocols/JabberG/src/jabber_iqid_muc.cpp
@@ -1,13 +1,13 @@
/*
Jabber Protocol Plugin for Miranda IM
-Copyright ( C ) 2002-04 Santithorn Bunchua
-Copyright ( C ) 2005-12 George Hazan
+Copyright (C) 2002-04 Santithorn Bunchua
+Copyright (C) 2005-12 George Hazan
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
-of the License, or ( at your option ) any later version.
+of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,44 +25,44 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "jabber_iq.h"
#include "jabber_caps.h"
-void CJabberProto::SetMucConfig( HXML node, void *from )
+void CJabberProto::SetMucConfig(HXML node, void *from)
{
- if ( m_ThreadInfo && from ) {
- XmlNodeIq iq( _T("set"), SerialNext(), ( TCHAR* )from );
- HXML query = iq << XQUERY( xmlnsOwner );
- xmlAddChild( query, node );
- m_ThreadInfo->send( iq );
+ if (m_ThreadInfo && from) {
+ XmlNodeIq iq(_T("set"), SerialNext(), (TCHAR*)from);
+ HXML query = iq << XQUERY(xmlnsOwner);
+ xmlAddChild(query, node);
+ m_ThreadInfo->send(iq);
} }
void LaunchForm(HXML node);
-void CJabberProto::OnIqResultGetMuc( HXML iqNode )
+void CJabberProto::OnIqResultGetMuc(HXML iqNode)
{
HXML queryNode, xNode;
const TCHAR *type, *from, *str;
// RECVED: room config form
// ACTION: show the form
- Log( "<iq/> iqIdGetMuc" );
- if (( type = xmlGetAttrValue( iqNode, _T("type"))) == NULL ) return;
- if (( from = xmlGetAttrValue( iqNode, _T("from"))) == NULL ) return;
-
- if ( !_tcscmp( type, _T("result"))) {
- if (( queryNode = xmlGetChild( iqNode , "query" )) != NULL ) {
- str = xmlGetAttrValue( queryNode, _T("xmlns"));
- if ( !lstrcmp( str, _T("http://jabber.org/protocol/muc#owner" ))) {
- if (( xNode = xmlGetChild( queryNode , "x" )) != NULL ) {
- str = xmlGetAttrValue( xNode, _T("xmlns"));
- if ( !lstrcmp( str, _T(JABBER_FEAT_DATA_FORMS)))
+ Log("<iq/> iqIdGetMuc");
+ if ((type = xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
+ if ((from = xmlGetAttrValue(iqNode, _T("from"))) == NULL) return;
+
+ if ( !_tcscmp(type, _T("result"))) {
+ if ((queryNode = xmlGetChild(iqNode , "query")) != NULL) {
+ str = xmlGetAttrValue(queryNode, _T("xmlns"));
+ if ( !lstrcmp(str, _T("http://jabber.org/protocol/muc#owner"))) {
+ if ((xNode = xmlGetChild(queryNode , "x")) != NULL) {
+ str = xmlGetAttrValue(xNode, _T("xmlns"));
+ if ( !lstrcmp(str, _T(JABBER_FEAT_DATA_FORMS)))
//LaunchForm(xNode);
- FormCreateDialog( xNode, _T("Jabber Conference Room Configuration"), &CJabberProto::SetMucConfig, mir_tstrdup( from ));
+ FormCreateDialog(xNode, _T("Jabber Conference Room Configuration"), &CJabberProto::SetMucConfig, mir_tstrdup(from));
} } } } }
static void sttFillJidList(HWND hwndDlg)
{
JABBER_MUC_JIDLIST_INFO *jidListInfo;
HXML iqNode, queryNode;
- const TCHAR* from, *jid, *reason, *nick;
+ const TCHAR *from, *jid, *reason, *nick;
LVITEM lvi;
HWND hwndList;
int count, i;
@@ -75,66 +75,66 @@ static void sttFillJidList(HWND hwndDlg)
GetDlgItemText(hwndDlg, IDC_FILTER, filter, filterLength);
}
- jidListInfo = ( JABBER_MUC_JIDLIST_INFO * ) GetWindowLongPtr( hwndDlg, GWLP_USERDATA );
- if ( !jidListInfo )
+ jidListInfo = (JABBER_MUC_JIDLIST_INFO *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ if ( !jidListInfo)
return;
- hwndList = GetDlgItem( hwndDlg, IDC_LIST );
+ hwndList = GetDlgItem(hwndDlg, IDC_LIST);
SendMessage(hwndList, WM_SETREDRAW, FALSE, 0);
- count = ListView_GetItemCount( hwndList );
+ count = ListView_GetItemCount(hwndList);
lvi.mask = LVIF_PARAM;
lvi.iSubItem = 0;
- for ( i=0; i<count; i++ ) {
+ for (i=0; i<count; i++) {
lvi.iItem = i;
- if ( ListView_GetItem( hwndList, &lvi ) == TRUE ) {
- if ( lvi.lParam!=( LPARAM )( -1 ) && lvi.lParam!=( LPARAM )( NULL )) {
- mir_free(( void * ) lvi.lParam );
+ if (ListView_GetItem(hwndList, &lvi) == TRUE) {
+ if (lvi.lParam!=(LPARAM)(-1) && lvi.lParam!=(LPARAM)(NULL)) {
+ mir_free((void *) lvi.lParam);
}
}
}
- ListView_DeleteAllItems( hwndList );
+ ListView_DeleteAllItems(hwndList);
// Populate displayed list from iqNode
- if (( iqNode = jidListInfo->iqNode ) != NULL ) {
- if (( from = xmlGetAttrValue( iqNode, _T("from"))) != NULL ) {
- if (( queryNode = xmlGetChild( iqNode , "query" )) != NULL ) {
+ if ((iqNode = jidListInfo->iqNode) != NULL) {
+ if ((from = xmlGetAttrValue(iqNode, _T("from"))) != NULL) {
+ if ((queryNode = xmlGetChild(iqNode , "query")) != NULL) {
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.iSubItem = 0;
lvi.iItem = 0;
- for ( i=0; ; i++ ) {
- HXML itemNode = xmlGetChild( queryNode ,i);
- if ( !itemNode )
+ for (i=0; ; i++) {
+ HXML itemNode = xmlGetChild(queryNode ,i);
+ if ( !itemNode)
break;
- if (( jid = xmlGetAttrValue( itemNode, _T("jid"))) != NULL ) {
- lvi.pszText = ( TCHAR* )jid;
- if ( jidListInfo->type == MUC_BANLIST ) {
- if (( reason = xmlGetText(xmlGetChild( itemNode , "reason" ))) != NULL ) {
+ if ((jid = xmlGetAttrValue(itemNode, _T("jid"))) != NULL) {
+ lvi.pszText = (TCHAR*)jid;
+ if (jidListInfo->type == MUC_BANLIST) {
+ if ((reason = xmlGetText(xmlGetChild(itemNode , "reason"))) != NULL) {
TCHAR jidreason[ JABBER_MAX_JID_LEN + 256 ];
- mir_sntprintf( jidreason, SIZEOF( jidreason ), _T("%s (%s)") , jid, reason );
+ mir_sntprintf(jidreason, SIZEOF(jidreason), _T("%s (%s)") , jid, reason);
lvi.pszText = jidreason;
} }
- if ( jidListInfo->type == MUC_VOICELIST || jidListInfo->type == MUC_MODERATORLIST ) {
- if (( nick = xmlGetAttrValue( itemNode, _T("nick"))) != NULL ) {
+ if (jidListInfo->type == MUC_VOICELIST || jidListInfo->type == MUC_MODERATORLIST) {
+ if ((nick = xmlGetAttrValue(itemNode, _T("nick"))) != NULL) {
TCHAR nickjid[ JABBER_MAX_JID_LEN + 256 ];
- mir_sntprintf( nickjid, SIZEOF( nickjid ), _T("%s (%s)") , nick, jid );
+ mir_sntprintf(nickjid, SIZEOF(nickjid), _T("%s (%s)") , nick, jid);
lvi.pszText = nickjid;
} }
if (filter && *filter && !JabberStrIStr(lvi.pszText, filter))
continue;
- lvi.lParam = ( LPARAM )mir_tstrdup( jid );
+ lvi.lParam = (LPARAM)mir_tstrdup(jid);
- ListView_InsertItem( hwndList, &lvi );
+ ListView_InsertItem(hwndList, &lvi);
lvi.iItem++;
} } } } }
lvi.mask = LVIF_PARAM;
- lvi.lParam = ( LPARAM )( -1 );
- ListView_InsertItem( hwndList, &lvi );
+ lvi.lParam = (LPARAM)(-1);
+ ListView_InsertItem(hwndList, &lvi);
SendMessage(hwndList, WM_SETREDRAW, TRUE, 0);
RedrawWindow(hwndList, NULL, NULL, RDW_INVALIDATE);
@@ -155,29 +155,29 @@ static int sttJidListResizer(HWND, LPARAM, UTILRESIZECONTROL *urc)
return RD_ANCHORX_LEFT|RD_ANCHORY_TOP;
}
-static INT_PTR CALLBACK JabberMucJidListDlgProc( HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam )
+static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- JABBER_MUC_JIDLIST_INFO* dat = (JABBER_MUC_JIDLIST_INFO*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA );
+ JABBER_MUC_JIDLIST_INFO* dat = (JABBER_MUC_JIDLIST_INFO*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch( msg ) {
+ switch(msg) {
case WM_INITDIALOG:
{
LVCOLUMN lvc;
RECT rc;
HWND hwndList;
- TranslateDialogDefault( hwndDlg );
+ TranslateDialogDefault(hwndDlg);
- hwndList = GetDlgItem( hwndDlg, IDC_LIST );
+ hwndList = GetDlgItem(hwndDlg, IDC_LIST);
ListView_SetExtendedListViewStyle(hwndList, LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
- GetClientRect( hwndList, &rc );
- //rc.right -= GetSystemMetrics( SM_CXVSCROLL );
+ GetClientRect(hwndList, &rc);
+ //rc.right -= GetSystemMetrics(SM_CXVSCROLL);
lvc.mask = LVCF_WIDTH;
lvc.cx = rc.right - 20;
- ListView_InsertColumn( hwndList, 0, &lvc );
+ ListView_InsertColumn(hwndList, 0, &lvc);
lvc.cx = 20;
- ListView_InsertColumn( hwndList, 1, &lvc );
- SendMessage( hwndDlg, WM_JABBER_REFRESH, 0, lParam );
+ ListView_InsertColumn(hwndList, 1, &lvc);
+ SendMessage(hwndDlg, WM_JABBER_REFRESH, 0, lParam);
dat = (JABBER_MUC_JIDLIST_INFO*)lParam;
static struct
@@ -215,10 +215,10 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc( HWND hwndDlg, UINT msg, WPARAM
RECT listrc;
LVCOLUMN lvc;
- HWND hwndList = GetDlgItem( hwndDlg, IDC_LIST );
- GetClientRect( hwndList, &listrc );
+ HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST);
+ GetClientRect(hwndList, &listrc);
lvc.mask = LVCF_WIDTH;
- //listrc.right -= GetSystemMetrics( SM_CXVSCROLL );
+ //listrc.right -= GetSystemMetrics(SM_CXVSCROLL);
lvc.cx = listrc.right - 20;
SendMessage(hwndList, LVM_SETCOLUMN, 0, (LPARAM)&lvc);
break;
@@ -227,131 +227,131 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc( HWND hwndDlg, UINT msg, WPARAM
case WM_JABBER_REFRESH:
{
- // lParam is ( JABBER_MUC_JIDLIST_INFO * )
+ // lParam is (JABBER_MUC_JIDLIST_INFO *)
HXML iqNode, queryNode;
- const TCHAR* from;
+ const TCHAR *from;
TCHAR title[256];
// Clear current GWL_USERDATA, if any
- if ( dat != NULL )
+ if (dat != NULL)
delete dat;
// Set new GWL_USERDATA
- dat = ( JABBER_MUC_JIDLIST_INFO * ) lParam;
- SetWindowLongPtr( hwndDlg, GWLP_USERDATA, ( LONG_PTR ) dat );
+ dat = (JABBER_MUC_JIDLIST_INFO *) lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dat);
// Populate displayed list from iqNode
- lstrcpyn( title, TranslateT( "JID List" ), SIZEOF( title ));
- if (( dat=( JABBER_MUC_JIDLIST_INFO * ) lParam ) != NULL ) {
- if (( iqNode = dat->iqNode ) != NULL ) {
- if (( from = xmlGetAttrValue( iqNode, _T("from"))) != NULL ) {
- dat->roomJid = mir_tstrdup( from );
-
- if (( queryNode = xmlGetChild( iqNode , "query" )) != NULL ) {
- TCHAR* localFrom = mir_tstrdup( from );
- mir_sntprintf( title, SIZEOF( title ), TranslateT("%s, %d items (%s)"),
- ( dat->type == MUC_VOICELIST ) ? TranslateT( "Voice List" ) :
- ( dat->type == MUC_MEMBERLIST ) ? TranslateT( "Member List" ) :
- ( dat->type == MUC_MODERATORLIST ) ? TranslateT( "Moderator List" ) :
- ( dat->type == MUC_BANLIST ) ? TranslateT( "Ban List" ) :
- ( dat->type == MUC_ADMINLIST ) ? TranslateT( "Admin List" ) :
- ( dat->type == MUC_OWNERLIST ) ? TranslateT( "Owner List" ) :
- TranslateT( "JID List" ), xmlGetChildCount(queryNode), localFrom );
- mir_free( localFrom );
+ lstrcpyn(title, TranslateT("JID List"), SIZEOF(title));
+ if ((dat=(JABBER_MUC_JIDLIST_INFO *) lParam) != NULL) {
+ if ((iqNode = dat->iqNode) != NULL) {
+ if ((from = xmlGetAttrValue(iqNode, _T("from"))) != NULL) {
+ dat->roomJid = mir_tstrdup(from);
+
+ if ((queryNode = xmlGetChild(iqNode , "query")) != NULL) {
+ TCHAR* localFrom = mir_tstrdup(from);
+ mir_sntprintf(title, SIZEOF(title), TranslateT("%s, %d items (%s)"),
+ (dat->type == MUC_VOICELIST) ? TranslateT("Voice List") :
+ (dat->type == MUC_MEMBERLIST) ? TranslateT("Member List") :
+ (dat->type == MUC_MODERATORLIST) ? TranslateT("Moderator List") :
+ (dat->type == MUC_BANLIST) ? TranslateT("Ban List") :
+ (dat->type == MUC_ADMINLIST) ? TranslateT("Admin List") :
+ (dat->type == MUC_OWNERLIST) ? TranslateT("Owner List") :
+ TranslateT("JID List"), xmlGetChildCount(queryNode), localFrom);
+ mir_free(localFrom);
} } } }
- SetWindowText( hwndDlg, title );
+ SetWindowText(hwndDlg, title);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FILTER), GWLP_USERDATA, 0);
sttFillJidList(hwndDlg);
}
break;
case WM_NOTIFY:
- if (( ( LPNMHDR )lParam )->idFrom == IDC_LIST ) {
- switch (( ( LPNMHDR )lParam )->code ) {
+ if (((LPNMHDR)lParam)->idFrom == IDC_LIST) {
+ switch (((LPNMHDR)lParam)->code) {
case NM_CUSTOMDRAW:
{
- NMLVCUSTOMDRAW *nm = ( NMLVCUSTOMDRAW * ) lParam;
+ NMLVCUSTOMDRAW *nm = (NMLVCUSTOMDRAW *) lParam;
- switch ( nm->nmcd.dwDrawStage ) {
+ switch (nm->nmcd.dwDrawStage) {
case CDDS_PREPAINT:
case CDDS_ITEMPREPAINT:
- SetWindowLongPtr( hwndDlg, DWLP_MSGRESULT, CDRF_NOTIFYSUBITEMDRAW );
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_NOTIFYSUBITEMDRAW);
return TRUE;
case CDDS_SUBITEM|CDDS_ITEMPREPAINT:
{
RECT rc;
HICON hIcon;
- ListView_GetSubItemRect( nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, LVIR_LABEL, &rc );
- if ( nm->iSubItem == 1 ) {
- if ( nm->nmcd.lItemlParam == ( LPARAM )( -1 ))
- hIcon = ( HICON )LoadImage( hInst, MAKEINTRESOURCE( IDI_ADDCONTACT ), IMAGE_ICON, GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), 0 );
+ ListView_GetSubItemRect(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, LVIR_LABEL, &rc);
+ if (nm->iSubItem == 1) {
+ if (nm->nmcd.lItemlParam == (LPARAM)(-1))
+ hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_ADDCONTACT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
else
- hIcon = ( HICON )LoadImage( hInst, MAKEINTRESOURCE( IDI_DELETE ), IMAGE_ICON, GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), 0 );
- DrawIconEx( nm->nmcd.hdc, ( rc.left+rc.right-GetSystemMetrics( SM_CXSMICON ))/2, ( rc.top+rc.bottom-GetSystemMetrics( SM_CYSMICON ))/2,hIcon, GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), 0, GetSysColorBrush(COLOR_WINDOW), DI_NORMAL );
- DestroyIcon( hIcon );
- SetWindowLongPtr( hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT );
+ hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_DELETE), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
+ DrawIconEx(nm->nmcd.hdc, (rc.left+rc.right-GetSystemMetrics(SM_CXSMICON))/2, (rc.top+rc.bottom-GetSystemMetrics(SM_CYSMICON))/2,hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, GetSysColorBrush(COLOR_WINDOW), DI_NORMAL);
+ DestroyIcon(hIcon);
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT);
return TRUE;
} } } }
break;
case NM_CLICK:
{
- NMLISTVIEW *nm = ( NMLISTVIEW * ) lParam;
+ NMLISTVIEW *nm = (NMLISTVIEW *) lParam;
LVITEM lvi;
LVHITTESTINFO hti;
TCHAR text[128];
- if ( nm->iSubItem < 1 )
+ if (nm->iSubItem < 1)
break;
- hti.pt.x = ( short ) LOWORD( GetMessagePos());
- hti.pt.y = ( short ) HIWORD( GetMessagePos());
- ScreenToClient( nm->hdr.hwndFrom, &hti.pt );
- if ( ListView_SubItemHitTest( nm->hdr.hwndFrom, &hti ) == -1 )
+ hti.pt.x = (short) LOWORD(GetMessagePos());
+ hti.pt.y = (short) HIWORD(GetMessagePos());
+ ScreenToClient(nm->hdr.hwndFrom, &hti.pt);
+ if (ListView_SubItemHitTest(nm->hdr.hwndFrom, &hti) == -1)
break;
- if ( hti.iSubItem != 1 )
+ if (hti.iSubItem != 1)
break;
lvi.mask = LVIF_PARAM | LVIF_TEXT;
lvi.iItem = hti.iItem;
lvi.iSubItem = 0;
lvi.pszText = text;
- lvi.cchTextMax = sizeof( text );
- ListView_GetItem( nm->hdr.hwndFrom, &lvi );
- if ( lvi.lParam == ( LPARAM )( -1 )) {
+ lvi.cchTextMax = sizeof(text);
+ ListView_GetItem(nm->hdr.hwndFrom, &lvi);
+ if (lvi.lParam == (LPARAM)(-1)) {
TCHAR szBuffer[ 1024 ];
- _tcscpy( szBuffer, dat->type2str());
+ _tcscpy(szBuffer, dat->type2str());
if ( !dat->ppro->EnterString(szBuffer, SIZEOF(szBuffer), NULL, JES_COMBO, "gcAddNick_"))
break;
// Trim leading and trailing whitespaces
TCHAR *p = szBuffer, *q;
- for ( p = szBuffer; *p!='\0' && isspace( BYTE( *p )); p++);
- for ( q = p; *q!='\0' && !isspace( BYTE( *q )); q++);
+ for (p = szBuffer; *p!='\0' && isspace(BYTE(*p)); p++);
+ for (q = p; *q!='\0' && !isspace(BYTE(*q)); q++);
if (*q != '\0') *q = '\0';
if (*p == '\0')
break;
TCHAR rsn[ 1024 ];
- _tcscpy( rsn, dat->type2str());
- if ( dat->type == MUC_BANLIST ) {
+ _tcscpy(rsn, dat->type2str());
+ if (dat->type == MUC_BANLIST) {
dat->ppro->EnterString(rsn, SIZEOF(rsn), TranslateT("Reason to ban") , JES_COMBO, "gcAddReason_");
- if ( szBuffer )
- dat->ppro->AddMucListItem( dat, p , rsn);
+ if (szBuffer)
+ dat->ppro->AddMucListItem(dat, p , rsn);
else
- dat->ppro->AddMucListItem( dat, p );
+ dat->ppro->AddMucListItem(dat, p);
}
- else dat->ppro->AddMucListItem( dat, p );
+ else dat->ppro->AddMucListItem(dat, p);
}
else {
//delete
TCHAR msgText[128];
- mir_sntprintf( msgText, SIZEOF( msgText ), _T("%s %s?"), TranslateT( "Removing" ), text );
- if ( MessageBox( hwndDlg, msgText, dat->type2str(), MB_YESNO|MB_SETFOREGROUND ) == IDYES ) {
- dat->ppro->DeleteMucListItem( dat, ( TCHAR* )lvi.lParam );
- mir_free(( void * )lvi.lParam );
- ListView_DeleteItem( nm->hdr.hwndFrom, hti.iItem );
+ mir_sntprintf(msgText, SIZEOF(msgText), _T("%s %s?"), TranslateT("Removing"), text);
+ if (MessageBox(hwndDlg, msgText, dat->type2str(), MB_YESNO|MB_SETFOREGROUND) == IDYES) {
+ dat->ppro->DeleteMucListItem(dat, (TCHAR*)lvi.lParam);
+ mir_free((void *)lvi.lParam);
+ ListView_DeleteItem(nm->hdr.hwndFrom, hti.iItem);
} } }
break;
}
@@ -373,12 +373,12 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc( HWND hwndDlg, UINT msg, WPARAM
}
break;
/* case WM_SETCURSOR:
- if ( LOWORD( LPARAM )!= HTCLIENT ) break;
- if ( GetForegroundWindow() == GetParent( hwndDlg )) {
+ if (LOWORD(LPARAM)!= HTCLIENT) break;
+ if (GetForegroundWindow() == GetParent(hwndDlg)) {
POINT pt;
- GetCursorPos( &pt );
- ScreenToClient( hwndDlg,&pt );
- SetFocus( ChildWindowFromPoint( hwndDlg,pt )); //ugly hack because listviews ignore their first click
+ GetCursorPos(&pt);
+ ScreenToClient(hwndDlg,&pt);
+ SetFocus(ChildWindowFromPoint(hwndDlg,pt)); //ugly hack because listviews ignore their first click
}
break;
*/ case WM_CLOSE:
@@ -388,22 +388,22 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc( HWND hwndDlg, UINT msg, WPARAM
LVITEM lvi;
// Free lParam of the displayed list items
- hwndList = GetDlgItem( hwndDlg, IDC_LIST );
- count = ListView_GetItemCount( hwndList );
+ hwndList = GetDlgItem(hwndDlg, IDC_LIST);
+ count = ListView_GetItemCount(hwndList);
lvi.mask = LVIF_PARAM;
lvi.iSubItem = 0;
- for ( i=0; i<count; i++ ) {
+ for (i=0; i<count; i++) {
lvi.iItem = i;
- if ( ListView_GetItem( hwndList, &lvi ) == TRUE ) {
- if ( lvi.lParam!=( LPARAM )( -1 ) && lvi.lParam!=( LPARAM )( NULL )) {
- mir_free(( void * ) lvi.lParam );
+ if (ListView_GetItem(hwndList, &lvi) == TRUE) {
+ if (lvi.lParam!=(LPARAM)(-1) && lvi.lParam!=(LPARAM)(NULL)) {
+ mir_free((void *) lvi.lParam);
}
}
}
- ListView_DeleteAllItems( hwndList );
+ ListView_DeleteAllItems(hwndList);
CJabberProto* ppro = dat->ppro;
- switch ( dat->type ) {
+ switch (dat->type) {
case MUC_VOICELIST:
ppro->m_hwndMucVoiceList = NULL;
break;
@@ -424,13 +424,13 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc( HWND hwndDlg, UINT msg, WPARAM
break;
}
- DestroyWindow( hwndDlg );
+ DestroyWindow(hwndDlg);
}
break;
case WM_DESTROY:
// Clear GWL_USERDATA
- if ( dat != NULL ) {
+ if (dat != NULL) {
Utils_SaveWindowPosition(hwndDlg, NULL, dat->ppro->m_szModuleName, "jidListWnd_");
delete dat;
}
@@ -439,20 +439,20 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc( HWND hwndDlg, UINT msg, WPARAM
return FALSE;
}
-static void CALLBACK JabberMucJidListCreateDialogApcProc( void* param )
+static void CALLBACK JabberMucJidListCreateDialogApcProc(void* param)
{
HXML iqNode, queryNode;
- const TCHAR* from;
+ const TCHAR *from;
HWND *pHwndJidList;
JABBER_MUC_JIDLIST_INFO *jidListInfo = (JABBER_MUC_JIDLIST_INFO *)param;
- if ( jidListInfo == NULL ) return;
- if (( iqNode = jidListInfo->iqNode ) == NULL ) return;
- if (( from = xmlGetAttrValue( iqNode, _T("from"))) == NULL ) return;
- if (( queryNode = xmlGetChild( iqNode , "query" )) == NULL ) return;
+ if (jidListInfo == NULL) return;
+ if ((iqNode = jidListInfo->iqNode) == NULL) return;
+ if ((from = xmlGetAttrValue(iqNode, _T("from"))) == NULL) return;
+ if ((queryNode = xmlGetChild(iqNode , "query")) == NULL) return;
CJabberProto* ppro = jidListInfo->ppro;
- switch ( jidListInfo->type ) {
+ switch (jidListInfo->type) {
case MUC_VOICELIST:
pHwndJidList = &ppro->m_hwndMucVoiceList;
break;
@@ -472,89 +472,89 @@ static void CALLBACK JabberMucJidListCreateDialogApcProc( void* param )
pHwndJidList = &ppro->m_hwndMucOwnerList;
break;
default:
- mir_free( jidListInfo );
+ mir_free(jidListInfo);
return;
}
- if ( *pHwndJidList!=NULL && IsWindow( *pHwndJidList )) {
- SetForegroundWindow( *pHwndJidList );
- SendMessage( *pHwndJidList, WM_JABBER_REFRESH, 0, ( LPARAM )jidListInfo );
+ if (*pHwndJidList!=NULL && IsWindow(*pHwndJidList)) {
+ SetForegroundWindow(*pHwndJidList);
+ SendMessage(*pHwndJidList, WM_JABBER_REFRESH, 0, (LPARAM)jidListInfo);
}
- else *pHwndJidList = CreateDialogParam( hInst, MAKEINTRESOURCE( IDD_JIDLIST ), GetForegroundWindow(), JabberMucJidListDlgProc, ( LPARAM )jidListInfo );
+ else *pHwndJidList = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_JIDLIST), GetForegroundWindow(), JabberMucJidListDlgProc, (LPARAM)jidListInfo);
}
-void CJabberProto::OnIqResultMucGetJidList( HXML iqNode, JABBER_MUC_JIDLIST_TYPE listType )
+void CJabberProto::OnIqResultMucGetJidList(HXML iqNode, JABBER_MUC_JIDLIST_TYPE listType)
{
- const TCHAR* type;
+ const TCHAR *type;
JABBER_MUC_JIDLIST_INFO *jidListInfo;
- if (( type = xmlGetAttrValue( iqNode, _T("type"))) == NULL ) return;
+ if ((type = xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
- if ( !lstrcmp( type, _T("result" ))) {
- if (( jidListInfo = new JABBER_MUC_JIDLIST_INFO ) != NULL ) {
+ if ( !lstrcmp(type, _T("result"))) {
+ if ((jidListInfo = new JABBER_MUC_JIDLIST_INFO) != NULL) {
jidListInfo->type = listType;
jidListInfo->ppro = this;
jidListInfo->roomJid = NULL; // Set in the dialog procedure
- if (( jidListInfo->iqNode = xi.copyNode( iqNode )) != NULL )
- CallFunctionAsync( JabberMucJidListCreateDialogApcProc, jidListInfo );
+ if ((jidListInfo->iqNode = xi.copyNode(iqNode)) != NULL)
+ CallFunctionAsync(JabberMucJidListCreateDialogApcProc, jidListInfo);
else
- mir_free( jidListInfo );
+ mir_free(jidListInfo);
} } }
-void CJabberProto::OnIqResultMucGetVoiceList( HXML iqNode )
+void CJabberProto::OnIqResultMucGetVoiceList(HXML iqNode)
{
- Log( "<iq/> iqResultMucGetVoiceList" );
- OnIqResultMucGetJidList( iqNode, MUC_VOICELIST );
+ Log("<iq/> iqResultMucGetVoiceList");
+ OnIqResultMucGetJidList(iqNode, MUC_VOICELIST);
}
-void CJabberProto::OnIqResultMucGetMemberList( HXML iqNode )
+void CJabberProto::OnIqResultMucGetMemberList(HXML iqNode)
{
- Log( "<iq/> iqResultMucGetMemberList" );
- OnIqResultMucGetJidList( iqNode, MUC_MEMBERLIST );
+ Log("<iq/> iqResultMucGetMemberList");
+ OnIqResultMucGetJidList(iqNode, MUC_MEMBERLIST);
}
-void CJabberProto::OnIqResultMucGetModeratorList( HXML iqNode )
+void CJabberProto::OnIqResultMucGetModeratorList(HXML iqNode)
{
- Log( "<iq/> iqResultMucGetModeratorList" );
- OnIqResultMucGetJidList( iqNode, MUC_MODERATORLIST );
+ Log("<iq/> iqResultMucGetModeratorList");
+ OnIqResultMucGetJidList(iqNode, MUC_MODERATORLIST);
}
-void CJabberProto::OnIqResultMucGetBanList( HXML iqNode )
+void CJabberProto::OnIqResultMucGetBanList(HXML iqNode)
{
- Log( "<iq/> iqResultMucGetBanList" );
- OnIqResultMucGetJidList( iqNode, MUC_BANLIST );
+ Log("<iq/> iqResultMucGetBanList");
+ OnIqResultMucGetJidList(iqNode, MUC_BANLIST);
}
-void CJabberProto::OnIqResultMucGetAdminList( HXML iqNode )
+void CJabberProto::OnIqResultMucGetAdminList(HXML iqNode)
{
- Log( "<iq/> iqResultMucGetAdminList" );
- OnIqResultMucGetJidList( iqNode, MUC_ADMINLIST );
+ Log("<iq/> iqResultMucGetAdminList");
+ OnIqResultMucGetJidList(iqNode, MUC_ADMINLIST);
}
-void CJabberProto::OnIqResultMucGetOwnerList( HXML iqNode )
+void CJabberProto::OnIqResultMucGetOwnerList(HXML iqNode)
{
- Log( "<iq/> iqResultMucGetOwnerList" );
- OnIqResultMucGetJidList( iqNode, MUC_OWNERLIST );
+ Log("<iq/> iqResultMucGetOwnerList");
+ OnIqResultMucGetJidList(iqNode, MUC_OWNERLIST);
}
/////////////////////////////////////////////////////////////////////////////////////////
JABBER_MUC_JIDLIST_INFO::~JABBER_MUC_JIDLIST_INFO()
{
- xi.destroyNode( iqNode );
- mir_free( roomJid );
+ xi.destroyNode(iqNode);
+ mir_free(roomJid);
}
TCHAR* JABBER_MUC_JIDLIST_INFO::type2str() const
{
- switch( type ) {
- case MUC_VOICELIST: return TranslateT( "Voice List" );
- case MUC_MEMBERLIST: return TranslateT( "Member List" );
- case MUC_MODERATORLIST: return TranslateT( "Moderator List" );
- case MUC_BANLIST: return TranslateT( "Ban List" );
- case MUC_ADMINLIST: return TranslateT( "Admin List" );
- case MUC_OWNERLIST: return TranslateT( "Owner List" );
+ switch(type) {
+ case MUC_VOICELIST: return TranslateT("Voice List");
+ case MUC_MEMBERLIST: return TranslateT("Member List");
+ case MUC_MODERATORLIST: return TranslateT("Moderator List");
+ case MUC_BANLIST: return TranslateT("Ban List");
+ case MUC_ADMINLIST: return TranslateT("Admin List");
+ case MUC_OWNERLIST: return TranslateT("Owner List");
}
- return TranslateT( "JID List" );
+ return TranslateT("JID List");
}