diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-15 21:18:48 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-15 21:18:48 +0000 |
commit | 7ebaebba8520e457bf374ca245f52332fbb008be (patch) | |
tree | 55cf960e4981d9413befb1bf275a3fd067bf2534 /protocols/JabberG/src/jabber_menu.cpp | |
parent | 8353de363fc22940685b334cbb38c0378e9c1b71 (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_menu.cpp')
-rw-r--r-- | protocols/JabberG/src/jabber_menu.cpp | 738 |
1 files changed, 369 insertions, 369 deletions
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index e13a56864d..225a4fccc2 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -1,14 +1,14 @@ /*
Jabber Protocol Plugin for Miranda IM
-Copyright ( C ) 2002-04 Santithorn Bunchua
-Copyright ( C ) 2005-12 George Hazan
-Copyright ( C ) 2007 Maxim Mluhov
+Copyright (C) 2002-04 Santithorn Bunchua
+Copyright (C) 2005-12 George Hazan
+Copyright (C) 2007 Maxim Mluhov
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
@@ -72,149 +72,149 @@ static struct };
static HGENMENU g_hMenuDirectPresence[SIZEOF(PresenceModeArray) + 1];
-static INT_PTR JabberMenuChooseService( WPARAM wParam, LPARAM lParam )
+static INT_PTR JabberMenuChooseService(WPARAM wParam, LPARAM lParam)
{
- if ( lParam )
- *( void** )lParam = ( void* )wParam;
+ if (lParam)
+ *(void**)lParam = (void*)wParam;
return 0;
}
-static CJabberProto* JabberGetInstanceByHContact( HANDLE hContact )
+static CJabberProto* JabberGetInstanceByHContact(HANDLE hContact)
{
- char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 );
- if ( szProto == NULL )
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ if (szProto == NULL)
return NULL;
- for ( int i=0; i < g_Instances.getCount(); i++ )
- if ( !strcmp( szProto, g_Instances[i]->m_szModuleName ))
+ for (int i=0; i < g_Instances.getCount(); i++)
+ if ( !strcmp(szProto, g_Instances[i]->m_szModuleName))
return g_Instances[i];
return NULL;
}
-static INT_PTR JabberMenuHandleRequestAuth( WPARAM wParam, LPARAM lParam )
+static INT_PTR JabberMenuHandleRequestAuth(WPARAM wParam, LPARAM lParam)
{
- CJabberProto* ppro = JabberGetInstanceByHContact(( HANDLE )wParam );
- return( ppro ) ? ppro->OnMenuHandleRequestAuth( wParam, lParam ) : 0;
+ CJabberProto* ppro = JabberGetInstanceByHContact((HANDLE)wParam);
+ return(ppro) ? ppro->OnMenuHandleRequestAuth(wParam, lParam) : 0;
}
-static INT_PTR JabberMenuHandleGrantAuth( WPARAM wParam, LPARAM lParam )
+static INT_PTR JabberMenuHandleGrantAuth(WPARAM wParam, LPARAM lParam)
{
- CJabberProto* ppro = JabberGetInstanceByHContact(( HANDLE )wParam );
- return( ppro ) ? ppro->OnMenuHandleGrantAuth( wParam, lParam ) : 0;
+ CJabberProto* ppro = JabberGetInstanceByHContact((HANDLE)wParam);
+ return(ppro) ? ppro->OnMenuHandleGrantAuth(wParam, lParam) : 0;
}
-static INT_PTR JabberMenuRevokeAuth( WPARAM wParam, LPARAM lParam )
+static INT_PTR JabberMenuRevokeAuth(WPARAM wParam, LPARAM lParam)
{
- CJabberProto* ppro = JabberGetInstanceByHContact(( HANDLE )wParam );
- return( ppro ) ? ppro->OnMenuRevokeAuth( wParam, lParam ) : 0;
+ CJabberProto* ppro = JabberGetInstanceByHContact((HANDLE)wParam);
+ return(ppro) ? ppro->OnMenuRevokeAuth(wParam, lParam) : 0;
}
-static INT_PTR JabberMenuConvertChatContact( WPARAM wParam, LPARAM lParam )
+static INT_PTR JabberMenuConvertChatContact(WPARAM wParam, LPARAM lParam)
{
- CJabberProto* ppro = JabberGetInstanceByHContact(( HANDLE )wParam );
- return( ppro ) ? ppro->OnMenuConvertChatContact( wParam, lParam ) : 0;
+ CJabberProto* ppro = JabberGetInstanceByHContact((HANDLE)wParam);
+ return(ppro) ? ppro->OnMenuConvertChatContact(wParam, lParam) : 0;
}
-static INT_PTR JabberMenuRosterAdd( WPARAM wParam, LPARAM lParam )
+static INT_PTR JabberMenuRosterAdd(WPARAM wParam, LPARAM lParam)
{
- CJabberProto* ppro = JabberGetInstanceByHContact(( HANDLE )wParam );
- return( ppro ) ? ppro->OnMenuRosterAdd( wParam, lParam ) : 0;
+ CJabberProto* ppro = JabberGetInstanceByHContact((HANDLE)wParam);
+ return(ppro) ? ppro->OnMenuRosterAdd(wParam, lParam) : 0;
}
-static INT_PTR JabberMenuBookmarkAdd( WPARAM wParam, LPARAM lParam )
+static INT_PTR JabberMenuBookmarkAdd(WPARAM wParam, LPARAM lParam)
{
- CJabberProto* ppro = JabberGetInstanceByHContact(( HANDLE )wParam );
- return( ppro ) ? ppro->OnMenuBookmarkAdd( wParam, lParam ) : 0;
+ CJabberProto* ppro = JabberGetInstanceByHContact((HANDLE)wParam);
+ return(ppro) ? ppro->OnMenuBookmarkAdd(wParam, lParam) : 0;
}
-static INT_PTR JabberMenuTransportLogin( WPARAM wParam, LPARAM lParam )
+static INT_PTR JabberMenuTransportLogin(WPARAM wParam, LPARAM lParam)
{
- CJabberProto* ppro = JabberGetInstanceByHContact(( HANDLE )wParam );
- return( ppro ) ? ppro->OnMenuTransportLogin( wParam, lParam ) : 0;
+ CJabberProto* ppro = JabberGetInstanceByHContact((HANDLE)wParam);
+ return(ppro) ? ppro->OnMenuTransportLogin(wParam, lParam) : 0;
}
-static INT_PTR JabberMenuTransportResolve( WPARAM wParam, LPARAM lParam )
+static INT_PTR JabberMenuTransportResolve(WPARAM wParam, LPARAM lParam)
{
- CJabberProto* ppro = JabberGetInstanceByHContact(( HANDLE )wParam );
- return( ppro ) ? ppro->OnMenuTransportResolve( wParam, lParam ) : 0;
+ CJabberProto* ppro = JabberGetInstanceByHContact((HANDLE)wParam);
+ return(ppro) ? ppro->OnMenuTransportResolve(wParam, lParam) : 0;
}
-static INT_PTR JabberContactMenuRunCommands( WPARAM wParam, LPARAM lParam )
+static INT_PTR JabberContactMenuRunCommands(WPARAM wParam, LPARAM lParam)
{
- CJabberProto* ppro = JabberGetInstanceByHContact(( HANDLE )wParam );
- return( ppro ) ? ppro->ContactMenuRunCommands( wParam, lParam ) : 0;
+ CJabberProto* ppro = JabberGetInstanceByHContact((HANDLE)wParam);
+ return(ppro) ? ppro->ContactMenuRunCommands(wParam, lParam) : 0;
}
-static INT_PTR JabberMenuSendNote( WPARAM wParam, LPARAM lParam )
+static INT_PTR JabberMenuSendNote(WPARAM wParam, LPARAM lParam)
{
- CJabberProto* ppro = JabberGetInstanceByHContact(( HANDLE )wParam );
- return( ppro ) ? ppro->OnMenuSendNote( wParam, lParam ) : 0;
+ CJabberProto* ppro = JabberGetInstanceByHContact((HANDLE)wParam);
+ return(ppro) ? ppro->OnMenuSendNote(wParam, lParam) : 0;
}
-static INT_PTR JabberMenuHandleResource( WPARAM wParam, LPARAM lParam, LPARAM lRes )
+static INT_PTR JabberMenuHandleResource(WPARAM wParam, LPARAM lParam, LPARAM lRes)
{
- CJabberProto* ppro = JabberGetInstanceByHContact(( HANDLE )wParam );
- return( ppro ) ? ppro->OnMenuHandleResource( wParam, lParam, lRes ) : 0;
+ CJabberProto* ppro = JabberGetInstanceByHContact((HANDLE)wParam);
+ return(ppro) ? ppro->OnMenuHandleResource(wParam, lParam, lRes) : 0;
}
-static INT_PTR JabberMenuHandleDirectPresence( WPARAM wParam, LPARAM lParam, LPARAM lRes )
+static INT_PTR JabberMenuHandleDirectPresence(WPARAM wParam, LPARAM lParam, LPARAM lRes)
{
- CJabberProto* ppro = JabberGetInstanceByHContact(( HANDLE )wParam );
- return( ppro ) ? ppro->OnMenuHandleDirectPresence( wParam, lParam, lRes ) : 0;
+ CJabberProto* ppro = JabberGetInstanceByHContact((HANDLE)wParam);
+ return(ppro) ? ppro->OnMenuHandleDirectPresence(wParam, lParam, lRes) : 0;
}
-static void sttEnableMenuItem( HANDLE hMenuItem, BOOL bEnable )
+static void sttEnableMenuItem(HANDLE hMenuItem, BOOL bEnable)
{
CLISTMENUITEM clmi = {0};
clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_FLAGS;
- if ( !bEnable )
+ if ( !bEnable)
clmi.flags |= CMIF_HIDDEN;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuItem, ( LPARAM )&clmi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&clmi);
}
-static int JabberPrebuildContactMenu( WPARAM wParam, LPARAM lParam )
+static int JabberPrebuildContactMenu(WPARAM wParam, LPARAM lParam)
{
- sttEnableMenuItem( g_hMenuRequestAuth, FALSE );
- sttEnableMenuItem( g_hMenuGrantAuth, FALSE );
- sttEnableMenuItem( g_hMenuRevokeAuth, FALSE );
- sttEnableMenuItem( g_hMenuCommands, FALSE );
- sttEnableMenuItem( g_hMenuSendNote, FALSE );
- sttEnableMenuItem( g_hMenuConvert, FALSE );
- sttEnableMenuItem( g_hMenuRosterAdd, FALSE );
- sttEnableMenuItem( g_hMenuLogin, FALSE );
- sttEnableMenuItem( g_hMenuRefresh, FALSE );
- sttEnableMenuItem( g_hMenuAddBookmark, FALSE );
- sttEnableMenuItem( g_hMenuResourcesRoot, FALSE );
- sttEnableMenuItem( g_hMenuDirectPresence[0], FALSE );
-
- CJabberProto* ppro = JabberGetInstanceByHContact(( HANDLE )wParam );
- return( ppro ) ? ppro->OnPrebuildContactMenu( wParam, lParam ) : 0;
+ sttEnableMenuItem(g_hMenuRequestAuth, FALSE);
+ sttEnableMenuItem(g_hMenuGrantAuth, FALSE);
+ sttEnableMenuItem(g_hMenuRevokeAuth, FALSE);
+ sttEnableMenuItem(g_hMenuCommands, FALSE);
+ sttEnableMenuItem(g_hMenuSendNote, FALSE);
+ sttEnableMenuItem(g_hMenuConvert, FALSE);
+ sttEnableMenuItem(g_hMenuRosterAdd, FALSE);
+ sttEnableMenuItem(g_hMenuLogin, FALSE);
+ sttEnableMenuItem(g_hMenuRefresh, FALSE);
+ sttEnableMenuItem(g_hMenuAddBookmark, FALSE);
+ sttEnableMenuItem(g_hMenuResourcesRoot, FALSE);
+ sttEnableMenuItem(g_hMenuDirectPresence[0], FALSE);
+
+ CJabberProto* ppro = JabberGetInstanceByHContact((HANDLE)wParam);
+ return(ppro) ? ppro->OnPrebuildContactMenu(wParam, lParam) : 0;
}
-void g_MenuInit( void )
+void g_MenuInit(void)
{
arServices.increment = 10;
- hPrebuildMenuHook = HookEvent( ME_CLIST_PREBUILDCONTACTMENU, JabberPrebuildContactMenu );
+ hPrebuildMenuHook = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, JabberPrebuildContactMenu);
- List_InsertPtr( &arServices, CreateServiceFunction( "Jabber/MenuChoose", JabberMenuChooseService ));
+ List_InsertPtr(&arServices, CreateServiceFunction("Jabber/MenuChoose", JabberMenuChooseService));
TMenuParam mnu = {0};
mnu.cbSize = sizeof(mnu);
mnu.name = "JabberAccountChooser";
mnu.ExecService = "Jabber/MenuChoose";
- hChooserMenu = (HANDLE)CallService( MO_CREATENEWMENUOBJECT, 0, (LPARAM)&mnu );
+ hChooserMenu = (HANDLE)CallService(MO_CREATENEWMENUOBJECT, 0, (LPARAM)&mnu);
TMO_MenuItem tmi = { 0 };
- tmi.cbSize = sizeof( tmi );
+ tmi.cbSize = sizeof(tmi);
tmi.flags = CMIF_ICONFROMICOLIB;
tmi.pszName = "Cancel";
tmi.position = 9999999;
tmi.hIcolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_DELETE);
- CallService( MO_ADDNEWMENUITEM, (WPARAM)hChooserMenu, ( LPARAM )&tmi );
+ CallService(MO_ADDNEWMENUITEM, (WPARAM)hChooserMenu, (LPARAM)&tmi);
//////////////////////////////////////////////////////////////////////////////////////
// Contact menu initialization
@@ -226,89 +226,89 @@ void g_MenuInit( void ) mi.pszName = LPGEN("Request authorization");
mi.flags = CMIF_ICONFROMICOLIB;
mi.position = -2000001000;
- mi.icolibItem = g_GetIconHandle( IDI_REQUEST );
+ mi.icolibItem = g_GetIconHandle(IDI_REQUEST);
mi.pszService = "Jabber/ReqAuth";
g_hMenuRequestAuth = Menu_AddContactMenuItem(&mi);
- List_InsertPtr( &arServices, CreateServiceFunction( mi.pszService, JabberMenuHandleRequestAuth ));
+ List_InsertPtr(&arServices, CreateServiceFunction(mi.pszService, JabberMenuHandleRequestAuth));
// "Grant authorization"
mi.pszService = "Jabber/GrantAuth";
mi.pszName = LPGEN("Grant authorization");
mi.position = -2000001001;
- mi.icolibItem = g_GetIconHandle( IDI_GRANT );
+ mi.icolibItem = g_GetIconHandle(IDI_GRANT);
g_hMenuGrantAuth = Menu_AddContactMenuItem(&mi);
- List_InsertPtr( &arServices, CreateServiceFunction( mi.pszService, JabberMenuHandleGrantAuth ));
+ List_InsertPtr(&arServices, CreateServiceFunction(mi.pszService, JabberMenuHandleGrantAuth));
// Revoke auth
mi.pszService = "Jabber/RevokeAuth";
mi.pszName = LPGEN("Revoke authorization");
mi.position = -2000001002;
- mi.icolibItem = g_GetIconHandle( IDI_AUTHREVOKE );
+ mi.icolibItem = g_GetIconHandle(IDI_AUTHREVOKE);
g_hMenuRevokeAuth = Menu_AddContactMenuItem(&mi);
- List_InsertPtr( &arServices, CreateServiceFunction( mi.pszService, JabberMenuRevokeAuth ));
+ List_InsertPtr(&arServices, CreateServiceFunction(mi.pszService, JabberMenuRevokeAuth));
// "Convert Chat/Contact"
mi.pszService = "Jabber/ConvertChatContact";
mi.pszName = LPGEN("Convert");
mi.position = -1999901004;
- mi.icolibItem = g_GetIconHandle( IDI_USER2ROOM );
+ mi.icolibItem = g_GetIconHandle(IDI_USER2ROOM);
g_hMenuConvert = Menu_AddContactMenuItem(&mi);
- List_InsertPtr( &arServices, CreateServiceFunction( mi.pszService, JabberMenuConvertChatContact ));
+ List_InsertPtr(&arServices, CreateServiceFunction(mi.pszService, JabberMenuConvertChatContact));
// "Add to roster"
mi.pszService = "Jabber/AddToRoster";
mi.pszName = LPGEN("Add to roster");
mi.position = -1999901005;
- mi.icolibItem = g_GetIconHandle( IDI_ADDROSTER );
+ mi.icolibItem = g_GetIconHandle(IDI_ADDROSTER);
g_hMenuRosterAdd = Menu_AddContactMenuItem(&mi);
- List_InsertPtr( &arServices, CreateServiceFunction( mi.pszService, JabberMenuRosterAdd ));
+ List_InsertPtr(&arServices, CreateServiceFunction(mi.pszService, JabberMenuRosterAdd));
// "Add to Bookmarks"
mi.pszService = "Jabber/AddToBookmarks";
mi.pszName = LPGEN("Add to Bookmarks");
mi.position = -1999901006;
- mi.icolibItem = g_GetIconHandle( IDI_BOOKMARKS);
+ mi.icolibItem = g_GetIconHandle(IDI_BOOKMARKS);
g_hMenuAddBookmark = Menu_AddContactMenuItem(&mi);
- List_InsertPtr( &arServices, CreateServiceFunction( mi.pszService, JabberMenuBookmarkAdd ));
+ List_InsertPtr(&arServices, CreateServiceFunction(mi.pszService, JabberMenuBookmarkAdd));
// Login/logout
mi.pszService = "Jabber/TransportLogin";
mi.pszName = LPGEN("Login/logout");
mi.position = -1999901007;
- mi.icolibItem = g_GetIconHandle( IDI_LOGIN );
+ mi.icolibItem = g_GetIconHandle(IDI_LOGIN);
g_hMenuLogin = Menu_AddContactMenuItem(&mi);
- List_InsertPtr( &arServices, CreateServiceFunction( mi.pszService, JabberMenuTransportLogin ));
+ List_InsertPtr(&arServices, CreateServiceFunction(mi.pszService, JabberMenuTransportLogin));
// Retrieve nicks
mi.pszService = "Jabber/TransportGetNicks";
mi.pszName = LPGEN("Resolve nicks");
mi.position = -1999901008;
- mi.icolibItem = g_GetIconHandle( IDI_REFRESH );
+ mi.icolibItem = g_GetIconHandle(IDI_REFRESH);
g_hMenuRefresh = Menu_AddContactMenuItem(&mi);
- List_InsertPtr( &arServices, CreateServiceFunction( mi.pszService, JabberMenuTransportResolve ));
+ List_InsertPtr(&arServices, CreateServiceFunction(mi.pszService, JabberMenuTransportResolve));
// Run Commands
mi.pszService = "Jabber/RunCommands";
mi.pszName = LPGEN("Commands");
mi.position = -1999901009;
- mi.icolibItem = g_GetIconHandle( IDI_COMMAND );
+ mi.icolibItem = g_GetIconHandle(IDI_COMMAND);
g_hMenuCommands = Menu_AddContactMenuItem(&mi);
- List_InsertPtr( &arServices, CreateServiceFunction( mi.pszService, JabberContactMenuRunCommands ));
+ List_InsertPtr(&arServices, CreateServiceFunction(mi.pszService, JabberContactMenuRunCommands));
// Send Note
mi.pszService = "Jabber/SendNote";
mi.pszName = LPGEN("Send Note");
mi.position = -1999901010;
- mi.icolibItem = g_GetIconHandle( IDI_SEND_NOTE);
+ mi.icolibItem = g_GetIconHandle(IDI_SEND_NOTE);
g_hMenuSendNote = Menu_AddContactMenuItem(&mi);
- List_InsertPtr( &arServices, CreateServiceFunction( mi.pszService, JabberMenuSendNote ));
+ List_InsertPtr(&arServices, CreateServiceFunction(mi.pszService, JabberMenuSendNote));
// Direct Presence
mi.pszService = "Jabber/DirectPresenceDummySvc";
mi.pszName = LPGEN("Send Presence");
mi.position = -1999901011;
mi.pszPopupName = (char *)-1;
- mi.icolibItem = g_GetIconHandle( IDI_NOTES );
+ mi.icolibItem = g_GetIconHandle(IDI_NOTES);
g_hMenuDirectPresence[0] = Menu_AddContactMenuItem(&mi);
mi.flags |= CMIF_ROOTHANDLE;
@@ -324,7 +324,7 @@ void g_MenuInit( void ) mi.hParentMenu = g_hMenuDirectPresence[0];
mi.icolibItem = LoadSkinnedIcon(PresenceModeArray[i].icon);
g_hMenuDirectPresence[i+1] = Menu_AddContactMenuItem(&mi);
- List_InsertPtr( &arServices, CreateServiceFunctionParam( mi.pszService, JabberMenuHandleDirectPresence, PresenceModeArray[i].mode ));
+ List_InsertPtr(&arServices, CreateServiceFunctionParam(mi.pszService, JabberMenuHandleDirectPresence, PresenceModeArray[i].mode));
}
mi.flags &= ~CMIF_ROOTHANDLE;
@@ -335,153 +335,153 @@ void g_MenuInit( void ) mi.pszName = LPGEN("Jabber Resource");
mi.position = -1999901011;
mi.pszPopupName = (char *)-1;
- mi.icolibItem = g_GetIconHandle( IDI_JABBER );
+ mi.icolibItem = g_GetIconHandle(IDI_JABBER);
g_hMenuResourcesRoot = Menu_AddContactMenuItem(&mi);
mi.pszService = "Jabber/UseResource_last";
mi.pszName = LPGEN("Last Active");
mi.position = -1999901000;
mi.hParentMenu = g_hMenuResourcesRoot;
- mi.icolibItem = g_GetIconHandle( IDI_JABBER );
+ mi.icolibItem = g_GetIconHandle(IDI_JABBER);
mi.flags |= CMIF_ROOTHANDLE;
g_hMenuResourcesActive = Menu_AddContactMenuItem(&mi);
- List_InsertPtr( &arServices, CreateServiceFunctionParam( mi.pszService, JabberMenuHandleResource, MENUITEM_LASTSEEN ));
+ List_InsertPtr(&arServices, CreateServiceFunctionParam(mi.pszService, JabberMenuHandleResource, MENUITEM_LASTSEEN));
mi.pszService = "Jabber/UseResource_server";
mi.pszName = LPGEN("Server's Choice");
mi.position = -1999901000;
mi.pszPopupName = (char *)g_hMenuResourcesRoot;
- mi.icolibItem = g_GetIconHandle( IDI_NODE_SERVER );
+ mi.icolibItem = g_GetIconHandle(IDI_NODE_SERVER);
g_hMenuResourcesServer = Menu_AddContactMenuItem(&mi);
- List_InsertPtr( &arServices, CreateServiceFunctionParam( mi.pszService, JabberMenuHandleResource, MENUITEM_SERVER ));
+ List_InsertPtr(&arServices, CreateServiceFunctionParam(mi.pszService, JabberMenuHandleResource, MENUITEM_SERVER));
}
-void g_MenuUninit( void )
+void g_MenuUninit(void)
{
- CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuRequestAuth, 0 );
- CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuGrantAuth, 0 );
- CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuRevokeAuth, 0 );
- CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuConvert, 0 );
- CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuRosterAdd, 0 );
- CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuLogin, 0 );
- CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuRefresh, 0 );
- CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuAddBookmark, 0 );
-
- UnhookEvent( hPrebuildMenuHook );
+ CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hMenuRequestAuth, 0);
+ CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hMenuGrantAuth, 0);
+ CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hMenuRevokeAuth, 0);
+ CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hMenuConvert, 0);
+ CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hMenuRosterAdd, 0);
+ CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hMenuLogin, 0);
+ CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hMenuRefresh, 0);
+ CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hMenuAddBookmark, 0);
+
+ UnhookEvent(hPrebuildMenuHook);
for (int i = 0; i < arServices.realCount; i++)
- DestroyServiceFunction( arServices.items[i] );
- List_Destroy( &arServices );
+ DestroyServiceFunction(arServices.items[i]);
+ List_Destroy(&arServices);
}
/////////////////////////////////////////////////////////////////////////////////////////
// contact menu services
-int CJabberProto::OnPrebuildContactMenu( WPARAM wParam, LPARAM )
+int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
{
HANDLE hContact;
- if (( hContact=( HANDLE )wParam ) == NULL )
+ if ((hContact=(HANDLE)wParam) == NULL)
return 0;
- BYTE bIsChatRoom = (BYTE)JGetByte( hContact, "ChatRoom", 0 );
- BYTE bIsTransport = (BYTE)JGetByte( hContact, "IsTransport", 0 );
+ BYTE bIsChatRoom = (BYTE)JGetByte(hContact, "ChatRoom", 0);
+ BYTE bIsTransport = (BYTE)JGetByte(hContact, "IsTransport", 0);
- if ((bIsChatRoom == GCW_CHATROOM) || bIsChatRoom == 0 ) {
+ if ((bIsChatRoom == GCW_CHATROOM) || bIsChatRoom == 0) {
DBVARIANT dbv;
- if ( !JGetStringT( hContact, bIsChatRoom?(char*)"ChatRoomID":(char*)"jid", &dbv )) {
- JFreeVariant( &dbv );
+ if ( !JGetStringT(hContact, bIsChatRoom?(char*)"ChatRoomID":(char*)"jid", &dbv)) {
+ db_free(&dbv);
CLISTMENUITEM clmi = { 0 };
- sttEnableMenuItem( g_hMenuConvert, TRUE );
- clmi.cbSize = sizeof( clmi );
+ sttEnableMenuItem(g_hMenuConvert, TRUE);
+ clmi.cbSize = sizeof(clmi);
clmi.pszName = bIsChatRoom ? (char *)LPGEN("&Convert to Contact") : (char *)LPGEN("&Convert to Chat Room");
clmi.flags = CMIM_NAME | CMIM_FLAGS;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )g_hMenuConvert, ( LPARAM )&clmi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuConvert, (LPARAM)&clmi);
} }
- if (!m_bJabberOnline)
+ if ( !m_bJabberOnline)
return 0;
- sttEnableMenuItem( g_hMenuDirectPresence[0], TRUE );
+ sttEnableMenuItem(g_hMenuDirectPresence[0], TRUE);
for (int i = 0; i < SIZEOF(PresenceModeArray); ++i)
{
CLISTMENUITEM clmi = {0};
clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_ICON|CMIM_FLAGS;
clmi.hIcon = (HICON)LoadSkinnedProtoIcon(m_szModuleName, PresenceModeArray[i].mode);
- CallService(MS_CLIST_MODIFYMENUITEM, ( WPARAM )g_hMenuDirectPresence[i+1], ( LPARAM )&clmi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuDirectPresence[i+1], (LPARAM)&clmi);
}
- if ( bIsChatRoom ) {
+ if (bIsChatRoom) {
DBVARIANT dbv;
- if ( !JGetStringT( hContact, "ChatRoomID", &dbv )) {
- sttEnableMenuItem( g_hMenuRosterAdd, FALSE );
+ if ( !JGetStringT(hContact, "ChatRoomID", &dbv)) {
+ sttEnableMenuItem(g_hMenuRosterAdd, FALSE);
- if ( ListGetItemPtr( LIST_BOOKMARK, dbv.ptszVal ) == NULL )
- if ( m_ThreadInfo && m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE )
- sttEnableMenuItem( g_hMenuAddBookmark, TRUE );
+ if (ListGetItemPtr(LIST_BOOKMARK, dbv.ptszVal) == NULL)
+ if (m_ThreadInfo && m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE)
+ sttEnableMenuItem(g_hMenuAddBookmark, TRUE);
- JFreeVariant( &dbv );
+ db_free(&dbv);
} }
- if ( bIsChatRoom == GCW_CHATROOM )
+ if (bIsChatRoom == GCW_CHATROOM)
return 0;
- if ( bIsTransport ) {
- sttEnableMenuItem( g_hMenuLogin, TRUE );
- sttEnableMenuItem( g_hMenuRefresh, TRUE );
+ if (bIsTransport) {
+ sttEnableMenuItem(g_hMenuLogin, TRUE);
+ sttEnableMenuItem(g_hMenuRefresh, TRUE);
}
DBVARIANT dbv;
- if ( !JGetStringT( hContact, "jid", &dbv )) {
- JabberCapsBits jcb = GetTotalJidCapabilites(dbv.ptszVal );
- JABBER_LIST_ITEM* item = ListGetItemPtr( LIST_ROSTER, dbv.ptszVal );
- JFreeVariant( &dbv );
- if ( item != NULL ) {
- BOOL bCtrlPressed = ( GetKeyState( VK_CONTROL)&0x8000 ) != 0;
- sttEnableMenuItem( g_hMenuRequestAuth, item->subscription == SUB_FROM || item->subscription == SUB_NONE || bCtrlPressed );
- sttEnableMenuItem( g_hMenuGrantAuth, bCtrlPressed );
- sttEnableMenuItem( g_hMenuRevokeAuth, item->subscription == SUB_FROM || item->subscription == SUB_BOTH || bCtrlPressed );
- sttEnableMenuItem( g_hMenuCommands, (( jcb & JABBER_CAPS_COMMANDS ) != 0) || bCtrlPressed);
- sttEnableMenuItem( g_hMenuSendNote, TRUE );
-
- if ( item->resourceCount >= 1 ) {
- sttEnableMenuItem( g_hMenuResourcesRoot, TRUE );
+ if ( !JGetStringT(hContact, "jid", &dbv)) {
+ JabberCapsBits jcb = GetTotalJidCapabilites(dbv.ptszVal);
+ JABBER_LIST_ITEM* item = ListGetItemPtr(LIST_ROSTER, dbv.ptszVal);
+ db_free(&dbv);
+ if (item != NULL) {
+ BOOL bCtrlPressed = (GetKeyState(VK_CONTROL)&0x8000) != 0;
+ sttEnableMenuItem(g_hMenuRequestAuth, item->subscription == SUB_FROM || item->subscription == SUB_NONE || bCtrlPressed);
+ sttEnableMenuItem(g_hMenuGrantAuth, bCtrlPressed);
+ sttEnableMenuItem(g_hMenuRevokeAuth, item->subscription == SUB_FROM || item->subscription == SUB_BOTH || bCtrlPressed);
+ sttEnableMenuItem(g_hMenuCommands, ((jcb & JABBER_CAPS_COMMANDS) != 0) || bCtrlPressed);
+ sttEnableMenuItem(g_hMenuSendNote, TRUE);
+
+ if (item->resourceCount >= 1) {
+ sttEnableMenuItem(g_hMenuResourcesRoot, TRUE);
CLISTMENUITEM mi = {0};
mi.cbSize = sizeof(CLISTMENUITEM);
mi.flags = CMIM_ICON|CMIM_FLAGS;
- mi.icolibItem = GetIconHandle( IDI_JABBER );
- CallService(MS_CLIST_MODIFYMENUITEM, ( WPARAM )g_hMenuResourcesRoot, ( LPARAM )&mi );
- CallService(MS_CLIST_MODIFYMENUITEM, ( WPARAM )g_hMenuResourcesActive, ( LPARAM )&mi );
+ mi.icolibItem = GetIconHandle(IDI_JABBER);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuResourcesRoot, (LPARAM)&mi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuResourcesActive, (LPARAM)&mi);
int nMenuResourceItemsNew = m_nMenuResourceItems;
- if ( m_nMenuResourceItems < item->resourceCount ) {
- m_phMenuResourceItems = (HANDLE *)mir_realloc( m_phMenuResourceItems, item->resourceCount * sizeof(HANDLE));
+ if (m_nMenuResourceItems < item->resourceCount) {
+ m_phMenuResourceItems = (HANDLE *)mir_realloc(m_phMenuResourceItems, item->resourceCount * sizeof(HANDLE));
nMenuResourceItemsNew = item->resourceCount;
}
char text[ 256 ];
- strcpy( text, m_szModuleName );
- size_t nModuleNameLength = strlen( text );
+ strcpy(text, m_szModuleName);
+ size_t nModuleNameLength = strlen(text);
char* tDest = text + nModuleNameLength;
mi.cbSize = sizeof(CLISTMENUITEM);
mi.flags = CMIF_CHILDPOPUP;
mi.position = 0;
- mi.icolibItem = GetIconHandle( IDI_REQUEST );
+ mi.icolibItem = GetIconHandle(IDI_REQUEST);
mi.pszService = text;
mi.pszContactOwner = m_szModuleName;
TCHAR szTmp[512];
for (int i = 0; i < nMenuResourceItemsNew; ++i) {
- mir_snprintf( tDest, SIZEOF(text) - nModuleNameLength, "/UseResource_%d", i );
- if ( i >= m_nMenuResourceItems ) {
- JCreateServiceParam( tDest, &CJabberProto::OnMenuHandleResource, MENUITEM_RESOURCES+i );
+ mir_snprintf(tDest, SIZEOF(text) - nModuleNameLength, "/UseResource_%d", i);
+ if (i >= m_nMenuResourceItems) {
+ JCreateServiceParam(tDest, &CJabberProto::OnMenuHandleResource, MENUITEM_RESOURCES+i);
mi.pszName = "";
mi.position = i;
mi.pszPopupName = (char *)g_hMenuResourcesRoot;
m_phMenuResourceItems[i] = Menu_AddContactMenuItem(&mi);
}
- if ( i < item->resourceCount ) {
+ if (i < item->resourceCount) {
CLISTMENUITEM clmi = {0};
clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_NAME|CMIM_FLAGS | CMIF_CHILDPOPUP|CMIF_TCHAR;
@@ -490,17 +490,17 @@ int CJabberProto::OnPrebuildContactMenu( WPARAM wParam, LPARAM ) if (ServiceExists(MS_FP_GETCLIENTICONT)) {
clmi.flags |= CMIM_ICON;
FormatMirVer(&item->resource[i], szTmp, SIZEOF(szTmp));
- clmi.hIcon = (HICON)CallService( MS_FP_GETCLIENTICONT, (WPARAM)szTmp, 0 );
+ clmi.hIcon = (HICON)CallService(MS_FP_GETCLIENTICONT, (WPARAM)szTmp, 0);
}
mir_sntprintf(szTmp, SIZEOF(szTmp), _T("%s [%s, %d]"),
item->resource[i].resourceName,
(TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, item->resource[i].status, GSMDF_TCHAR),
item->resource[i].priority);
clmi.ptszName = szTmp;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_phMenuResourceItems[i], ( LPARAM )&clmi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_phMenuResourceItems[i], (LPARAM)&clmi);
DestroyIcon(clmi.hIcon);
}
- else sttEnableMenuItem( m_phMenuResourceItems[i], FALSE );
+ else sttEnableMenuItem(m_phMenuResourceItems[i], FALSE);
}
ZeroMemory(&mi, sizeof(mi));
@@ -508,11 +508,11 @@ int CJabberProto::OnPrebuildContactMenu( WPARAM wParam, LPARAM ) mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP|CMIF_ICONFROMICOLIB |
((item->resourceMode == RSMODE_LASTSEEN) ? CMIF_CHECKED : 0);
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )g_hMenuResourcesActive, ( LPARAM )&mi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuResourcesActive, (LPARAM)&mi);
mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP|CMIF_ICONFROMICOLIB |
((item->resourceMode == RSMODE_SERVER) ? CMIF_CHECKED : 0);
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )g_hMenuResourcesServer, ( LPARAM )&mi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuResourcesServer, (LPARAM)&mi);
m_nMenuResourceItems = nMenuResourceItemsNew;
}
@@ -523,54 +523,54 @@ int CJabberProto::OnPrebuildContactMenu( WPARAM wParam, LPARAM ) return 0;
}
-INT_PTR __cdecl CJabberProto::OnMenuConvertChatContact( WPARAM wParam, LPARAM )
+INT_PTR __cdecl CJabberProto::OnMenuConvertChatContact(WPARAM wParam, LPARAM)
{
- BYTE bIsChatRoom = (BYTE)JGetByte( (HANDLE ) wParam, "ChatRoom", 0 );
- if ((bIsChatRoom == GCW_CHATROOM) || bIsChatRoom == 0 ) {
+ BYTE bIsChatRoom = (BYTE)JGetByte((HANDLE) wParam, "ChatRoom", 0);
+ if ((bIsChatRoom == GCW_CHATROOM) || bIsChatRoom == 0) {
DBVARIANT dbv;
- if ( !JGetStringT( (HANDLE ) wParam, (bIsChatRoom == GCW_CHATROOM)?(char*)"ChatRoomID":(char*)"jid", &dbv )) {
- JDeleteSetting( (HANDLE ) wParam, (bIsChatRoom == GCW_CHATROOM)?"ChatRoomID":"jid");
- JSetStringT( (HANDLE ) wParam, (bIsChatRoom != GCW_CHATROOM)?"ChatRoomID":"jid", dbv.ptszVal);
- JFreeVariant( &dbv );
- JSetByte((HANDLE ) wParam, "ChatRoom", (bIsChatRoom == GCW_CHATROOM)?0:GCW_CHATROOM);
+ if ( !JGetStringT((HANDLE) wParam, (bIsChatRoom == GCW_CHATROOM)?(char*)"ChatRoomID":(char*)"jid", &dbv)) {
+ JDeleteSetting((HANDLE) wParam, (bIsChatRoom == GCW_CHATROOM)?"ChatRoomID":"jid");
+ JSetStringT((HANDLE) wParam, (bIsChatRoom != GCW_CHATROOM)?"ChatRoomID":"jid", dbv.ptszVal);
+ db_free(&dbv);
+ JSetByte((HANDLE) wParam, "ChatRoom", (bIsChatRoom == GCW_CHATROOM)?0:GCW_CHATROOM);
} }
return 0;
}
-INT_PTR __cdecl CJabberProto::OnMenuRosterAdd( WPARAM wParam, LPARAM )
+INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM wParam, LPARAM)
{
DBVARIANT dbv;
- if ( !wParam ) return 0; // we do not add ourself to the roster. (buggy situation - should not happen)
- if ( !JGetStringT( ( HANDLE ) wParam, "ChatRoomID", &dbv )) {
+ if ( !wParam) return 0; // we do not add ourself to the roster. (buggy situation - should not happen)
+ if ( !JGetStringT((HANDLE)wParam, "ChatRoomID", &dbv)) {
TCHAR *roomID = mir_tstrdup(dbv.ptszVal);
- JFreeVariant( &dbv );
- if ( ListGetItemPtr( LIST_ROSTER, roomID ) == NULL ) {
+ db_free(&dbv);
+ if (ListGetItemPtr(LIST_ROSTER, roomID) == NULL) {
TCHAR *nick = 0;
TCHAR *group = 0;
- if ( !DBGetContactSettingTString( ( HANDLE ) wParam, "CList", "Group", &dbv )) {
+ if ( !DBGetContactSettingTString((HANDLE)wParam, "CList", "Group", &dbv)) {
group = mir_tstrdup(dbv.ptszVal);
- JFreeVariant( &dbv );
+ db_free(&dbv);
}
- if ( !JGetStringT( ( HANDLE ) wParam, "Nick", &dbv )) {
+ if ( !JGetStringT((HANDLE)wParam, "Nick", &dbv)) {
nick = mir_tstrdup(dbv.ptszVal);
- JFreeVariant( &dbv );
+ db_free(&dbv);
}
- AddContactToRoster( roomID, nick, group );
- if ( m_options.AddRoster2Bookmarks == TRUE ) {
+ AddContactToRoster(roomID, nick, group);
+ if (m_options.AddRoster2Bookmarks == TRUE) {
JABBER_LIST_ITEM* item = NULL;
item = ListGetItemPtr(LIST_BOOKMARK, roomID);
- if (!item) {
- item = ( JABBER_LIST_ITEM* )mir_alloc( sizeof( JABBER_LIST_ITEM ));
- ZeroMemory( item, sizeof( JABBER_LIST_ITEM ));
+ if ( !item) {
+ item = (JABBER_LIST_ITEM*)mir_alloc(sizeof(JABBER_LIST_ITEM));
+ ZeroMemory(item, sizeof(JABBER_LIST_ITEM));
item->jid = mir_tstrdup(roomID);
item->name = mir_tstrdup(nick);
- if ( !JGetStringT( ( HANDLE ) wParam, "MyNick", &dbv )) {
+ if ( !JGetStringT((HANDLE)wParam, "MyNick", &dbv)) {
item->nick = mir_tstrdup(dbv.ptszVal);
- JFreeVariant( &dbv );
+ db_free(&dbv);
}
- AddEditBookmark( item );
+ AddEditBookmark(item);
mir_free(item);
}
}
@@ -582,109 +582,109 @@ INT_PTR __cdecl CJabberProto::OnMenuRosterAdd( WPARAM wParam, LPARAM ) return 0;
}
-INT_PTR __cdecl CJabberProto::OnMenuHandleRequestAuth( WPARAM wParam, LPARAM )
+INT_PTR __cdecl CJabberProto::OnMenuHandleRequestAuth(WPARAM wParam, LPARAM)
{
HANDLE hContact;
DBVARIANT dbv;
- if (( hContact=( HANDLE ) wParam )!=NULL && m_bJabberOnline ) {
- if ( !JGetStringT( hContact, "jid", &dbv )) {
- m_ThreadInfo->send( XmlNode( _T("presence")) << XATTR( _T("to"), dbv.ptszVal ) << XATTR( _T("type"), _T("subscribe")));
- JFreeVariant( &dbv );
+ if ((hContact=(HANDLE)wParam)!=NULL && m_bJabberOnline) {
+ if ( !JGetStringT(hContact, "jid", &dbv)) {
+ m_ThreadInfo->send(XmlNode(_T("presence")) << XATTR(_T("to"), dbv.ptszVal) << XATTR(_T("type"), _T("subscribe")));
+ db_free(&dbv);
} }
return 0;
}
-INT_PTR __cdecl CJabberProto::OnMenuHandleGrantAuth( WPARAM wParam, LPARAM )
+INT_PTR __cdecl CJabberProto::OnMenuHandleGrantAuth(WPARAM wParam, LPARAM)
{
HANDLE hContact;
DBVARIANT dbv;
- if (( hContact=( HANDLE ) wParam )!=NULL && m_bJabberOnline ) {
- if ( !JGetStringT( hContact, "jid", &dbv )) {
- m_ThreadInfo->send( XmlNode( _T("presence")) << XATTR( _T("to"), dbv.ptszVal ) << XATTR( _T("type"), _T("subscribed")));
- JFreeVariant( &dbv );
+ if ((hContact=(HANDLE)wParam)!=NULL && m_bJabberOnline) {
+ if ( !JGetStringT(hContact, "jid", &dbv)) {
+ m_ThreadInfo->send(XmlNode(_T("presence")) << XATTR(_T("to"), dbv.ptszVal) << XATTR(_T("type"), _T("subscribed")));
+ db_free(&dbv);
} }
return 0;
}
-INT_PTR __cdecl CJabberProto::OnMenuRevokeAuth( WPARAM wParam, LPARAM )
+INT_PTR __cdecl CJabberProto::OnMenuRevokeAuth(WPARAM wParam, LPARAM)
{
HANDLE hContact;
DBVARIANT dbv;
- if (( hContact=( HANDLE ) wParam ) != NULL && m_bJabberOnline ) {
- if ( !JGetStringT( hContact, "jid", &dbv )) {
- m_ThreadInfo->send( XmlNode( _T("presence")) << XATTR( _T("to"), dbv.ptszVal ) << XATTR( _T("type"), _T("unsubscribed")));
- JFreeVariant( &dbv );
+ if ((hContact=(HANDLE)wParam) != NULL && m_bJabberOnline) {
+ if ( !JGetStringT(hContact, "jid", &dbv)) {
+ m_ThreadInfo->send(XmlNode(_T("presence")) << XATTR(_T("to"), dbv.ptszVal) << XATTR(_T("type"), _T("unsubscribed")));
+ db_free(&dbv);
} }
return 0;
}
-INT_PTR __cdecl CJabberProto::OnMenuTransportLogin( WPARAM wParam, LPARAM )
+INT_PTR __cdecl CJabberProto::OnMenuTransportLogin(WPARAM wParam, LPARAM)
{
- HANDLE hContact = ( HANDLE )wParam;
- if ( !JGetByte( hContact, "IsTransport", 0 ))
+ HANDLE hContact = (HANDLE)wParam;
+ if ( !JGetByte(hContact, "IsTransport", 0))
return 0;
DBVARIANT jid;
- if ( JGetStringT( hContact, "jid", &jid ))
+ if (JGetStringT(hContact, "jid", &jid))
return 0;
- JABBER_LIST_ITEM* item = ListGetItemPtr( LIST_ROSTER, jid.ptszVal );
- if ( item != NULL ) {
- XmlNode p( _T("presence")); xmlAddAttr( p, _T("to"), item->jid );
- if ( item->itemResource.status == ID_STATUS_ONLINE )
- xmlAddAttr( p, _T("type"), _T("unavailable"));
- m_ThreadInfo->send( p );
+ JABBER_LIST_ITEM* item = ListGetItemPtr(LIST_ROSTER, jid.ptszVal);
+ if (item != NULL) {
+ XmlNode p(_T("presence")); xmlAddAttr(p, _T("to"), item->jid);
+ if (item->itemResource.status == ID_STATUS_ONLINE)
+ xmlAddAttr(p, _T("type"), _T("unavailable"));
+ m_ThreadInfo->send(p);
}
- JFreeVariant( &jid );
+ db_free(&jid);
return 0;
}
-INT_PTR __cdecl CJabberProto::OnMenuTransportResolve( WPARAM wParam, LPARAM )
+INT_PTR __cdecl CJabberProto::OnMenuTransportResolve(WPARAM wParam, LPARAM)
{
- HANDLE hContact = ( HANDLE )wParam;
- if ( !JGetByte( hContact, "IsTransport", 0 ))
+ HANDLE hContact = (HANDLE)wParam;
+ if ( !JGetByte(hContact, "IsTransport", 0))
return 0;
DBVARIANT jid;
- if ( !JGetStringT( hContact, "jid", &jid )) {
- ResolveTransportNicks( jid.ptszVal );
- JFreeVariant( &jid );
+ if ( !JGetStringT(hContact, "jid", &jid)) {
+ ResolveTransportNicks(jid.ptszVal);
+ db_free(&jid);
}
return 0;
}
-INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd( WPARAM wParam, LPARAM )
+INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd(WPARAM wParam, LPARAM)
{
DBVARIANT dbv;
- if ( !wParam ) return 0; // we do not add ourself to the roster. (buggy situation - should not happen)
- if ( !JGetStringT( ( HANDLE ) wParam, "ChatRoomID", &dbv )) {
+ if ( !wParam) return 0; // we do not add ourself to the roster. (buggy situation - should not happen)
+ if ( !JGetStringT((HANDLE)wParam, "ChatRoomID", &dbv)) {
TCHAR *roomID = mir_tstrdup(dbv.ptszVal);
- JFreeVariant( &dbv );
- if ( ListGetItemPtr( LIST_BOOKMARK, roomID ) == NULL ) {
+ db_free(&dbv);
+ if (ListGetItemPtr(LIST_BOOKMARK, roomID) == NULL) {
TCHAR *nick = 0;
- if ( !JGetStringT( ( HANDLE ) wParam, "Nick", &dbv )) {
+ if ( !JGetStringT((HANDLE)wParam, "Nick", &dbv)) {
nick = mir_tstrdup(dbv.ptszVal);
- JFreeVariant( &dbv );
+ db_free(&dbv);
}
JABBER_LIST_ITEM* item = NULL;
- item = ( JABBER_LIST_ITEM* )mir_alloc( sizeof( JABBER_LIST_ITEM ));
- ZeroMemory( item, sizeof( JABBER_LIST_ITEM ));
+ item = (JABBER_LIST_ITEM*)mir_alloc(sizeof(JABBER_LIST_ITEM));
+ ZeroMemory(item, sizeof(JABBER_LIST_ITEM));
item->jid = mir_tstrdup(roomID);
- item->name = ( TCHAR* )CallService( MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR );
+ item->name = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR);
item->type = _T("conference");
- if ( !JGetStringT(( HANDLE ) wParam, "MyNick", &dbv )) {
+ if ( !JGetStringT((HANDLE)wParam, "MyNick", &dbv)) {
item->nick = mir_tstrdup(dbv.ptszVal);
- JFreeVariant( &dbv );
+ db_free(&dbv);
}
- AddEditBookmark( item );
+ AddEditBookmark(item);
mir_free(item);
if (nick) mir_free(nick);
@@ -703,38 +703,38 @@ void CJabberProto::MenuInit() mi.cbSize = sizeof(CLISTMENUITEM);
char text[ 200 ];
- strcpy( text, m_szModuleName );
- char* tDest = text + strlen( text );
+ strcpy(text, m_szModuleName);
+ char* tDest = text + strlen(text);
mi.pszService = text;
- HGENMENU hJabberRoot = MO_GetProtoRootMenu( m_szModuleName );
- if ( hJabberRoot == NULL ) {
+ HGENMENU hJabberRoot = MO_GetProtoRootMenu(m_szModuleName);
+ if (hJabberRoot == NULL) {
mi.ptszName = m_tszUserName;
mi.position = -1999901006;
mi.hParentMenu = HGENMENU_ROOT;
mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTPOPUP | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
- mi.icolibItem = GetIconHandle( IDI_JABBER );
+ mi.icolibItem = GetIconHandle(IDI_JABBER);
hJabberRoot = m_hMenuRoot = Menu_AddProtoMenuItem(&mi);
}
else {
- if ( m_hMenuRoot )
- CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )m_hMenuRoot, 0 );
+ if (m_hMenuRoot)
+ CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)m_hMenuRoot, 0);
m_hMenuRoot = NULL;
}
// "Bookmarks..."
- JCreateService( "/Bookmarks", &CJabberProto::OnMenuHandleBookmarks );
- strcpy( tDest, "/Bookmarks" );
+ JCreateService("/Bookmarks", &CJabberProto::OnMenuHandleBookmarks);
+ strcpy(tDest, "/Bookmarks");
mi.flags = CMIF_ICONFROMICOLIB | CMIF_CHILDPOPUP;
mi.hParentMenu = hJabberRoot;
mi.pszName = LPGEN("Bookmarks");
mi.position = 200001;
- mi.icolibItem = GetIconHandle( IDI_BOOKMARKS );
+ mi.icolibItem = GetIconHandle(IDI_BOOKMARKS);
m_hMenuBookmarks = Menu_AddProtoMenuItem(&mi);
// "Options..."
- JCreateService( "/Options", &CJabberProto::OnMenuOptions );
- strcpy( tDest, "/Options" );
+ JCreateService("/Options", &CJabberProto::OnMenuOptions);
+ strcpy(tDest, "/Options");
mi.pszName = LPGEN("Options...");
mi.position = 200002;
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_OPTIONS);
@@ -742,83 +742,83 @@ void CJabberProto::MenuInit() // "Services..."
mi.pszName = LPGEN("Services...");
- strcpy( tDest, "/Services" );
+ strcpy(tDest, "/Services");
mi.position = 200003;
- mi.icolibItem = GetIconHandle( IDI_SERVICE_DISCOVERY );
+ mi.icolibItem = GetIconHandle(IDI_SERVICE_DISCOVERY);
HGENMENU hMenuServicesRoot = Menu_AddProtoMenuItem(&mi);
// "Service Discovery..."
- JCreateService( "/ServiceDiscovery", &CJabberProto::OnMenuHandleServiceDiscovery );
- strcpy( tDest, "/ServiceDiscovery" );
+ JCreateService("/ServiceDiscovery", &CJabberProto::OnMenuHandleServiceDiscovery);
+ strcpy(tDest, "/ServiceDiscovery");
mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTHANDLE;
mi.pszName = LPGEN("Service Discovery");
mi.position = 2000050001;
- mi.icolibItem = GetIconHandle( IDI_SERVICE_DISCOVERY );
+ mi.icolibItem = GetIconHandle(IDI_SERVICE_DISCOVERY);
mi.hParentMenu = hMenuServicesRoot;
m_hMenuServiceDiscovery = Menu_AddProtoMenuItem(&mi);
- JCreateService( "/SD/MyTransports", &CJabberProto::OnMenuHandleServiceDiscoveryMyTransports );
- strcpy( tDest, "/SD/MyTransports" );
+ JCreateService("/SD/MyTransports", &CJabberProto::OnMenuHandleServiceDiscoveryMyTransports);
+ strcpy(tDest, "/SD/MyTransports");
mi.pszName = LPGEN("Registered Transports");
mi.position = 2000050003;
- mi.icolibItem = GetIconHandle( IDI_TRANSPORTL );
+ mi.icolibItem = GetIconHandle(IDI_TRANSPORTL);
m_hMenuSDMyTransports = Menu_AddProtoMenuItem(&mi);
- JCreateService( "/SD/Transports", &CJabberProto::OnMenuHandleServiceDiscoveryTransports );
- strcpy( tDest, "/SD/Transports" );
+ JCreateService("/SD/Transports", &CJabberProto::OnMenuHandleServiceDiscoveryTransports);
+ strcpy(tDest, "/SD/Transports");
mi.pszName = LPGEN("Local Server Transports");
mi.position = 2000050004;
- mi.icolibItem = GetIconHandle( IDI_TRANSPORT );
+ mi.icolibItem = GetIconHandle(IDI_TRANSPORT);
m_hMenuSDTransports = Menu_AddProtoMenuItem(&mi);
- JCreateService( "/SD/Conferences", &CJabberProto::OnMenuHandleServiceDiscoveryConferences );
- strcpy( tDest, "/SD/Conferences" );
+ JCreateService("/SD/Conferences", &CJabberProto::OnMenuHandleServiceDiscoveryConferences);
+ strcpy(tDest, "/SD/Conferences");
mi.pszName = LPGEN("Browse Chatrooms");
mi.position = 2000050005;
- mi.icolibItem = GetIconHandle( IDI_GROUP );
+ mi.icolibItem = GetIconHandle(IDI_GROUP);
m_hMenuSDConferences = Menu_AddProtoMenuItem(&mi);
- JCreateService( "/Groupchat", &CJabberProto::OnMenuHandleJoinGroupchat );
- strcpy( tDest, "/Groupchat" );
+ JCreateService("/Groupchat", &CJabberProto::OnMenuHandleJoinGroupchat);
+ strcpy(tDest, "/Groupchat");
mi.pszName = LPGEN("Create/Join groupchat");
mi.position = 2000050006;
- mi.icolibItem = GetIconHandle( IDI_GROUP );
+ mi.icolibItem = GetIconHandle(IDI_GROUP);
m_hMenuGroupchat = Menu_AddProtoMenuItem(&mi);
// "Change Password..."
- JCreateService( "/ChangePassword", &CJabberProto::OnMenuHandleChangePassword );
- strcpy( tDest, "/ChangePassword" );
+ JCreateService("/ChangePassword", &CJabberProto::OnMenuHandleChangePassword);
+ strcpy(tDest, "/ChangePassword");
mi.pszName = LPGEN("Change Password");
mi.position = 2000050007;
- mi.icolibItem = GetIconHandle( IDI_KEYS );
+ mi.icolibItem = GetIconHandle(IDI_KEYS);
m_hMenuChangePassword = Menu_AddProtoMenuItem(&mi);
// "Roster editor"
- JCreateService( "/RosterEditor", &CJabberProto::OnMenuHandleRosterControl );
- strcpy( tDest, "/RosterEditor" );
+ JCreateService("/RosterEditor", &CJabberProto::OnMenuHandleRosterControl);
+ strcpy(tDest, "/RosterEditor");
mi.pszName = LPGEN("Roster editor");
mi.position = 2000050009;
- mi.icolibItem = GetIconHandle( IDI_AGENTS );
+ mi.icolibItem = GetIconHandle(IDI_AGENTS);
m_hMenuRosterControl = Menu_AddProtoMenuItem(&mi);
// "XML Console"
- JCreateService( "/XMLConsole", &CJabberProto::OnMenuHandleConsole );
- strcpy( tDest, "/XMLConsole" );
+ JCreateService("/XMLConsole", &CJabberProto::OnMenuHandleConsole);
+ strcpy(tDest, "/XMLConsole");
mi.pszName = LPGEN("XML Console");
mi.position = 2000050010;
- mi.icolibItem = GetIconHandle( IDI_CONSOLE );
+ mi.icolibItem = GetIconHandle(IDI_CONSOLE);
Menu_AddProtoMenuItem(&mi);
- JCreateService( "/Notes", &CJabberProto::OnMenuHandleNotes );
- strcpy( tDest, "/Notes" );
+ JCreateService("/Notes", &CJabberProto::OnMenuHandleNotes);
+ strcpy(tDest, "/Notes");
mi.pszName = LPGEN("Notes");
mi.position = 2000050011;
- mi.icolibItem = GetIconHandle( IDI_NOTES);
+ mi.icolibItem = GetIconHandle(IDI_NOTES);
m_hMenuNotes = Menu_AddProtoMenuItem(&mi);
BuildPrivacyMenu();
- if ( m_menuItemsStatus )
- BuildPrivacyListsMenu( false );
+ if (m_menuItemsStatus)
+ BuildPrivacyListsMenu(false);
//////////////////////////////////////////////////////////////////////////////////////
// build priority menu
@@ -833,7 +833,7 @@ void CJabberProto::MenuInit() mi.flags = CMIF_ROOTPOPUP | CMIF_HIDDEN;
m_hMenuPriorityRoot = Menu_AddProtoMenuItem(&mi);
- char szName[128], srvFce[MAX_PATH + 64], *svcName = srvFce+strlen( m_szModuleName );
+ char szName[128], srvFce[MAX_PATH + 64], *svcName = srvFce+strlen(m_szModuleName);
mi.pszService = srvFce;
mi.pszName = szName;
mi.position = 2000040000;
@@ -842,12 +842,12 @@ void CJabberProto::MenuInit() mir_snprintf(srvFce, sizeof(srvFce), "%s/menuSetPriority/0", m_szModuleName);
bool needServices = !ServiceExists(srvFce);
- if ( needServices )
+ if (needServices)
JCreateServiceParam(svcName, &CJabberProto::OnMenuSetPriority, 0);
int steps[] = { 10, 5, 1, 0, -1, -5, -10 };
for (int i = 0; i < SIZEOF(steps); ++i) {
- if ( !steps[i] ) {
+ if ( !steps[i]) {
mi.position += 100000;
continue;
}
@@ -857,7 +857,7 @@ void CJabberProto::MenuInit() mir_snprintf(srvFce, sizeof(srvFce), "%s/menuSetPriority/%d", m_szModuleName, steps[i]);
mir_snprintf(szName, sizeof(szName), (steps[i] > 0) ? "Increase priority by %d" : "Decrease priority by %d", abs(steps[i]));
- if ( needServices )
+ if (needServices)
JCreateServiceParam(svcName, &CJabberProto::OnMenuSetPriority, (LPARAM)steps[i]);
mi.position++;
@@ -890,7 +890,7 @@ INT_PTR CJabberProto::OnMenuSetPriority(WPARAM, LPARAM, LPARAM dwDelta) void CJabberProto::UpdatePriorityMenu(short priority)
{
- if (!m_hMenuPriorityRoot || m_priorityMenuValSet && (priority == m_priorityMenuVal))
+ if ( !m_hMenuPriorityRoot || m_priorityMenuValSet && (priority == m_priorityMenuVal))
return;
TCHAR szName[128];
@@ -918,14 +918,14 @@ void CJabberProto::GlobalMenuInit() tmi.ownerdata = this;
tmi.position = iChooserMenuPos++;
tmi.ptszName = m_tszUserName;
- m_hChooseMenuItem = (HANDLE)CallService( MO_ADDNEWMENUITEM, (WPARAM)hChooserMenu, ( LPARAM )&tmi );
+ m_hChooseMenuItem = (HANDLE)CallService(MO_ADDNEWMENUITEM, (WPARAM)hChooserMenu, (LPARAM)&tmi);
//////////////////////////////////////////////////////////////////////////////////////
// Hotkeys
char text[ 200 ];
- strcpy( text, m_szModuleName );
- char* tDest = text + strlen( text );
+ strcpy(text, m_szModuleName);
+ char* tDest = text + strlen(text);
HOTKEYDESC hkd = {0};
hkd.cbSize = sizeof(hkd);
@@ -974,26 +974,26 @@ static INT_PTR g_ToolbarHandleServiceDiscovery(WPARAM w, LPARAM l) int g_OnToolbarInit(WPARAM, LPARAM)
{
- if ( g_Instances.getCount() == 0 )
+ if (g_Instances.getCount() == 0)
return 0;
TTBButton button = {0};
button.cbSize = sizeof(button);
button.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE;
- List_InsertPtr( &arServices, CreateServiceFunction("JABBER/*/Groupchat", g_ToolbarHandleJoinGroupchat ));
+ List_InsertPtr(&arServices, CreateServiceFunction("JABBER/*/Groupchat", g_ToolbarHandleJoinGroupchat));
button.pszService = "JABBER/*/Groupchat";
button.pszTooltipUp = button.name = LPGEN("Join conference");
button.hIconHandleUp = g_GetIconHandle(IDI_GROUP);
TopToolbar_AddButton(&button);
- List_InsertPtr( &arServices, CreateServiceFunction("JABBER/*/Bookmarks", g_ToolbarHandleBookmarks ));
+ List_InsertPtr(&arServices, CreateServiceFunction("JABBER/*/Bookmarks", g_ToolbarHandleBookmarks));
button.pszService = "JABBER/*/Bookmarks";
button.pszTooltipUp = button.name = LPGEN("Open bookmarks");
button.hIconHandleUp = g_GetIconHandle(IDI_BOOKMARKS);
TopToolbar_AddButton(&button);
- List_InsertPtr( &arServices, CreateServiceFunction("JABBER/*/ServiceDiscovery", g_ToolbarHandleServiceDiscovery ));
+ List_InsertPtr(&arServices, CreateServiceFunction("JABBER/*/ServiceDiscovery", g_ToolbarHandleServiceDiscovery));
button.pszService = "JABBER/*/ServiceDiscovery";
button.pszTooltipUp = button.name = LPGEN("Service discovery");
button.hIconHandleUp = g_GetIconHandle(IDI_SERVICE_DISCOVERY);
@@ -1003,20 +1003,20 @@ int g_OnToolbarInit(WPARAM, LPARAM) void CJabberProto::GlobalMenuUninit()
{
- if ( m_phMenuResourceItems ) {
- for ( int i=0; i < m_nMenuResourceItems; i++ )
- CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )m_phMenuResourceItems[i], 0 );
+ if (m_phMenuResourceItems) {
+ for (int i=0; i < m_nMenuResourceItems; i++)
+ CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)m_phMenuResourceItems[i], 0);
mir_free(m_phMenuResourceItems);
m_phMenuResourceItems = NULL;
}
m_nMenuResourceItems = 0;
- if ( m_hMenuRoot )
- CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )m_hMenuRoot, 0 );
+ if (m_hMenuRoot)
+ CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)m_hMenuRoot, 0);
m_hMenuRoot = NULL;
}
-void CJabberProto::EnableMenuItems( BOOL bEnable )
+void CJabberProto::EnableMenuItems(BOOL bEnable)
{
m_menuItemsStatus = bEnable;
CheckMenuItems();
@@ -1027,35 +1027,35 @@ void CJabberProto::CheckMenuItems() CLISTMENUITEM clmi = { 0 };
clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_FLAGS;
- if ( !m_menuItemsStatus )
+ if ( !m_menuItemsStatus)
clmi.flags |= CMIF_GRAYED;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuChangePassword, ( LPARAM )&clmi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuGroupchat, ( LPARAM )&clmi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuChangePassword, (LPARAM)&clmi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuGroupchat, (LPARAM)&clmi);
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuPrivacyLists, ( LPARAM )&clmi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuRosterControl, ( LPARAM )&clmi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuServiceDiscovery, ( LPARAM )&clmi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuSDMyTransports, ( LPARAM )&clmi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuSDTransports, ( LPARAM )&clmi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuSDConferences, ( LPARAM )&clmi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuPrivacyLists, (LPARAM)&clmi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuRosterControl, (LPARAM)&clmi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuServiceDiscovery, (LPARAM)&clmi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuSDMyTransports, (LPARAM)&clmi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuSDTransports, (LPARAM)&clmi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuSDConferences, (LPARAM)&clmi);
- clmi.flags = CMIM_FLAGS | (( m_ThreadInfo && ( m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE)) ? 0 : CMIF_HIDDEN );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuBookmarks, ( LPARAM )&clmi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuNotes, ( LPARAM )&clmi );
+ clmi.flags = CMIM_FLAGS | ((m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE)) ? 0 : CMIF_HIDDEN);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuBookmarks, (LPARAM)&clmi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuNotes, (LPARAM)&clmi);
- clmi.flags = CMIM_FLAGS | (( m_ThreadInfo && ( m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVACY_LISTS)) ? 0 : CMIF_HIDDEN );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hPrivacyMenuRoot, ( LPARAM )&clmi );
+ clmi.flags = CMIM_FLAGS | ((m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVACY_LISTS)) ? 0 : CMIF_HIDDEN);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hPrivacyMenuRoot, (LPARAM)&clmi);
- clmi.flags = CMIM_FLAGS | ( m_menuItemsStatus ? 0 : CMIF_HIDDEN);
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuPriorityRoot, ( LPARAM )&clmi );
+ clmi.flags = CMIM_FLAGS | (m_menuItemsStatus ? 0 : CMIF_HIDDEN);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuPriorityRoot, (LPARAM)&clmi);
- if ( !m_bPepSupported )
+ if ( !m_bPepSupported)
clmi.flags |= CMIF_HIDDEN;
- for ( int i=0; i < m_pepServices.getCount(); i++ )
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_pepServices[i].GetMenu(), ( LPARAM )&clmi );
+ for (int i=0; i < m_pepServices.getCount(); i++)
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_pepServices[i].GetMenu(), (LPARAM)&clmi);
- JabberUpdateDialogs( m_menuItemsStatus );
+ JabberUpdateDialogs(m_menuItemsStatus);
}
//////////////////////////////////////////////////////////////////////////
@@ -1074,11 +1074,11 @@ void CJabberProto::MenuHideSrmmIcon(HANDLE hContact) void CJabberProto::MenuUpdateSrmmIcon(JABBER_LIST_ITEM *item)
{
- if ( item->list != LIST_ROSTER || !ServiceExists( MS_MSG_MODIFYICON ))
+ if (item->list != LIST_ROSTER || !ServiceExists(MS_MSG_MODIFYICON))
return;
HANDLE hContact = HContactFromJID(item->jid);
- if ( !hContact )
+ if ( !hContact)
return;
StatusIconData sid = {0};
@@ -1088,57 +1088,57 @@ void CJabberProto::MenuUpdateSrmmIcon(JABBER_LIST_ITEM *item) CallService(MS_MSG_MODIFYICON, (WPARAM)hContact, (LPARAM)&sid);
}
-int CJabberProto::OnProcessSrmmEvent( WPARAM, LPARAM lParam )
+int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam)
{
MessageWindowEventData *event = (MessageWindowEventData *)lParam;
- if ( event->uType == MSG_WINDOW_EVT_OPEN ) {
- if ( !hDialogsList )
+ if (event->uType == MSG_WINDOW_EVT_OPEN) {
+ if ( !hDialogsList)
hDialogsList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
WindowList_Add(hDialogsList, event->hwndWindow, event->hContact);
}
- else if ( event->uType == MSG_WINDOW_EVT_CLOSING ) {
+ else if (event->uType == MSG_WINDOW_EVT_CLOSING) {
if (hDialogsList)
WindowList_Remove(hDialogsList, event->hwndWindow);
DBVARIANT dbv;
BOOL bSupportTyping = FALSE;
- if ( !DBGetContactSetting( event->hContact, "SRMsg", "SupportTyping", &dbv )) {
+ if ( !DBGetContactSetting(event->hContact, "SRMsg", "SupportTyping", &dbv)) {
bSupportTyping = dbv.bVal == 1;
- JFreeVariant( &dbv );
- } else if ( !DBGetContactSetting( NULL, "SRMsg", "DefaultTyping", &dbv )) {
+ db_free(&dbv);
+ } else if ( !DBGetContactSetting(NULL, "SRMsg", "DefaultTyping", &dbv)) {
bSupportTyping = dbv.bVal == 1;
- JFreeVariant( &dbv );
+ db_free(&dbv);
}
- if ( bSupportTyping && !JGetStringT( event->hContact, "jid", &dbv )) {
+ if (bSupportTyping && !JGetStringT(event->hContact, "jid", &dbv)) {
TCHAR jid[ JABBER_MAX_JID_LEN ];
- GetClientJID( dbv.ptszVal, jid, SIZEOF( jid ));
- JFreeVariant( &dbv );
+ GetClientJID(dbv.ptszVal, jid, SIZEOF(jid));
+ db_free(&dbv);
- JABBER_RESOURCE_STATUS *r = ResourceInfoFromJID( jid );
+ JABBER_RESOURCE_STATUS *r = ResourceInfoFromJID(jid);
- if ( r && r->bMessageSessionActive ) {
+ if (r && r->bMessageSessionActive) {
r->bMessageSessionActive = FALSE;
- JabberCapsBits jcb = GetResourceCapabilites( jid, TRUE );
+ JabberCapsBits jcb = GetResourceCapabilites(jid, TRUE);
- if ( jcb & JABBER_CAPS_CHATSTATES ) {
+ if (jcb & JABBER_CAPS_CHATSTATES) {
int iqId = SerialNext();
m_ThreadInfo->send(
- XmlNode( _T("message")) << XATTR( _T("to"), jid ) << XATTR( _T("type"), _T("chat")) << XATTRID( iqId )
- << XCHILDNS( _T("gone"), _T(JABBER_FEAT_CHATSTATES)));
+ XmlNode(_T("message")) << XATTR(_T("to"), jid) << XATTR(_T("type"), _T("chat")) << XATTRID(iqId)
+ << XCHILDNS(_T("gone"), _T(JABBER_FEAT_CHATSTATES)));
} } } }
return 0;
}
-int CJabberProto::OnProcessSrmmIconClick( WPARAM wParam, LPARAM lParam )
+int CJabberProto::OnProcessSrmmIconClick(WPARAM wParam, LPARAM lParam)
{
StatusIconClickData *sicd = (StatusIconClickData *)lParam;
if (lstrcmpA(sicd->szModule, m_szModuleName))
return 0;
HANDLE hContact = (HANDLE)wParam;
- if (!hContact)
+ if ( !hContact)
return 0;
DBVARIANT dbv;
@@ -1146,9 +1146,9 @@ int CJabberProto::OnProcessSrmmIconClick( WPARAM wParam, LPARAM lParam ) return 0;
JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, dbv.ptszVal);
- JFreeVariant( &dbv );
+ db_free(&dbv);
- if ( !LI )
+ if ( !LI)
return 0;
HMENU hMenu = CreatePopupMenu();
@@ -1174,7 +1174,7 @@ int CJabberProto::OnProcessSrmmIconClick( WPARAM wParam, LPARAM lParam ) int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, sicd->clickLocation.x, sicd->clickLocation.y, 0, WindowList_Find(hDialogsList, hContact), NULL);
- if ( res == MENUITEM_LASTSEEN ) {
+ if (res == MENUITEM_LASTSEEN) {
LI->manualResource = -1;
LI->resourceMode = RSMODE_LASTSEEN;
}
@@ -1195,7 +1195,7 @@ int CJabberProto::OnProcessSrmmIconClick( WPARAM wParam, LPARAM lParam ) INT_PTR __cdecl CJabberProto::OnMenuHandleResource(WPARAM wParam, LPARAM, LPARAM res)
{
- if ( !m_bJabberOnline || !wParam )
+ if ( !m_bJabberOnline || !wParam)
return 0;
HANDLE hContact = (HANDLE)wParam;
@@ -1205,12 +1205,12 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleResource(WPARAM wParam, LPARAM, LPARAM return 0;
JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, dbv.ptszVal);
- JFreeVariant( &dbv );
+ db_free(&dbv);
- if ( !LI )
+ if ( !LI)
return 0;
- if ( res == MENUITEM_LASTSEEN ) {
+ if (res == MENUITEM_LASTSEEN) {
LI->manualResource = -1;
LI->resourceMode = RSMODE_LASTSEEN;
}
@@ -1230,7 +1230,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleResource(WPARAM wParam, LPARAM, LPARAM INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM wParam, LPARAM lParam, LPARAM res)
{
- if ( !m_bJabberOnline || !wParam )
+ if ( !m_bJabberOnline || !wParam)
return 0;
HANDLE hContact = (HANDLE)wParam;
@@ -1238,16 +1238,16 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM wParam, LPARAM l TCHAR *jid, text[ 1024 ];
DBVARIANT dbv;
- int result = JGetStringT( hContact, "jid", &dbv );
+ int result = JGetStringT(hContact, "jid", &dbv);
if (result)
{
- result = JGetStringT( hContact, "ChatRoomID", &dbv );
- if ( result ) return 0;
+ result = JGetStringT(hContact, "ChatRoomID", &dbv);
+ if (result) return 0;
- JABBER_LIST_ITEM* item = ListGetItemPtr( LIST_CHATROOM, dbv.ptszVal );
- if ( !item ) return 0;
+ JABBER_LIST_ITEM* item = ListGetItemPtr(LIST_CHATROOM, dbv.ptszVal);
+ if ( !item) return 0;
- mir_sntprintf( text, SIZEOF( text ), _T("%s/%s"), item->jid, item->nick );
+ mir_sntprintf(text, SIZEOF(text), _T("%s/%s"), item->jid, item->nick);
jid = text;
}
else
@@ -1257,7 +1257,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM wParam, LPARAM l EnterString(buf, SIZEOF(buf), TranslateT("Status Message"), JES_MULTINE);
SendPresenceTo(res, jid, NULL, buf);
- JFreeVariant(&dbv);
+ db_free(&dbv);
return 0;
}
@@ -1265,18 +1265,18 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM wParam, LPARAM l // Choose protocol instance
CJabberProto *JabberChooseInstance(bool bIsLink)
{
- if ( g_Instances.getCount() == 0 )
+ if (g_Instances.getCount() == 0)
return NULL;
- if ( g_Instances.getCount() == 1 ) {
- if ( g_Instances[0]->m_iStatus != ID_STATUS_OFFLINE && g_Instances[0]->m_iStatus != ID_STATUS_CONNECTING )
+ if (g_Instances.getCount() == 1) {
+ if (g_Instances[0]->m_iStatus != ID_STATUS_OFFLINE && g_Instances[0]->m_iStatus != ID_STATUS_CONNECTING)
return g_Instances[0];
return NULL;
}
- if ( bIsLink ) {
- for ( int i = 0; i < g_Instances.getCount(); i++ )
- if ( g_Instances[i]->m_options.ProcessXMPPLinks )
+ if (bIsLink) {
+ for (int i = 0; i < g_Instances.getCount(); i++)
+ if (g_Instances[i]->m_options.ProcessXMPPLinks)
return g_Instances[i];
}
@@ -1288,7 +1288,7 @@ CJabberProto *JabberChooseInstance(bool bIsLink) clmi.flags = CMIM_FLAGS;
CJabberProto* ppro = g_Instances[i];
- if ( ppro->m_iStatus != ID_STATUS_OFFLINE && ppro->m_iStatus != ID_STATUS_CONNECTING ) {
+ if (ppro->m_iStatus != ID_STATUS_OFFLINE && ppro->m_iStatus != ID_STATUS_CONNECTING) {
++nItems;
lastItemId = i+1;
clmi.flags |= CMIM_ICON;
@@ -1296,24 +1296,24 @@ CJabberProto *JabberChooseInstance(bool bIsLink) }
else clmi.flags |= CMIF_HIDDEN;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )ppro->m_hChooseMenuItem, ( LPARAM )&clmi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)ppro->m_hChooseMenuItem, (LPARAM)&clmi);
}
- if ( nItems > 1 ) {
+ if (nItems > 1) {
ListParam param = { 0 };
param.MenuObjectHandle = hChooserMenu;
HMENU hMenu = CreatePopupMenu();
- CallService( MO_BUILDMENU, ( WPARAM )hMenu, ( LPARAM )¶m );
+ CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)¶m);
POINT pt;
GetCursorPos(&pt);
- int res = TrackPopupMenu( hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, pcli->hwndContactList, NULL );
- DestroyMenu( hMenu );
+ int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
+ DestroyMenu(hMenu);
- if ( res ) {
+ if (res) {
CJabberProto* pro = NULL;
- CallService( MO_PROCESSCOMMANDBYMENUIDENT, res, ( LPARAM )&pro );
+ CallService(MO_PROCESSCOMMANDBYMENUIDENT, res, (LPARAM)&pro);
return pro;
}
|