From 81cd378b0a0ee5e26d58c085a3b10bd89a7244c2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 29 Dec 2017 18:23:21 +0300 Subject: meta contacts registration should be delayed --- src/mir_app/src/meta_main.cpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/mir_app/src/meta_main.cpp b/src/mir_app/src/meta_main.cpp index 5a276f03e8..62b3bf476d 100644 --- a/src/mir_app/src/meta_main.cpp +++ b/src/mir_app/src/meta_main.cpp @@ -54,6 +54,21 @@ void UnloadMetacontacts(void) // Initializes the services provided and the link to those needed // Called when the plugin is loaded into Miranda + +static int RegisterMeta(WPARAM, LPARAM) +{ + PROTOCOLDESCRIPTOR pd = { 0 }; + pd.cbSize = sizeof(pd); + pd.szName = META_FILTER; + pd.type = PROTOTYPE_FILTER; + Proto_RegisterModule(&pd); + + pd.szName = META_PROTO; + pd.type = PROTOTYPE_VIRTUAL; + Proto_RegisterModule(&pd); + return 0; +} + int LoadMetacontacts(void) { Icon_Register(g_hInst, LPGEN("MetaContacts"), iconList, _countof(iconList), "mc"); @@ -61,7 +76,7 @@ int LoadMetacontacts(void) db_set_resident(META_PROTO, "Status"); db_set_resident(META_PROTO, "IdleTS"); - //set all contacts to 'offline', and initialize subcontact counter for db consistency check + // set all contacts to 'offline', and initialize subcontact counter for db consistency check for (MCONTACT hContact = db_find_first(META_PROTO); hContact; hContact = db_find_next(hContact, META_PROTO)) { db_set_w(hContact, META_PROTO, "Status", ID_STATUS_OFFLINE); db_set_dw(hContact, META_PROTO, "IdleTS", 0); @@ -69,15 +84,7 @@ int LoadMetacontacts(void) Meta_ReadOptions(); - PROTOCOLDESCRIPTOR pd = { 0 }; - pd.cbSize = sizeof(pd); - pd.szName = META_FILTER; - pd.type = PROTOTYPE_FILTER; - Proto_RegisterModule(&pd); - - pd.szName = META_PROTO; - pd.type = PROTOTYPE_VIRTUAL; - Proto_RegisterModule(&pd); + HookEvent(ME_SYSTEM_MODULESLOADED, RegisterMeta); // further db setup done in modules loaded (nick [protocol string required] & clist display name) Meta_InitServices(); -- cgit v1.2.3