From 488aa433f119560b13c1b6234508ea6dda29c25a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 6 Jul 2012 05:56:11 +0000 Subject: user-defined service creation isn't needed anymore git-svn-id: http://svn.miranda-ng.org/main/trunk@781 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/UserInfoEx/Flags/svc_countrylistext.cpp | 4 +-- plugins/UserInfoEx/Flags/svc_flags.cpp | 2 +- plugins/UserInfoEx/Flags/svc_flagsicons.cpp | 4 +-- plugins/UserInfoEx/dlg_anniversarylist.cpp | 2 +- plugins/UserInfoEx/dlg_propsheet.cpp | 4 +-- plugins/UserInfoEx/ex_import/svc_ExImport.cpp | 8 +++--- plugins/UserInfoEx/init.cpp | 1 - plugins/UserInfoEx/mir_menuitems.cpp | 8 +++--- plugins/UserInfoEx/svc_constants.cpp | 35 ------------------------- plugins/UserInfoEx/svc_constants.h | 19 -------------- plugins/UserInfoEx/svc_contactinfo.cpp | 4 +-- plugins/UserInfoEx/svc_email.cpp | 2 +- plugins/UserInfoEx/svc_homepage.cpp | 2 +- plugins/UserInfoEx/svc_refreshci.cpp | 2 +- plugins/UserInfoEx/svc_reminder.cpp | 4 +-- plugins/UserInfoEx/svc_timezone.cpp | 4 +-- plugins/UserInfoEx/svc_timezone_old.cpp | 4 +-- 17 files changed, 27 insertions(+), 82 deletions(-) (limited to 'plugins/UserInfoEx') diff --git a/plugins/UserInfoEx/Flags/svc_countrylistext.cpp b/plugins/UserInfoEx/Flags/svc_countrylistext.cpp index 71b259c7ab..fabb2749f2 100644 --- a/plugins/UserInfoEx/Flags/svc_countrylistext.cpp +++ b/plugins/UserInfoEx/Flags/svc_countrylistext.cpp @@ -320,7 +320,7 @@ VOID InitCountryListExt() { /* hack to replace built-in country list */ if (!myDestroyServiceFunction(MS_UTILS_GETCOUNTRYLIST)) - myCreateServiceFunction(MS_UTILS_GETCOUNTRYLIST,ServiceGetCountryList); + CreateServiceFunction(MS_UTILS_GETCOUNTRYLIST,ServiceGetCountryList); if (!myDestroyServiceFunction(MS_UTILS_GETCOUNTRYBYNUMBER)) - myCreateServiceFunction(MS_UTILS_GETCOUNTRYBYNUMBER,ServiceGetCountryByNumber); + CreateServiceFunction(MS_UTILS_GETCOUNTRYBYNUMBER,ServiceGetCountryByNumber); } diff --git a/plugins/UserInfoEx/Flags/svc_flags.cpp b/plugins/UserInfoEx/Flags/svc_flags.cpp index ec08f9704c..8999df2cca 100644 --- a/plugins/UserInfoEx/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/Flags/svc_flags.cpp @@ -699,7 +699,7 @@ void SvcFlagsLoadModule() nCountriesCount=0; InitIcons(); /* load in iconlib */ //InitIpToCountry(); /* not implementet */ - myCreateServiceFunction(MS_FLAGS_DETECTCONTACTORIGINCOUNTRY,ServiceDetectContactOriginCountry); + CreateServiceFunction(MS_FLAGS_DETECTCONTACTORIGINCOUNTRY,ServiceDetectContactOriginCountry); //init settings gFlagsOpts.bShowExtraImgFlag = DB::Setting::GetByte(MODNAMEFLAGS,"ShowExtraImgFlag", SETTING_SHOWEXTRAIMGFLAG_DEFAULT); gFlagsOpts.bUseUnknownFlag = DB::Setting::GetByte(MODNAMEFLAGS,"UseUnknownFlag", SETTING_USEUNKNOWNFLAG_DEFAULT); diff --git a/plugins/UserInfoEx/Flags/svc_flagsicons.cpp b/plugins/UserInfoEx/Flags/svc_flagsicons.cpp index e265d1b850..d7119cd75e 100644 --- a/plugins/UserInfoEx/Flags/svc_flagsicons.cpp +++ b/plugins/UserInfoEx/Flags/svc_flagsicons.cpp @@ -440,8 +440,8 @@ VOID InitIcons() } /* create services */ - myCreateServiceFunction(MS_FLAGS_LOADFLAGICON,ServiceLoadFlagIcon); - myCreateServiceFunction(MS_FLAGS_CREATEMERGEDFLAGICON,ServiceCreateMergedFlagIcon); + CreateServiceFunction(MS_FLAGS_LOADFLAGICON,ServiceLoadFlagIcon); + CreateServiceFunction(MS_FLAGS_CREATEMERGEDFLAGICON,ServiceCreateMergedFlagIcon); } VOID UninitIcons() diff --git a/plugins/UserInfoEx/dlg_anniversarylist.cpp b/plugins/UserInfoEx/dlg_anniversarylist.cpp index 680dd1e23b..0ea9b5b645 100644 --- a/plugins/UserInfoEx/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/dlg_anniversarylist.cpp @@ -1129,7 +1129,7 @@ VOID DlgAnniversaryListOnToolBarLoaded() **/ VOID DlgAnniversaryListLoadModule() { - myCreateServiceFunction(MS_USERINFO_REMINDER_LIST, DlgAnniversaryListShow); + CreateServiceFunction(MS_USERINFO_REMINDER_LIST, DlgAnniversaryListShow); HOTKEYDESC hk = { 0 }; hk.cbSize = sizeof(HOTKEYDESC); diff --git a/plugins/UserInfoEx/dlg_propsheet.cpp b/plugins/UserInfoEx/dlg_propsheet.cpp index e413602e47..eee049aea1 100644 --- a/plugins/UserInfoEx/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/dlg_propsheet.cpp @@ -706,8 +706,8 @@ VOID DlgContactInfoLoadModule() { ghDetailsInitEvent = CreateHookableEvent(ME_USERINFO_INITIALISE); - myCreateServiceFunction(MS_USERINFO_SHOWDIALOG, ShowDialog); - myCreateServiceFunction("UserInfo/AddPage", AddPage); + CreateServiceFunction(MS_USERINFO_SHOWDIALOG, ShowDialog); + CreateServiceFunction("UserInfo/AddPage", AddPage); HookEvent(ME_DB_CONTACT_DELETED, OnDeleteContact); HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown); diff --git a/plugins/UserInfoEx/ex_import/svc_ExImport.cpp b/plugins/UserInfoEx/ex_import/svc_ExImport.cpp index b44f455cb8..35bb59c3b9 100644 --- a/plugins/UserInfoEx/ex_import/svc_ExImport.cpp +++ b/plugins/UserInfoEx/ex_import/svc_ExImport.cpp @@ -374,9 +374,9 @@ INT_PTR svcExIm_Account_Service(WPARAM wParam, LPARAM lParam) **/ VOID SvcExImport_LoadModule() { - myCreateServiceFunction(MS_USERINFO_VCARD_EXPORTALL, svcExIm_MainExport_Service); - myCreateServiceFunction(MS_USERINFO_VCARD_IMPORTALL, svcExIm_MainImport_Service); - myCreateServiceFunction(MS_USERINFO_VCARD_EXPORT, svcExIm_ContactExport_Service); - myCreateServiceFunction(MS_USERINFO_VCARD_IMPORT, svcExIm_ContactImport_Service); + CreateServiceFunction(MS_USERINFO_VCARD_EXPORTALL, svcExIm_MainExport_Service); + CreateServiceFunction(MS_USERINFO_VCARD_IMPORTALL, svcExIm_MainImport_Service); + CreateServiceFunction(MS_USERINFO_VCARD_EXPORT, svcExIm_ContactExport_Service); + CreateServiceFunction(MS_USERINFO_VCARD_IMPORT, svcExIm_ContactImport_Service); return; } diff --git a/plugins/UserInfoEx/init.cpp b/plugins/UserInfoEx/init.cpp index 95153823c1..c146193354 100644 --- a/plugins/UserInfoEx/init.cpp +++ b/plugins/UserInfoEx/init.cpp @@ -198,7 +198,6 @@ static INT OnModulesLoaded(WPARAM wParam, LPARAM lParam) static INT OnShutdown(WPARAM wParam, LPARAM lParam) { UnhookEvent(ghShutdownHook); - services.destroy(); DlgContactInfoUnLoadModule(); SvcReminderUnloadModule(); diff --git a/plugins/UserInfoEx/mir_menuitems.cpp b/plugins/UserInfoEx/mir_menuitems.cpp index 05707ba7c0..9f140fb4b7 100644 --- a/plugins/UserInfoEx/mir_menuitems.cpp +++ b/plugins/UserInfoEx/mir_menuitems.cpp @@ -486,7 +486,7 @@ VOID RebuildSubGroup() // Export strcpy( tDest, "/ExportGroup"); //mi.pszService - if (!ServiceExists(mi.pszService)) myCreateServiceFunction(mi.pszService, svcExIm_Group_Service); + if (!ServiceExists(mi.pszService)) CreateServiceFunction(mi.pszService, svcExIm_Group_Service); mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Export") : LPGEN("&Export Group"); mi.position = 1050200; mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT); @@ -496,7 +496,7 @@ VOID RebuildSubGroup() // Import strcpy( tDest, "/ImportGroup"); //mi.pszService - if (!ServiceExists(mi.pszService)) myCreateServiceFunction(mi.pszService, svcExIm_Group_Service); + if (!ServiceExists(mi.pszService)) CreateServiceFunction(mi.pszService, svcExIm_Group_Service); mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Import") : LPGEN("&Import Group"); mi.position = 1050300; mi.hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT); @@ -619,7 +619,7 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) // Export strcpy( tDest, "/ExportAccount"); //mi.pszService - if (!ServiceExists(mi.pszService)) myCreateServiceFunction(mi.pszService, svcExIm_Account_Service); + if (!ServiceExists(mi.pszService)) CreateServiceFunction(mi.pszService, svcExIm_Account_Service); mir_sntprintf(sztName, SIZEOF(sztName),_T("%s %s"), pAccountName->tszAccountName, TranslateT("&Export")); mi.ptszName = sztName; mi.position = 50200; @@ -628,7 +628,7 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) // Import strcpy( tDest, "/ImportAccount"); //mi.pszService - if (!ServiceExists(mi.pszService)) myCreateServiceFunction(mi.pszService, svcExIm_Account_Service); + if (!ServiceExists(mi.pszService)) CreateServiceFunction(mi.pszService, svcExIm_Account_Service); mir_sntprintf(sztName, SIZEOF(sztName),_T("%s %s"), pAccountName->tszAccountName, TranslateT("&Import")); mi.ptszName = sztName; mi.position = 50300; diff --git a/plugins/UserInfoEx/svc_constants.cpp b/plugins/UserInfoEx/svc_constants.cpp index 2fb2316fb4..ed803f79f4 100644 --- a/plugins/UserInfoEx/svc_constants.cpp +++ b/plugins/UserInfoEx/svc_constants.cpp @@ -248,41 +248,6 @@ static IDSTRLIST TmplPrefixes[]={ static IDSTRLIST *MyCountries = NULL; static UINT MyCountriesCount = 0; -/** - * Class CService - * This class supersed miranda CreateServiceFunction - * it automtic call DestroyService in destructor - * it is used for OBJLIST services wich unregister - * all services during unload - * - * @param name - (const char *) service name to register - * @param serviceProc - (MIRANDASERVICE) - **/ -CService::CService( const char * name, MIRANDASERVICE serviceProc) -{ - m_hService = CreateServiceFunction(name, serviceProc); - m_name = m_hService ? name : NULL; -} - -CService::~CService() -{ - if(this->m_hService) - DestroyServiceFunction(this->m_hService); -} - -/** - * sort function for OBJLIST - * - * @param p1 - (const CService*) - * @param p2 - (const CService*) - **/ -static int compareServices( const CService* p1, const CService* p2 ) -{ - return strcmp( p1->m_name, p2->m_name ); -} -OBJLIST services( 30, compareServices ); - - /** * This is a sort procedure, which compares two items of an IDSTRLIST array. * It is used by qsort in SvcConstantsTranslateList and cares about the diff --git a/plugins/UserInfoEx/svc_constants.h b/plugins/UserInfoEx/svc_constants.h index 2106f9fa3c..1ea761e770 100644 --- a/plugins/UserInfoEx/svc_constants.h +++ b/plugins/UserInfoEx/svc_constants.h @@ -181,25 +181,6 @@ typedef struct CIDList } IDSTRLIST, *LPIDSTRLIST; -class CService -{ -public: - CService( const char * name, MIRANDASERVICE serviceProc); - ~CService(); - - const char* m_name; - HANDLE m_hService; -}; - -extern OBJLIST services; -static __inline HANDLE myCreateServiceFunction( const char * name, MIRANDASERVICE serviceProc) -{ - CService* p = new CService(name,serviceProc); - if (!p->m_hService){delete p; return 0;} - services.insert(p); - return p->m_hService; -} - INT_PTR GetMaritalList(LPUINT pListSize, LPIDSTRLIST *pList); INT_PTR GetLanguageList(LPUINT pListSize, LPIDSTRLIST *pList); INT_PTR GetCountryList(LPUINT pListSize, LPIDSTRLIST *pList); diff --git a/plugins/UserInfoEx/svc_contactinfo.cpp b/plugins/UserInfoEx/svc_contactinfo.cpp index 18aa2bcc6b..06053e8e7f 100644 --- a/plugins/UserInfoEx/svc_contactinfo.cpp +++ b/plugins/UserInfoEx/svc_contactinfo.cpp @@ -779,12 +779,12 @@ static INT OnSettingChanged(WPARAM wParam, LPARAM lParam) **/ VOID SvcContactInfoLoadModule() { - myCreateServiceFunction(MS_DB_CONTACT_GETSETTING_STR_EX, GetContactSettingStrExService); + CreateServiceFunction(MS_DB_CONTACT_GETSETTING_STR_EX, GetContactSettingStrExService); if (DB::Setting::GetByte(SET_GETCONTACTINFO_ENABLED, DEFVAL_GETCONTACTINFO_ENABLED)) { if (!myDestroyServiceFunction(MS_CONTACT_GETCONTACTINFO)) { - if (myCreateServiceFunction(MS_CONTACT_GETCONTACTINFO, GetContactInfo)) { + if (CreateServiceFunction(MS_CONTACT_GETCONTACTINFO, GetContactInfo)) { DBVARIANT dbv; if (DB::Setting::GetAString(NULL, "Contact", "NameOrder", &dbv)) { BYTE i; diff --git a/plugins/UserInfoEx/svc_email.cpp b/plugins/UserInfoEx/svc_email.cpp index 3e11ddb763..a9a0b47686 100644 --- a/plugins/UserInfoEx/svc_email.cpp +++ b/plugins/UserInfoEx/svc_email.cpp @@ -389,7 +389,7 @@ VOID SvcEMailLoadModule() if (DB::Setting::GetByte(SET_EXTENDED_EMAILSERVICE, TRUE)) { // create own email send command if (!myDestroyServiceFunction(MS_EMAIL_SENDEMAIL)) - myCreateServiceFunction(MS_EMAIL_SENDEMAIL, MenuCommand); + CreateServiceFunction(MS_EMAIL_SENDEMAIL, MenuCommand); } } diff --git a/plugins/UserInfoEx/svc_homepage.cpp b/plugins/UserInfoEx/svc_homepage.cpp index 4c0a619168..52b6e799e3 100644 --- a/plugins/UserInfoEx/svc_homepage.cpp +++ b/plugins/UserInfoEx/svc_homepage.cpp @@ -336,7 +336,7 @@ VOID SvcHomepageEnableExtraIcons(BOOLEAN bEnable, BOOLEAN bUpdateDB) **/ VOID SvcHomepageLoadModule() { - myCreateServiceFunction(MS_USERINFO_HOMEPAGE_OPENURL, MenuCommand); + CreateServiceFunction(MS_USERINFO_HOMEPAGE_OPENURL, MenuCommand); SvcHomepageEnableExtraIcons( myGlobals.ExtraIconsServiceExist || DB::Setting::GetByte(SET_CLIST_EXTRAICON_HOMEPAGE, DEFVAL_CLIST_EXTRAICON_HOMEPAGE), FALSE); diff --git a/plugins/UserInfoEx/svc_refreshci.cpp b/plugins/UserInfoEx/svc_refreshci.cpp index b5e84d004a..bddc9e60ca 100644 --- a/plugins/UserInfoEx/svc_refreshci.cpp +++ b/plugins/UserInfoEx/svc_refreshci.cpp @@ -922,7 +922,7 @@ static INT OnPreShutdown(WPARAM, LPARAM) **/ VOID SvcRefreshContactInfoLoadModule(VOID) { - myCreateServiceFunction(MS_USERINFO_REFRESH, RefreshService); + CreateServiceFunction(MS_USERINFO_REFRESH, RefreshService); HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); HookEvent(ME_DB_CONTACT_ADDED, OnContactAdded); diff --git a/plugins/UserInfoEx/svc_reminder.cpp b/plugins/UserInfoEx/svc_reminder.cpp index 20abe584a6..deda692bee 100644 --- a/plugins/UserInfoEx/svc_reminder.cpp +++ b/plugins/UserInfoEx/svc_reminder.cpp @@ -1207,8 +1207,8 @@ VOID SvcReminderLoadModule(VOID) Skin_AddSound(&ssd); // create service functions - myCreateServiceFunction(MS_USERINFO_REMINDER_CHECK, CheckService); - myCreateServiceFunction(MS_USERINFO_REMINDER_AGGRASIVEBACKUP, BackupBirthdayService); + CreateServiceFunction(MS_USERINFO_REMINDER_CHECK, CheckService); + CreateServiceFunction(MS_USERINFO_REMINDER_AGGRASIVEBACKUP, BackupBirthdayService); // register hotkey HOTKEYDESC hk = { 0 }; diff --git a/plugins/UserInfoEx/svc_timezone.cpp b/plugins/UserInfoEx/svc_timezone.cpp index a114ce054e..d9d0b4688c 100644 --- a/plugins/UserInfoEx/svc_timezone.cpp +++ b/plugins/UserInfoEx/svc_timezone.cpp @@ -78,6 +78,6 @@ INT_PTR GetContactLocalTime(WPARAM wParam, LPARAM lParam) **/ VOID SvcTimezoneLoadModule() { - myCreateServiceFunction(MS_USERINFO_TIMEZONEINFO, GetContactTimeZoneInformation); - myCreateServiceFunction(MS_USERINFO_LOCALTIME, GetContactLocalTime); + CreateServiceFunction(MS_USERINFO_TIMEZONEINFO, GetContactTimeZoneInformation); + CreateServiceFunction(MS_USERINFO_LOCALTIME, GetContactLocalTime); } diff --git a/plugins/UserInfoEx/svc_timezone_old.cpp b/plugins/UserInfoEx/svc_timezone_old.cpp index e4961a2f85..f602f68f5d 100644 --- a/plugins/UserInfoEx/svc_timezone_old.cpp +++ b/plugins/UserInfoEx/svc_timezone_old.cpp @@ -636,8 +636,8 @@ INT_PTR GetContactLocalTime_old(WPARAM wParam, LPARAM lParam) VOID SvcTimezoneLoadModule_old() { TzMgr.Init(); - myCreateServiceFunction(MS_USERINFO_TIMEZONEINFO, GetContactTimeZoneInformation); - myCreateServiceFunction(MS_USERINFO_LOCALTIME, GetContactLocalTime); + CreateServiceFunction(MS_USERINFO_TIMEZONEINFO, GetContactTimeZoneInformation); + CreateServiceFunction(MS_USERINFO_LOCALTIME, GetContactLocalTime); if (DB::Setting::GetByte(SET_OPT_AUTOTIMEZONE, TRUE)) { SvcTimezoneSyncWithWindows(); -- cgit v1.2.3