summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-07-08 22:10:14 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-07-08 22:10:14 +0000
commitbb952e431866d131bae95c08e579ec8a00f00343 (patch)
tree60881668cf328b50906346c5f66ce47da2d9ad88 /protocols/Gadu-Gadu
parentc181af64bab27eb50e684c64c0a3caa49f8bbe39 (diff)
core protocol helpers for creating protocol evengs, services & threads
git-svn-id: http://svn.miranda-ng.org/main/trunk@5286 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu')
-rw-r--r--protocols/Gadu-Gadu/src/avatar.cpp12
-rw-r--r--protocols/Gadu-Gadu/src/filetransfer.cpp8
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp8
-rw-r--r--protocols/Gadu-Gadu/src/gg.h16
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp74
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.h16
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp16
-rw-r--r--protocols/Gadu-Gadu/src/image.cpp16
-rw-r--r--protocols/Gadu-Gadu/src/import.cpp20
-rw-r--r--protocols/Gadu-Gadu/src/ownerinfo.cpp4
-rw-r--r--protocols/Gadu-Gadu/src/services.cpp4
-rw-r--r--protocols/Gadu-Gadu/src/sessions.cpp6
-rw-r--r--protocols/Gadu-Gadu/src/userutils.cpp40
13 files changed, 90 insertions, 150 deletions
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp
index 307d0de7ae..2bc6dc0aab 100644
--- a/protocols/Gadu-Gadu/src/avatar.cpp
+++ b/protocols/Gadu-Gadu/src/avatar.cpp
@@ -309,9 +309,9 @@ void GGPROTO::initavatarrequestthread()
avatar_requests.destroy();
avatar_transfers.destroy();
#ifdef DEBUGMODE
- netlog("initavatarrequestthread(): forkthreadex 1 GGPROTO::avatarrequestthread");
+ netlog("initavatarrequestthread(): ForkThreadEx 1 GGPROTO::avatarrequestthread");
#endif
- pth_avatar.hThread = forkthreadex(&GGPROTO::avatarrequestthread, NULL, &pth_avatar.dwThreadId);
+ pth_avatar.hThread = ForkThreadEx(&GGPROTO::avatarrequestthread, NULL, &pth_avatar.dwThreadId);
}
}
@@ -345,9 +345,9 @@ void GGPROTO::getOwnAvatar()
if (db_get_b(NULL, m_szModuleName, GG_KEY_ENABLEAVATARS, GG_KEYDEF_ENABLEAVATARS)
&& db_get_dw(NULL, m_szModuleName, GG_KEY_UIN, 0)){
#ifdef DEBUGMODE
- netlog("getOwnAvatar(): forkthread 2 GGPROTO::getOwnAvatarThread");
+ netlog("getOwnAvatar(): ForkThread 2 GGPROTO::getOwnAvatarThread");
#endif
- forkthread(&GGPROTO::getOwnAvatarThread, NULL);
+ ForkThread(&GGPROTO::getOwnAvatarThread, NULL);
}
}
@@ -502,7 +502,7 @@ void __cdecl GGPROTO::setavatarthread(void *param)
void GGPROTO::setAvatar(const TCHAR *szFilename)
{
#ifdef DEBUGMODE
- netlog("setAvatar(): forkthread 3 GGPROTO::setavatarthread");
+ netlog("setAvatar(): ForkThread 3 GGPROTO::setavatarthread");
#endif
- forkthread(&GGPROTO::setavatarthread, mir_tstrdup(szFilename));
+ ForkThread(&GGPROTO::setavatarthread, mir_tstrdup(szFilename));
}
diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp
index 345537d9be..bfd23dbd06 100644
--- a/protocols/Gadu-Gadu/src/filetransfer.cpp
+++ b/protocols/Gadu-Gadu/src/filetransfer.cpp
@@ -52,9 +52,9 @@ void GGPROTO::dccstart()
// Start thread
#ifdef DEBUGMODE
- netlog("dccstart(): forkthreadex 4 GGPROTO::dccmainthread");
+ netlog("dccstart(): ForkThreadEx 4 GGPROTO::dccmainthread");
#endif
- pth_dcc.hThread = forkthreadex(&GGPROTO::dccmainthread, NULL, &pth_dcc.dwThreadId);
+ pth_dcc.hThread = ForkThreadEx(&GGPROTO::dccmainthread, NULL, &pth_dcc.dwThreadId);
}
void GGPROTO::dccconnect(uin_t uin)
@@ -113,9 +113,9 @@ HANDLE ftfail(GGPROTO *gg, HANDLE hContact)
ft->hProcess = (HANDLE)rand();
ft->hContact = hContact;
#ifdef DEBUGMODE
- gg->netlog("ftfail(): forkthread 5 GGPROTO::ftfailthread");
+ gg->netlog("ftfail(): ForkThread 5 GGPROTO::ftfailthread");
#endif
- gg->forkthread(&GGPROTO::ftfailthread, ft);
+ gg->ForkThread(&GGPROTO::ftfailthread, ft);
return ft->hProcess;
}
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index 4aa782a6b4..3bd7b199a6 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -256,12 +256,12 @@ INT_PTR GGPROTO::blockuser(WPARAM wParam, LPARAM lParam)
//////////////////////////////////////////////////////////
// Contact blocking initialization
-#define GGS_BLOCKUSER "%s/BlockUser"
+#define GGS_BLOCKUSER "/BlockUser"
void GGPROTO::block_init()
{
char service[64];
- mir_snprintf(service, sizeof(service), GGS_BLOCKUSER, m_szModuleName);
- createObjService(service, &GGPROTO::blockuser);
+ mir_snprintf(service, sizeof(service), "%s%s", m_szModuleName, GGS_BLOCKUSER);
+ CreateService(GGS_BLOCKUSER, &GGPROTO::blockuser);
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_TCHAR;
@@ -272,7 +272,7 @@ void GGPROTO::block_init()
mi.pszContactOwner = m_szModuleName;
hBlockMenuItem = Menu_AddContactMenuItem(&mi);
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU, gg_prebuildcontactmenu);
+ ::HookEvent(ME_CLIST_PREBUILDCONTACTMENU, gg_prebuildcontactmenu);
}
//////////////////////////////////////////////////////////
diff --git a/protocols/Gadu-Gadu/src/gg.h b/protocols/Gadu-Gadu/src/gg.h
index ea98b0bc72..c6ca392ece 100644
--- a/protocols/Gadu-Gadu/src/gg.h
+++ b/protocols/Gadu-Gadu/src/gg.h
@@ -156,14 +156,14 @@ struct GGGETAVATARDATA
#define GG_SEQ_CHINFO 400
// Services
-#define GGS_IMPORT_SERVER "%s/ImportFromServer"
-#define GGS_REMOVE_SERVER "%s/RemoveFromServer"
-#define GGS_IMPORT_TEXT "%s/ImportFromText"
-#define GGS_EXPORT_SERVER "%s/ExportFromServer"
-#define GGS_EXPORT_TEXT "%s/ExportFromText"
-
-#define GGS_SENDIMAGE "%s/SendImage"
-#define GGS_RECVIMAGE "%s/RecvImage"
+#define GGS_IMPORT_SERVER "/ImportFromServer"
+#define GGS_REMOVE_SERVER "/RemoveFromServer"
+#define GGS_IMPORT_TEXT "/ImportFromText"
+#define GGS_EXPORT_SERVER "/ExportFromServer"
+#define GGS_EXPORT_TEXT "/ExportFromText"
+
+#define GGS_SENDIMAGE "/SendImage"
+#define GGS_RECVIMAGE "/RecvImage"
// Keys
#define GG_PLUGINVERSION "Version" // Plugin version.. user for cleanup from previous versions
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp
index 22b2a5e57d..6642e2bb61 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.cpp
+++ b/protocols/Gadu-Gadu/src/gg_proto.cpp
@@ -22,11 +22,10 @@
#include "gg.h"
GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) :
+ PROTO<GGPROTO>(pszProtoName, tszUserName),
avatar_requests(1, HandleKeySortT),
avatar_transfers(1, HandleKeySortT)
{
- ProtoConstructor(this, pszProtoName, tszUserName);
-
#ifdef DEBUGMODE
extendedLogging = 0;
#endif
@@ -52,16 +51,16 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) :
netlib = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
// Register services
- createProtoService(PS_GETAVATARCAPS, &GGPROTO::getavatarcaps);
- createProtoService(PS_GETAVATARINFOT, &GGPROTO::getavatarinfo);
- createProtoService(PS_GETMYAVATART, &GGPROTO::getmyavatar);
- createProtoService(PS_SETMYAVATART, &GGPROTO::setmyavatar);
+ CreateService(PS_GETAVATARCAPS, &GGPROTO::getavatarcaps);
+ CreateService(PS_GETAVATARINFOT, &GGPROTO::getavatarinfo);
+ CreateService(PS_GETMYAVATART, &GGPROTO::getmyavatar);
+ CreateService(PS_SETMYAVATART, &GGPROTO::setmyavatar);
- createProtoService(PS_GETMYAWAYMSG, &GGPROTO::getmyawaymsg);
- createProtoService(PS_SETAWAYMSGT, (GGServiceFunc)&GGPROTO::SetAwayMsg);
- createProtoService(PS_CREATEACCMGRUI, &GGPROTO::get_acc_mgr_gui);
+ CreateService(PS_GETMYAWAYMSG, &GGPROTO::getmyawaymsg);
+ CreateService(PS_SETAWAYMSGT, (MyServiceFunc)&GGPROTO::SetAwayMsg);
+ CreateService(PS_CREATEACCMGRUI, &GGPROTO::get_acc_mgr_gui);
- createProtoService(PS_LEAVECHAT, &GGPROTO::leavechat);
+ CreateService(PS_LEAVECHAT, &GGPROTO::leavechat);
// Offline contacts and clear logon time
setalloffline();
@@ -82,7 +81,6 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) :
links_instance_init();
initavatarrequestthread();
-
}
GGPROTO::~GGPROTO()
@@ -124,8 +122,6 @@ GGPROTO::~GGPROTO()
if (modemsg.freechat) mir_free(modemsg.freechat);
if (modemsg.invisible) mir_free(modemsg.invisible);
if (modemsg.offline) mir_free(modemsg.offline);
-
- ProtoDestructor(this);
}
//////////////////////////////////////////////////////////
@@ -212,9 +208,9 @@ int GGPROTO::GetInfo(HANDLE hContact, int infoType)
if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH)))
{
#ifdef DEBUGMODE
- netlog("GetInfo(): forkthread 6 GGPROTO::cmdgetinfothread");
+ netlog("GetInfo(): ForkThread 6 GGPROTO::cmdgetinfothread");
#endif
- forkthread(&GGPROTO::cmdgetinfothread, hContact);
+ ForkThread(&GGPROTO::cmdgetinfothread, hContact);
return 1;
}
@@ -230,9 +226,9 @@ int GGPROTO::GetInfo(HANDLE hContact, int infoType)
{
gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 48, 1, "sess_mutex", 1);
#ifdef DEBUGMODE
- netlog("GetInfo(): forkthread 7 GGPROTO::cmdgetinfothread");
+ netlog("GetInfo(): ForkThread 7 GGPROTO::cmdgetinfothread");
#endif
- forkthread(&GGPROTO::cmdgetinfothread, hContact);
+ ForkThread(&GGPROTO::cmdgetinfothread, hContact);
return 1;
}
gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 48, 2, "sess_mutex", 1);
@@ -244,9 +240,9 @@ int GGPROTO::GetInfo(HANDLE hContact, int infoType)
if (!(req = gg_pubdir50_new(GG_PUBDIR50_READ)))
{
#ifdef DEBUGMODE
- netlog("GetInfo(): forkthread 8 GGPROTO::cmdgetinfothread");
+ netlog("GetInfo(): ForkThread 8 GGPROTO::cmdgetinfothread");
#endif
- forkthread(&GGPROTO::cmdgetinfothread, hContact);
+ ForkThread(&GGPROTO::cmdgetinfothread, hContact);
return 1;
}
@@ -261,9 +257,9 @@ int GGPROTO::GetInfo(HANDLE hContact, int infoType)
{
gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 49, 1, "sess_mutex", 1);
#ifdef DEBUGMODE
- netlog("GetInfo(): forkthread 9 GGPROTO::cmdgetinfothread");
+ netlog("GetInfo(): ForkThread 9 GGPROTO::cmdgetinfothread");
#endif
- forkthread(&GGPROTO::cmdgetinfothread, hContact);
+ ForkThread(&GGPROTO::cmdgetinfothread, hContact);
return 1;
}
gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 49, 2, "sess_mutex", 1);
@@ -296,9 +292,9 @@ HANDLE GGPROTO::SearchBasic(const PROTOCHAR *id)
gg_pubdir50_t req;
if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH))) {
#ifdef DEBUGMODE
- netlog("SearchBasic(): forkthread 10 GGPROTO::searchthread");
+ netlog("SearchBasic(): ForkThread 10 GGPROTO::searchthread");
#endif
- forkthread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, NULL);
return (HANDLE)1;
}
@@ -315,9 +311,9 @@ HANDLE GGPROTO::SearchBasic(const PROTOCHAR *id)
{
gg_LeaveCriticalSection(&sess_mutex, "SearchBasic", 50, 1, "sess_mutex", 1);
#ifdef DEBUGMODE
- netlog("SearchBasic(): forkthread 11 GGPROTO::searchthread");
+ netlog("SearchBasic(): ForkThread 11 GGPROTO::searchthread");
#endif
- forkthread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, NULL);
return (HANDLE)1;
}
gg_LeaveCriticalSection(&sess_mutex, "SearchBasic", 50, 2, "sess_mutex", 1);
@@ -346,9 +342,9 @@ HANDLE GGPROTO::SearchByName(const PROTOCHAR *nick, const PROTOCHAR *firstName,
if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH)))
{
#ifdef DEBUGMODE
- netlog("SearchByName(): forkthread 12 GGPROTO::searchthread");
+ netlog("SearchByName(): ForkThread 12 GGPROTO::searchthread");
#endif
- forkthread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, NULL);
return (HANDLE)1;
}
@@ -394,9 +390,9 @@ HANDLE GGPROTO::SearchByName(const PROTOCHAR *nick, const PROTOCHAR *firstName,
{
gg_LeaveCriticalSection(&sess_mutex, "SearchByName", 51, 1, "sess_mutex", 1);
#ifdef DEBUGMODE
- netlog("SearchByName(): forkthread 13 GGPROTO::searchthread");
+ netlog("SearchByName(): ForkThread 13 GGPROTO::searchthread");
#endif
- forkthread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, NULL);
return (HANDLE)1;
}
gg_LeaveCriticalSection(&sess_mutex, "SearchByName", 51, 2, "sess_mutex", 1);
@@ -422,9 +418,9 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg)
if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH)))
{
#ifdef DEBUGMODE
- netlog("SearchAdvanced(): forkthread 14 GGPROTO::searchthread");
+ netlog("SearchAdvanced(): ForkThread 14 GGPROTO::searchthread");
#endif
- forkthread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, NULL);
return (HWND)1;
}
@@ -540,9 +536,9 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg)
{
gg_LeaveCriticalSection(&sess_mutex, "SearchAdvanced", 52, 1, "sess_mutex", 1);
#ifdef DEBUGMODE
- netlog("SearchAdvanced(): forkthread 15 GGPROTO::searchthread");
+ netlog("SearchAdvanced(): ForkThread 15 GGPROTO::searchthread");
#endif
- forkthread(&GGPROTO::searchthread, NULL);
+ ForkThread(&GGPROTO::searchthread, NULL);
return (HWND)1;
}
gg_LeaveCriticalSection(&sess_mutex, "SearchAdvanced", 52, 2, "sess_mutex", 1);
@@ -637,9 +633,9 @@ int GGPROTO::SendMsg(HANDLE hContact, int flags, const char *msg)
ack->seq = seq;
ack->hContact = hContact;
#ifdef DEBUGMODE
- netlog("SendMsg(): forkthread 16 GGPROTO::sendackthread");
+ netlog("SendMsg(): ForkThread 16 GGPROTO::sendackthread");
#endif
- forkthread(&GGPROTO::sendackthread, ack);
+ ForkThread(&GGPROTO::sendackthread, ack);
}
}
mir_free(msg_utf8);
@@ -700,9 +696,9 @@ void __cdecl GGPROTO::getawaymsgthread(void *hContact)
HANDLE GGPROTO::GetAwayMsg(HANDLE hContact)
{
#ifdef DEBUGMODE
- netlog("GetAwayMsg(): forkthread 17 GGPROTO::getawaymsgthread");
+ netlog("GetAwayMsg(): ForkThread 17 GGPROTO::getawaymsgthread");
#endif
- forkthread(&GGPROTO::getawaymsgthread, hContact);
+ ForkThread(&GGPROTO::getawaymsgthread, hContact);
return (HANDLE)1;
}
@@ -796,8 +792,8 @@ int GGPROTO::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam)
switch( eventType ) {
case EV_PROTO_ONLOAD:
{
- hookProtoEvent(ME_OPT_INITIALISE, &GGPROTO::options_init);
- hookProtoEvent(ME_USERINFO_INITIALISE, &GGPROTO::details_init);
+ HookEvent(ME_OPT_INITIALISE, &GGPROTO::options_init);
+ HookEvent(ME_USERINFO_INITIALISE, &GGPROTO::details_init);
// Init misc stuff
gg_icolib_init();
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h
index 5660ce1713..e6389f7266 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.h
+++ b/protocols/Gadu-Gadu/src/gg_proto.h
@@ -22,12 +22,7 @@
#ifndef GGPROTO_H
#define GGPROTO_H
-struct GGPROTO;
-typedef void ( __cdecl GGPROTO::*GGThreadFunc )( void* );
-typedef int ( __cdecl GGPROTO::*GGEventFunc )( WPARAM, LPARAM );
-typedef INT_PTR ( __cdecl GGPROTO::*GGServiceFunc )( WPARAM, LPARAM );
-
-struct GGPROTO : public PROTO_INTERFACE
+struct GGPROTO : public PROTO<GGPROTO>
{
GGPROTO( const char*, const TCHAR* );
~GGPROTO();
@@ -106,8 +101,6 @@ struct GGPROTO : public PROTO_INTERFACE
void checknewuser(uin_t uin, const char* passwd);
/* Thread functions */
- void forkthread(GGThreadFunc pFunc, void *param);
- HANDLE forkthreadex(GGThreadFunc pFunc, void *param, UINT *threadId);
void threadwait(GGTHREAD *thread);
#ifdef DEBUGMODE
@@ -237,13 +230,6 @@ struct GGPROTO : public PROTO_INTERFACE
BOOL sessions_closedlg();
void sessions_menus_init(HGENMENU hRoot);
- /* Event helpers */
- void createObjService(const char* szService, GGServiceFunc serviceProc);
- void createProtoService(const char* szService, GGServiceFunc serviceProc);
- HANDLE hookProtoEvent(const char*, GGEventFunc);
- void forkThread(GGThreadFunc, void* );
- HANDLE forkThreadEx(GGThreadFunc, void*, UINT* threadID = NULL);
-
// Debug functions
int netlog(const char *fmt, ...);
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp
index b619ae97ac..542d35adc5 100644
--- a/protocols/Gadu-Gadu/src/groupchat.cpp
+++ b/protocols/Gadu-Gadu/src/groupchat.cpp
@@ -21,9 +21,9 @@
#include "gg.h"
#include "m_metacontacts.h"
-#define GG_GC_GETCHAT "%s/GCGetChat"
-#define GGS_OPEN_CONF "%s/OpenConf"
-#define GGS_CLEAR_IGNORED "%s/ClearIgnored"
+#define GG_GC_GETCHAT "/GCGetChat"
+#define GGS_OPEN_CONF "/OpenConf"
+#define GGS_CLEAR_IGNORED "/ClearIgnored"
////////////////////////////////////////////////////////////////////////////////
// Inits Gadu-Gadu groupchat module using chat.dll
@@ -44,7 +44,7 @@ int GGPROTO::gc_init()
gcr.ptszModuleDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr);
- hookProtoEvent(ME_GC_EVENT, &GGPROTO::gc_event);
+ HookEvent(ME_GC_EVENT, &GGPROTO::gc_event);
gc_enabled = TRUE;
// create & hook event
mir_snprintf(service, 64, GG_GC_GETCHAT, m_szModuleName);
@@ -69,8 +69,8 @@ void GGPROTO::gc_menus_init(HGENMENU hRoot)
mi.hParentMenu = hRoot;
// Conferencing
- mir_snprintf(service, sizeof(service), GGS_OPEN_CONF, m_szModuleName);
- createObjService(service, &GGPROTO::gc_openconf);
+ mir_snprintf(service, sizeof(service), "%s%s", m_szModuleName, GGS_OPEN_CONF);
+ CreateService(GGS_OPEN_CONF, &GGPROTO::gc_openconf);
mi.position = 2000050001;
mi.icolibItem = iconList[14].hIcolib;
mi.ptszName = LPGENT("Open &conference...");
@@ -78,8 +78,8 @@ void GGPROTO::gc_menus_init(HGENMENU hRoot)
hMainMenu[0] = Menu_AddProtoMenuItem(&mi);
// Clear ignored conferences
- mir_snprintf(service, sizeof(service), GGS_CLEAR_IGNORED, m_szModuleName);
- createObjService(service, &GGPROTO::gc_clearignored);
+ mir_snprintf(service, sizeof(service), "%s%s", m_szModuleName, GGS_CLEAR_IGNORED);
+ CreateService(GGS_CLEAR_IGNORED, &GGPROTO::gc_clearignored);
mi.position = 2000050002;
mi.icolibItem = iconList[15].hIcolib;
mi.ptszName = LPGENT("&Clear ignored conferences");
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp
index 5a6b38d9b6..f970b9eb87 100644
--- a/protocols/Gadu-Gadu/src/image.cpp
+++ b/protocols/Gadu-Gadu/src/image.cpp
@@ -69,8 +69,8 @@ int gg_img_remove(GGIMAGEDLGDATA *dat);
int GGPROTO::img_init()
{
char service[64];
- mir_snprintf(service, sizeof(service), GGS_SENDIMAGE, m_szModuleName);
- createObjService(service, &GGPROTO::img_sendimg);
+ mir_snprintf(service, sizeof(service), "%s%s", m_szModuleName, GGS_SENDIMAGE);
+ CreateService(GGS_SENDIMAGE, &GGPROTO::img_sendimg);
// Send image contact menu item
CLISTMENUITEM mi = { sizeof(mi) };
@@ -83,9 +83,7 @@ int GGPROTO::img_init()
hImageMenuItem = Menu_AddContactMenuItem(&mi);
// Receive image
- mir_snprintf(service, sizeof(service), GGS_RECVIMAGE, m_szModuleName);
- createObjService(service, &GGPROTO::img_recvimage);
-
+ CreateService(GGS_RECVIMAGE, &GGPROTO::img_recvimage);
return FALSE;
}
@@ -744,9 +742,9 @@ GGIMAGEDLGDATA *gg_img_recvdlg(GGPROTO *gg, HANDLE hContact)
dat->gg = gg;
ResetEvent(dat->hEvent);
#ifdef DEBUGMODE
- gg->netlog("gg_img_recvdlg(): forkthread 18 GGPROTO::img_dlgcallthread");
+ gg->netlog("gg_img_recvdlg(): ForkThread 18 GGPROTO::img_dlgcallthread");
#endif
- gg->forkthread(&GGPROTO::img_dlgcallthread, dat);
+ gg->ForkThread(&GGPROTO::img_dlgcallthread, dat);
return dat;
}
@@ -1198,9 +1196,9 @@ INT_PTR GGPROTO::img_sendimg(WPARAM wParam, LPARAM lParam)
// Create new dialog
#ifdef DEBUGMODE
- netlog("img_sendimg(): forkthread 19 GGPROTO::img_dlgcallthread");
+ netlog("img_sendimg(): ForkThread 19 GGPROTO::img_dlgcallthread");
#endif
- forkthread(&GGPROTO::img_dlgcallthread, dat);
+ ForkThread(&GGPROTO::img_dlgcallthread, dat);
while (WaitForSingleObjectEx(dat->hEvent, INFINITE, TRUE) != WAIT_OBJECT_0);
CloseHandle(dat->hEvent);
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp
index 1e899588db..53623916ae 100644
--- a/protocols/Gadu-Gadu/src/import.cpp
+++ b/protocols/Gadu-Gadu/src/import.cpp
@@ -612,8 +612,8 @@ void GGPROTO::import_init(HGENMENU hRoot)
{
// Import from server item
char service[64];
- mir_snprintf(service, sizeof(service), GGS_IMPORT_SERVER, m_szModuleName);
- createObjService(service, &GGPROTO::import_server);
+ mir_snprintf(service, sizeof(service), "%s%s", m_szModuleName, GGS_IMPORT_SERVER);
+ CreateService(GGS_IMPORT_SERVER, &GGPROTO::import_server);
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR;
@@ -625,8 +625,8 @@ void GGPROTO::import_init(HGENMENU hRoot)
hMainMenu[2] = Menu_AddProtoMenuItem(&mi);
// Import from textfile
- mir_snprintf(service, sizeof(service), GGS_IMPORT_TEXT, m_szModuleName);
- createObjService(service, &GGPROTO::import_text);
+ mir_snprintf(service, sizeof(service), "%s%s", m_szModuleName, GGS_IMPORT_TEXT);
+ CreateService(GGS_IMPORT_TEXT, &GGPROTO::import_text);
mi.position = 2000500002;
mi.icolibItem = iconList[2].hIcolib;
@@ -635,8 +635,8 @@ void GGPROTO::import_init(HGENMENU hRoot)
hMainMenu[3] = Menu_AddProtoMenuItem(&mi);
// Remove from server
- mir_snprintf(service, sizeof(service), GGS_REMOVE_SERVER, m_szModuleName);
- createObjService(service, &GGPROTO::remove_server);
+ mir_snprintf(service, sizeof(service), "%s%s", m_szModuleName, GGS_REMOVE_SERVER);
+ CreateService(GGS_REMOVE_SERVER, &GGPROTO::remove_server);
mi.position = 2000500003;
mi.icolibItem = iconList[3].hIcolib;
@@ -645,8 +645,8 @@ void GGPROTO::import_init(HGENMENU hRoot)
hMainMenu[4] = Menu_AddProtoMenuItem(&mi);
// Export to server
- mir_snprintf(service, sizeof(service), GGS_EXPORT_SERVER, m_szModuleName);
- createObjService(service, &GGPROTO::export_server);
+ mir_snprintf(service, sizeof(service), "%s%s", m_szModuleName, GGS_EXPORT_SERVER);
+ CreateService(GGS_EXPORT_SERVER, &GGPROTO::export_server);
mi.position = 2005000001;
mi.icolibItem = iconList[4].hIcolib;
@@ -655,8 +655,8 @@ void GGPROTO::import_init(HGENMENU hRoot)
hMainMenu[5] = Menu_AddProtoMenuItem(&mi);
// Export to textfile
- mir_snprintf(service, sizeof(service), GGS_EXPORT_TEXT, m_szModuleName);
- createObjService(service, &GGPROTO::export_text);
+ mir_snprintf(service, sizeof(service), "%s%s", m_szModuleName, GGS_EXPORT_TEXT);
+ CreateService(GGS_EXPORT_TEXT, &GGPROTO::export_text);
mi.position = 2005000002;
mi.icolibItem = iconList[5].hIcolib;
diff --git a/protocols/Gadu-Gadu/src/ownerinfo.cpp b/protocols/Gadu-Gadu/src/ownerinfo.cpp
index 4acf245682..908cc842c3 100644
--- a/protocols/Gadu-Gadu/src/ownerinfo.cpp
+++ b/protocols/Gadu-Gadu/src/ownerinfo.cpp
@@ -81,7 +81,7 @@ void GGPROTO::remindpassword(uin_t uin, const char *email)
rp->uin = uin;
rp->email = email;
#ifdef DEBUGMODE
- netlog("remindpassword(): forkthreadex 20 GGPROTO::remindpasswordthread");
+ netlog("remindpassword(): ForkThreadEx 20 GGPROTO::remindpasswordthread");
#endif
- forkthread(&GGPROTO::remindpasswordthread, rp);
+ ForkThread(&GGPROTO::remindpasswordthread, rp);
}
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp
index a22dbb69e2..e2560c557f 100644
--- a/protocols/Gadu-Gadu/src/services.cpp
+++ b/protocols/Gadu-Gadu/src/services.cpp
@@ -94,9 +94,9 @@ int GGPROTO::refreshstatus(int status)
threadwait(&pth_sess);
#ifdef DEBUGMODE
netlog("refreshstatus(): Waiting pth_sess thread - OK");
- netlog("refreshstatus(): forkthreadex 21 GGPROTO::mainthread");
+ netlog("refreshstatus(): ForkThreadEx 21 GGPROTO::mainthread");
#endif
- pth_sess.hThread = forkthreadex(&GGPROTO::mainthread, NULL, &pth_sess.dwThreadId);
+ pth_sess.hThread = ForkThreadEx(&GGPROTO::mainthread, NULL, &pth_sess.dwThreadId);
}
else
{
diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp
index 04836b80d4..7268d9fafc 100644
--- a/protocols/Gadu-Gadu/src/sessions.cpp
+++ b/protocols/Gadu-Gadu/src/sessions.cpp
@@ -20,7 +20,7 @@
#include "gg.h"
-#define GGS_CONCUR_SESS "%s/ConcurSess"
+#define GGS_CONCUR_SESS "/ConcurSess"
static void gg_clearsessionslist(HWND hwndDlg)
{
@@ -426,8 +426,8 @@ BOOL GGPROTO::sessions_closedlg()
void GGPROTO::sessions_menus_init(HGENMENU hRoot)
{
char service[64];
- mir_snprintf(service, sizeof(service), GGS_CONCUR_SESS, m_szModuleName);
- createObjService(service, &GGPROTO::sessions_view);
+ mir_snprintf(service, sizeof(service), "%s%s", m_szModuleName, GGS_CONCUR_SESS);
+ CreateService(service, &GGPROTO::sessions_view);
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR;
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp
index c00d615ad1..de73cb5e52 100644
--- a/protocols/Gadu-Gadu/src/userutils.cpp
+++ b/protocols/Gadu-Gadu/src/userutils.cpp
@@ -277,46 +277,6 @@ INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
}
//////////////////////////////////////////////////////////
-// Hooks protocol event
-
-HANDLE GGPROTO::hookProtoEvent(const char* szEvent, GGEventFunc handler)
-{
- return ::HookEventObj(szEvent, ( MIRANDAHOOKOBJ )*( void** )&handler, this);
-}
-
-//////////////////////////////////////////////////////////
-// Adds a new protocol specific service function
-
-void GGPROTO::createObjService(const char* szService, GGServiceFunc serviceProc)
-{
- CreateServiceFunctionObj(szService, (MIRANDASERVICEOBJ)*( void** )&serviceProc, this);
-}
-
-void GGPROTO::createProtoService(const char* szService, GGServiceFunc serviceProc)
-{
- char str[MAXMODULELABELLENGTH];
- mir_snprintf(str, sizeof(str), "%s%s", m_szModuleName, szService);
- CreateServiceFunctionObj(str, (MIRANDASERVICEOBJ)*( void** )&serviceProc, this);
-}
-
-//////////////////////////////////////////////////////////
-// Forks a thread
-
-void GGPROTO::forkthread(GGThreadFunc pFunc, void *param)
-{
- UINT threadId;
- CloseHandle( mir_forkthreadowner((pThreadFuncOwner)*(void**)&pFunc, this, param, &threadId));
-}
-
-//////////////////////////////////////////////////////////
-// Forks a thread and returns a pseudo handle for it
-
-HANDLE GGPROTO::forkthreadex(GGThreadFunc pFunc, void *param, UINT *threadId)
-{
- return mir_forkthreadowner((pThreadFuncOwner)*(void**)&pFunc, this, param, threadId);
-}
-
-//////////////////////////////////////////////////////////
// Wait for thread to stop
void GGPROTO::threadwait(GGTHREAD *thread)