From 7ebaebba8520e457bf374ca245f52332fbb008be Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 15 Nov 2012 21:18:48 +0000 Subject: bye-bye old coding style in Jabber git-svn-id: http://svn.miranda-ng.org/main/trunk@2322 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber.cpp | 63 ++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 32 deletions(-) (limited to 'protocols/JabberG/src/jabber.cpp') diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index b492ffcddb..bf658d9ab1 100644 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.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 @@ -46,7 +46,7 @@ struct CountryListEntry* g_countries; TCHAR szCoreVersion[100]; PLUGININFOEX pluginInfo = { - sizeof( PLUGININFOEX ), + sizeof(PLUGININFOEX), "Jabber Protocol", __VERSION_DWORD, "Jabber protocol plugin for Miranda NG.", @@ -90,13 +90,13 @@ static int sttCompareProtocols(const CJabberProto *p1, const CJabberProto *p2) LIST g_Instances(1, sttCompareProtocols); ///////////////////////////////////////////////////////////////////////////// -BOOL WINAPI DllMain( HINSTANCE hModule, DWORD, LPVOID ) +BOOL WINAPI DllMain(HINSTANCE hModule, DWORD, LPVOID) { hInst = hModule; return TRUE; } -extern "C" __declspec( dllexport ) PLUGININFOEX *MirandaPluginInfoEx( DWORD mirandaVersion ) +extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion) { return &pluginInfo; } @@ -106,7 +106,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCO /////////////////////////////////////////////////////////////////////////////// // OnPreShutdown - prepares Miranda to be shut down -int __cdecl CJabberProto::OnPreShutdown( WPARAM, LPARAM ) +int __cdecl CJabberProto::OnPreShutdown(WPARAM, LPARAM) { UI_SAFE_CLOSE_HWND(m_hwndAgentRegInput); UI_SAFE_CLOSE_HWND(m_hwndRegProgress); @@ -145,16 +145,16 @@ static INT_PTR g_SvcParseXmppUri(WPARAM w, LPARAM l) return 0; } -static int OnModulesLoaded( WPARAM, LPARAM ) +static int OnModulesLoaded(WPARAM, LPARAM) { hModulesLoadedTB = HookEvent(ME_TTB_MODULELOADED, g_OnToolbarInit); bSecureIM = (ServiceExists("SecureIM/IsContactSecured")); // file associations manager plugin support - if ( ServiceExists( MS_ASSOCMGR_ADDNEWURLTYPE )) { - CreateServiceFunction("JABBER/*" JS_PARSE_XMPP_URI, g_SvcParseXmppUri ); - AssocMgr_AddNewUrlTypeT( "xmpp:", TranslateT("Jabber Link Protocol"), hInst, IDI_JABBER, "JABBER/*" JS_PARSE_XMPP_URI, 0 ); + if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) { + CreateServiceFunction("JABBER/*" JS_PARSE_XMPP_URI, g_SvcParseXmppUri); + AssocMgr_AddNewUrlTypeT("xmpp:", TranslateT("Jabber Link Protocol"), hInst, IDI_JABBER, "JABBER/*" JS_PARSE_XMPP_URI, 0); } // init fontservice for info frame @@ -201,56 +201,55 @@ static int OnModulesLoaded( WPARAM, LPARAM ) /////////////////////////////////////////////////////////////////////////////// // OnLoad - initialize the plugin instance -static CJabberProto* jabberProtoInit( const char* pszProtoName, const TCHAR* tszUserName ) +static CJabberProto* jabberProtoInit(const char* pszProtoName, const TCHAR *tszUserName) { - CJabberProto *ppro = new CJabberProto( pszProtoName, tszUserName ); + CJabberProto *ppro = new CJabberProto(pszProtoName, tszUserName); g_Instances.insert(ppro); return ppro; } -static int jabberProtoUninit( CJabberProto* ppro ) +static int jabberProtoUninit(CJabberProto* ppro) { g_Instances.remove(ppro); delete ppro; return 0; } -extern "C" int __declspec( dllexport ) Load() +extern "C" int __declspec(dllexport) Load() { // set the memory, lists & utf8 managers - mir_getXI( &xi ); - mir_getTMI( &tmi ); - mir_getLP( &pluginInfo ); + mir_getXI(&xi); + mir_getTMI(&tmi); + mir_getLP(&pluginInfo); WORD v[4]; CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v); mir_sntprintf(szCoreVersion, SIZEOF(szCoreVersion), _T("%d.%d.%d.%d"), v[0], v[1], v[2], v[3]); - CallService( MS_UTILS_GETCOUNTRYLIST, ( WPARAM )&g_cbCountries, ( LPARAM )&g_countries ); + CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&g_cbCountries, (LPARAM)&g_countries); setlocale(LC_ALL, ""); - pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)hInst); + pcli = (CLIST_INTERFACE*)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)hInst); // Register protocol module - PROTOCOLDESCRIPTOR pd; - ZeroMemory( &pd, sizeof( PROTOCOLDESCRIPTOR )); - pd.cbSize = sizeof( PROTOCOLDESCRIPTOR ); + PROTOCOLDESCRIPTOR pd = { 0 }; + pd.cbSize = sizeof(PROTOCOLDESCRIPTOR); pd.szName = "JABBER"; - pd.fnInit = ( pfnInitProto )jabberProtoInit; - pd.fnUninit = ( pfnUninitProto )jabberProtoUninit; + pd.fnInit = (pfnInitProto)jabberProtoInit; + pd.fnUninit = (pfnUninitProto)jabberProtoUninit; pd.type = PROTOTYPE_PROTOCOL; - CallService( MS_PROTO_REGISTERMODULE, 0, ( LPARAM )&pd ); + CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); // Load some fuctions HMODULE hDll; - if ( hDll = GetModuleHandleA( "gdi32.dll" )) + if (hDll = GetModuleHandleA("gdi32.dll")) JabberAlphaBlend = (BOOL (WINAPI *)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION)) GetProcAddress(hDll, "GdiAlphaBlend"); - if ( JabberAlphaBlend == NULL && ( hDll = LoadLibraryA("msimg32.dll" ))) + if (JabberAlphaBlend == NULL && (hDll = LoadLibraryA("msimg32.dll"))) JabberAlphaBlend = (BOOL (WINAPI *)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION)) GetProcAddress(hDll, "AlphaBlend"); - if ( IsWinVerXPPlus()) { - if ( hDll = GetModuleHandleA("uxtheme")) { + if (IsWinVerXPPlus()) { + if (hDll = GetModuleHandleA("uxtheme")) { JabberDrawThemeParentBackground = (HRESULT (WINAPI *)(HWND,HDC,RECT *))GetProcAddress(hDll, "DrawThemeParentBackground"); JabberIsThemeActive = (BOOL (WINAPI *)())GetProcAddress(hDll, "IsThemeActive"); } } @@ -266,7 +265,7 @@ extern "C" int __declspec( dllexport ) Load() /////////////////////////////////////////////////////////////////////////////// // Unload - destroy the plugin instance -extern "C" int __declspec( dllexport ) Unload( void ) +extern "C" int __declspec(dllexport) Unload(void) { UnhookEvent(hModulesLoaded); UnhookEvent(hModulesLoadedTB); -- cgit v1.2.3