diff options
author | George Hazan <george.hazan@gmail.com> | 2013-07-08 22:10:14 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-07-08 22:10:14 +0000 |
commit | bb952e431866d131bae95c08e579ec8a00f00343 (patch) | |
tree | 60881668cf328b50906346c5f66ce47da2d9ad88 /protocols/JabberG | |
parent | c181af64bab27eb50e684c64c0a3caa49f8bbe39 (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/JabberG')
-rw-r--r-- | protocols/JabberG/src/jabber_console.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_ft.cpp | 8 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_groupchat.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_iq.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_iqid.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_menu.cpp | 28 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_opt.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_privacy.cpp | 6 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.cpp | 89 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.h | 15 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_std.cpp | 41 |
11 files changed, 70 insertions, 127 deletions
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index fa7174a4ec..75b650b068 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -687,7 +687,7 @@ void CJabberProto::ConsoleInit() {
LoadLibraryA("riched20.dll");
InitializeCriticalSection(&m_filterInfo.csPatternLock);
- m_hThreadConsole = JForkThreadEx(&CJabberProto::ConsoleThread, 0, &m_dwConsoleThreadId);
+ m_hThreadConsole = ForkThreadEx(&CJabberProto::ConsoleThread, 0, &m_dwConsoleThreadId);
}
void CJabberProto::ConsoleUninit()
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index b6075c4867..9f32f62e2b 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -155,7 +155,7 @@ void CJabberProto::OnFtSiResult(HXML iqNode, CJabberIqInfo* pInfo) jbt->ft = ft;
ft->type = FT_BYTESTREAM;
ft->jbt = jbt;
- JForkThread((JThreadFunc)&CJabberProto::ByteSendThread, jbt);
+ ForkThread((MyThreadFunc)&CJabberProto::ByteSendThread, jbt);
} else if ( !_tcscmp(xmlGetText(valueNode), _T(JABBER_FEAT_IBB))) {
JABBER_IBB_TRANSFER *jibb = (JABBER_IBB_TRANSFER *) mir_alloc(sizeof (JABBER_IBB_TRANSFER));
ZeroMemory(jibb, sizeof(JABBER_IBB_TRANSFER));
@@ -167,7 +167,7 @@ void CJabberProto::OnFtSiResult(HXML iqNode, CJabberIqInfo* pInfo) jibb->ft = ft;
ft->type = FT_IBB;
ft->jibb = jibb;
- JForkThread((JThreadFunc)&CJabberProto::IbbSendThread, jibb);
+ ForkThread((MyThreadFunc)&CJabberProto::IbbSendThread, jibb);
} } } } } } }
else {
Log("File transfer stream initiation request denied or failed");
@@ -443,7 +443,7 @@ BOOL CJabberProto::FtHandleBytestreamRequest(HXML iqNode, CJabberIqInfo* pInfo) jbt->pfnFinal = &CJabberProto::FtReceiveFinal;
jbt->ft = item->ft;
item->ft->jbt = jbt;
- JForkThread((JThreadFunc)&CJabberProto::ByteReceiveThread, jbt);
+ ForkThread((MyThreadFunc)&CJabberProto::ByteReceiveThread, jbt);
ListRemove(LIST_FTRECV, sid);
return TRUE;
}
@@ -490,7 +490,7 @@ BOOL CJabberProto::FtHandleIbbRequest(HXML iqNode, BOOL bOpen) jibb->ft = item->ft;
item->ft->jibb = jibb;
item->jibb = jibb;
- JForkThread((JThreadFunc)&CJabberProto::IbbReceiveThread, jibb);
+ ForkThread((MyThreadFunc)&CJabberProto::IbbReceiveThread, jibb);
m_ThreadInfo->send( XmlNodeIq(_T("result"), id, from));
return TRUE;
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 2255c2bcc0..beea8f4e69 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -1345,7 +1345,7 @@ void CJabberProto::GroupchatProcessInvite(const TCHAR *roomJid, const TCHAR *fro inviteInfo->from = mir_tstrdup(from);
inviteInfo->reason = mir_tstrdup(reason);
inviteInfo->password = mir_tstrdup(password);
- JForkThread((JThreadFunc)&CJabberProto::GroupchatInviteAcceptThread, inviteInfo);
+ ForkThread((MyThreadFunc)&CJabberProto::GroupchatInviteAcceptThread, inviteInfo);
}
else {
TCHAR* myNick = JabberNickFromJID(m_szJabberJID);
diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp index 6be5980c54..bfe570201e 100644 --- a/protocols/JabberG/src/jabber_iq.cpp +++ b/protocols/JabberG/src/jabber_iq.cpp @@ -183,7 +183,7 @@ BOOL CJabberIqManager::Start() if (m_hExpirerThread || m_bExpirerThreadShutdownRequest)
return FALSE;
- m_hExpirerThread = ppro->JForkThreadEx(&CJabberProto::ExpirerThread, this);
+ m_hExpirerThread = ppro->ForkThreadEx(&CJabberProto::ExpirerThread, this, 0);
if ( !m_hExpirerThread)
return FALSE;
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 85eda703ff..e81d74ea2a 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -525,7 +525,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo* pInfo) }
if (httpavatars->getCount())
- JForkThread(&CJabberProto::LoadHttpAvatars, httpavatars);
+ ForkThread(&CJabberProto::LoadHttpAvatars, httpavatars);
else
delete httpavatars;
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 5ae47f809b..5f4cb29764 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -448,7 +448,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) 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);
+ CreateServiceParam(tDest, &CJabberProto::OnMenuHandleResource, MENUITEM_RESOURCES+i);
mi.pszName = "";
mi.position = i;
mi.hParentMenu = g_hMenuResourcesRoot;
@@ -680,7 +680,7 @@ void CJabberProto::MenuInit() }
// "Bookmarks..."
- JCreateService("/Bookmarks", &CJabberProto::OnMenuHandleBookmarks);
+ CreateService("/Bookmarks", &CJabberProto::OnMenuHandleBookmarks);
strcpy(tDest, "/Bookmarks");
mi.flags = CMIF_CHILDPOPUP;
mi.hParentMenu = hJabberRoot;
@@ -690,7 +690,7 @@ void CJabberProto::MenuInit() m_hMenuBookmarks = Menu_AddProtoMenuItem(&mi);
// "Options..."
- JCreateService("/Options", &CJabberProto::OnMenuOptions);
+ CreateService("/Options", &CJabberProto::OnMenuOptions);
strcpy(tDest, "/Options");
mi.pszName = LPGEN("Options...");
mi.position = 200002;
@@ -705,7 +705,7 @@ void CJabberProto::MenuInit() HGENMENU hMenuServicesRoot = Menu_AddProtoMenuItem(&mi);
// "Service Discovery..."
- JCreateService("/ServiceDiscovery", &CJabberProto::OnMenuHandleServiceDiscovery);
+ CreateService("/ServiceDiscovery", &CJabberProto::OnMenuHandleServiceDiscovery);
strcpy(tDest, "/ServiceDiscovery");
mi.flags = CMIF_ROOTHANDLE;
mi.pszName = LPGEN("Service Discovery");
@@ -714,28 +714,28 @@ void CJabberProto::MenuInit() mi.hParentMenu = hMenuServicesRoot;
m_hMenuServiceDiscovery = Menu_AddProtoMenuItem(&mi);
- JCreateService("/SD/MyTransports", &CJabberProto::OnMenuHandleServiceDiscoveryMyTransports);
+ CreateService("/SD/MyTransports", &CJabberProto::OnMenuHandleServiceDiscoveryMyTransports);
strcpy(tDest, "/SD/MyTransports");
mi.pszName = LPGEN("Registered Transports");
mi.position = 2000050003;
mi.icolibItem = GetIconHandle(IDI_TRANSPORTL);
m_hMenuSDMyTransports = Menu_AddProtoMenuItem(&mi);
- JCreateService("/SD/Transports", &CJabberProto::OnMenuHandleServiceDiscoveryTransports);
+ CreateService("/SD/Transports", &CJabberProto::OnMenuHandleServiceDiscoveryTransports);
strcpy(tDest, "/SD/Transports");
mi.pszName = LPGEN("Local Server Transports");
mi.position = 2000050004;
mi.icolibItem = GetIconHandle(IDI_TRANSPORT);
m_hMenuSDTransports = Menu_AddProtoMenuItem(&mi);
- JCreateService("/SD/Conferences", &CJabberProto::OnMenuHandleServiceDiscoveryConferences);
+ CreateService("/SD/Conferences", &CJabberProto::OnMenuHandleServiceDiscoveryConferences);
strcpy(tDest, "/SD/Conferences");
mi.pszName = LPGEN("Browse Chatrooms");
mi.position = 2000050005;
mi.icolibItem = GetIconHandle(IDI_GROUP);
m_hMenuSDConferences = Menu_AddProtoMenuItem(&mi);
- JCreateService("/Groupchat", &CJabberProto::OnMenuHandleJoinGroupchat);
+ CreateService("/Groupchat", &CJabberProto::OnMenuHandleJoinGroupchat);
strcpy(tDest, "/Groupchat");
mi.pszName = LPGEN("Create/Join groupchat");
mi.position = 2000050006;
@@ -743,7 +743,7 @@ void CJabberProto::MenuInit() m_hMenuGroupchat = Menu_AddProtoMenuItem(&mi);
// "Change Password..."
- JCreateService("/ChangePassword", &CJabberProto::OnMenuHandleChangePassword);
+ CreateService("/ChangePassword", &CJabberProto::OnMenuHandleChangePassword);
strcpy(tDest, "/ChangePassword");
mi.pszName = LPGEN("Change Password");
mi.position = 2000050007;
@@ -751,7 +751,7 @@ void CJabberProto::MenuInit() m_hMenuChangePassword = Menu_AddProtoMenuItem(&mi);
// "Roster editor"
- JCreateService("/RosterEditor", &CJabberProto::OnMenuHandleRosterControl);
+ CreateService("/RosterEditor", &CJabberProto::OnMenuHandleRosterControl);
strcpy(tDest, "/RosterEditor");
mi.pszName = LPGEN("Roster editor");
mi.position = 2000050009;
@@ -759,14 +759,14 @@ void CJabberProto::MenuInit() m_hMenuRosterControl = Menu_AddProtoMenuItem(&mi);
// "XML Console"
- JCreateService("/XMLConsole", &CJabberProto::OnMenuHandleConsole);
+ CreateService("/XMLConsole", &CJabberProto::OnMenuHandleConsole);
strcpy(tDest, "/XMLConsole");
mi.pszName = LPGEN("XML Console");
mi.position = 2000050010;
mi.icolibItem = GetIconHandle(IDI_CONSOLE);
Menu_AddProtoMenuItem(&mi);
- JCreateService("/Notes", &CJabberProto::OnMenuHandleNotes);
+ CreateService("/Notes", &CJabberProto::OnMenuHandleNotes);
strcpy(tDest, "/Notes");
mi.pszName = LPGEN("Notes");
mi.position = 2000050011;
@@ -800,7 +800,7 @@ void CJabberProto::MenuInit() mir_snprintf(srvFce, sizeof(srvFce), "%s/menuSetPriority/0", m_szModuleName);
bool needServices = !ServiceExists(srvFce);
if (needServices)
- JCreateServiceParam(svcName, &CJabberProto::OnMenuSetPriority, 0);
+ CreateServiceParam(svcName, &CJabberProto::OnMenuSetPriority, 0);
int steps[] = { 10, 5, 1, 0, -1, -5, -10 };
for (int i = 0; i < SIZEOF(steps); i++) {
@@ -815,7 +815,7 @@ void CJabberProto::MenuInit() mir_snprintf(szName, sizeof(szName), (steps[i] > 0) ? "Increase priority by %d" : "Decrease priority by %d", abs(steps[i]));
if (needServices)
- JCreateServiceParam(svcName, &CJabberProto::OnMenuSetPriority, (LPARAM)steps[i]);
+ CreateServiceParam(svcName, &CJabberProto::OnMenuSetPriority, (LPARAM)steps[i]);
mi.position++;
Menu_AddProtoMenuItem(&mi);
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index b481f8fe28..df48e8c672 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -292,7 +292,7 @@ private: thread->port = m_regInfo->port;
thread->useSSL = m_regInfo->useSSL;
thread->reg_hwndDlg= m_hwnd;
- m_proto->JForkThread((JThreadFunc)&CJabberProto::ServerThread, thread);
+ m_proto->ForkThread((CJabberProto::MyThreadFunc)&CJabberProto::ServerThread, thread);
m_btnOk.SetText(TranslateT("Cancel"));
m_bProcessStarted = true;
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 76679e5517..465d1a87ea 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -2228,7 +2228,7 @@ void CJabberProto::BuildPrivacyMenu() mi.hParentMenu = MO_GetProtoRootMenu(m_szModuleName);
m_hPrivacyMenuRoot = Menu_AddProtoMenuItem(&mi);
- JCreateService("/PrivacyLists", &CJabberProto::OnMenuHandlePrivacyLists);
+ CreateService("/PrivacyLists", &CJabberProto::OnMenuHandlePrivacyLists);
char srvFce[MAX_PATH + 64];
mir_snprintf(srvFce, SIZEOF(srvFce), "%s/PrivacyLists", m_szModuleName);
mi.pszService = srvFce;
@@ -2261,7 +2261,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) mir_snprintf(srvFce, SIZEOF(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
if (i > m_privacyMenuServiceAllocated) {
- JCreateServiceParam(svcName, &CJabberProto::menuSetPrivacyList, i);
+ CreateServiceParam(svcName, &CJabberProto::menuSetPrivacyList, i);
m_privacyMenuServiceAllocated = i;
}
mi.position++;
@@ -2277,7 +2277,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) mir_snprintf(srvFce, SIZEOF(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
if (i > m_privacyMenuServiceAllocated) {
- JCreateServiceParam(svcName, &CJabberProto::menuSetPrivacyList, i);
+ CreateServiceParam(svcName, &CJabberProto::menuSetPrivacyList, i);
m_privacyMenuServiceAllocated = i;
}
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index e03cf896ae..b6ca54517c 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -64,6 +64,7 @@ static int compareListItems(const JABBER_LIST_ITEM *p1, const JABBER_LIST_ITEM * }
CJabberProto::CJabberProto(const char* aProtoName, const TCHAR *aUserName) :
+ PROTO<CJabberProto>(aProtoName, aUserName),
m_options(this),
m_lstTransports(50, compareTransports),
m_lstRoster(50, compareListItems),
@@ -83,8 +84,6 @@ CJabberProto::CJabberProto(const char* aProtoName, const TCHAR *aUserName) : m_lstJabberFeatCapPairsDynamic(2),
m_uEnabledFeatCapsDynamic(0)
{
- ProtoConstructor(this, aProtoName, aUserName);
-
InitializeCriticalSection(&m_csModeMsgMutex);
InitializeCriticalSection(&m_csLists);
InitializeCriticalSection(&m_csLastResourceMap);
@@ -102,50 +101,50 @@ CJabberProto::CJabberProto(const char* aProtoName, const TCHAR *aUserName) : m_windowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
// Protocol services and events...
- m_hEventNudge = JCreateHookableEvent(JE_NUDGE);
- m_hEventXStatusIconChanged = JCreateHookableEvent(JE_CUSTOMSTATUS_EXTRAICON_CHANGED);
- m_hEventXStatusChanged = JCreateHookableEvent(JE_CUSTOMSTATUS_CHANGED);
+ m_hEventNudge = CreateHookableEvent(JE_NUDGE);
+ m_hEventXStatusIconChanged = CreateHookableEvent(JE_CUSTOMSTATUS_EXTRAICON_CHANGED);
+ m_hEventXStatusChanged = CreateHookableEvent(JE_CUSTOMSTATUS_CHANGED);
- JCreateService(PS_CREATEACCMGRUI, &CJabberProto::SvcCreateAccMgrUI);
+ CreateService(PS_CREATEACCMGRUI, &CJabberProto::SvcCreateAccMgrUI);
- JCreateService(PS_GETAVATARINFOT, &CJabberProto::JabberGetAvatarInfo);
- JCreateService(PS_GETMYAWAYMSG, &CJabberProto::GetMyAwayMsg);
- JCreateService(PS_SET_LISTENINGTO, &CJabberProto::OnSetListeningTo);
+ CreateService(PS_GETAVATARINFOT, &CJabberProto::JabberGetAvatarInfo);
+ CreateService(PS_GETMYAWAYMSG, &CJabberProto::GetMyAwayMsg);
+ CreateService(PS_SET_LISTENINGTO, &CJabberProto::OnSetListeningTo);
- JCreateService(PS_JOINCHAT, &CJabberProto::OnJoinChat);
- JCreateService(PS_LEAVECHAT, &CJabberProto::OnLeaveChat);
+ CreateService(PS_JOINCHAT, &CJabberProto::OnJoinChat);
+ CreateService(PS_LEAVECHAT, &CJabberProto::OnLeaveChat);
- JCreateService(PS_GETCUSTOMSTATUSEX, &CJabberProto::OnGetXStatusEx);
- JCreateService(PS_SETCUSTOMSTATUSEX, &CJabberProto::OnSetXStatusEx);
- JCreateService(PS_GETCUSTOMSTATUSICON, &CJabberProto::OnGetXStatusIcon);
- JCreateService(PS_GETADVANCEDSTATUSICON, &CJabberProto::JGetAdvancedStatusIcon);
+ CreateService(PS_GETCUSTOMSTATUSEX, &CJabberProto::OnGetXStatusEx);
+ CreateService(PS_SETCUSTOMSTATUSEX, &CJabberProto::OnSetXStatusEx);
+ CreateService(PS_GETCUSTOMSTATUSICON, &CJabberProto::OnGetXStatusIcon);
+ CreateService(PS_GETADVANCEDSTATUSICON, &CJabberProto::JGetAdvancedStatusIcon);
- JCreateService(JS_HTTP_AUTH, &CJabberProto::OnHttpAuthRequest);
- JCreateService(JS_INCOMING_NOTE_EVENT, &CJabberProto::OnIncomingNoteEvent);
+ CreateService(JS_HTTP_AUTH, &CJabberProto::OnHttpAuthRequest);
+ CreateService(JS_INCOMING_NOTE_EVENT, &CJabberProto::OnIncomingNoteEvent);
- JCreateService(JS_SENDXML, &CJabberProto::ServiceSendXML);
- JCreateService(PS_GETMYAVATART, &CJabberProto::JabberGetAvatar);
- JCreateService(PS_GETAVATARCAPS, &CJabberProto::JabberGetAvatarCaps);
- JCreateService(PS_SETMYAVATART, &CJabberProto::JabberSetAvatar);
- JCreateService(PS_SETMYNICKNAME, &CJabberProto::JabberSetNickname);
+ CreateService(JS_SENDXML, &CJabberProto::ServiceSendXML);
+ CreateService(PS_GETMYAVATART, &CJabberProto::JabberGetAvatar);
+ CreateService(PS_GETAVATARCAPS, &CJabberProto::JabberGetAvatarCaps);
+ CreateService(PS_SETMYAVATART, &CJabberProto::JabberSetAvatar);
+ CreateService(PS_SETMYNICKNAME, &CJabberProto::JabberSetNickname);
- JCreateService(JS_DB_GETEVENTTEXT_CHATSTATES, &CJabberProto::OnGetEventTextChatStates);
- JCreateService(JS_DB_GETEVENTTEXT_PRESENCE, &CJabberProto::OnGetEventTextPresence);
+ CreateService(JS_DB_GETEVENTTEXT_CHATSTATES, &CJabberProto::OnGetEventTextChatStates);
+ CreateService(JS_DB_GETEVENTTEXT_PRESENCE, &CJabberProto::OnGetEventTextPresence);
- JCreateService(JS_GETJABBERAPI, &CJabberProto::JabberGetApi);
+ CreateService(JS_GETJABBERAPI, &CJabberProto::JabberGetApi);
// XEP-0224 support (Attention/Nudge)
- JCreateService(JS_SEND_NUDGE, &CJabberProto::JabberSendNudge);
+ CreateService(JS_SEND_NUDGE, &CJabberProto::JabberSendNudge);
// service to get from protocol chat buddy info
- JCreateService(MS_GC_PROTO_GETTOOLTIPTEXT, &CJabberProto::JabberGCGetToolTipText);
+ CreateService(MS_GC_PROTO_GETTOOLTIPTEXT, &CJabberProto::JabberGCGetToolTipText);
// XMPP URI parser service for "File Association Manager" plugin
- JCreateService(JS_PARSE_XMPP_URI, &CJabberProto::JabberServiceParseXmppURI);
+ CreateService(JS_PARSE_XMPP_URI, &CJabberProto::JabberServiceParseXmppURI);
- JHookEvent(ME_MODERNOPT_INITIALIZE, &CJabberProto::OnModernOptInit);
- JHookEvent(ME_OPT_INITIALISE, &CJabberProto::OnOptionsInit);
- JHookEvent(ME_SKIN2_ICONSCHANGED, &CJabberProto::OnReloadIcons);
+ HookEvent(ME_MODERNOPT_INITIALIZE, &CJabberProto::OnModernOptInit);
+ HookEvent(ME_OPT_INITIALISE, &CJabberProto::OnOptionsInit);
+ HookEvent(ME_SKIN2_ICONSCHANGED, &CJabberProto::OnReloadIcons);
m_iqManager.FillPermanentHandlers();
m_iqManager.Start();
@@ -251,8 +250,6 @@ CJabberProto::~CJabberProto() }
m_lstJabberFeatCapPairsDynamic.destroy();
m_hPrivacyMenuItems.destroy();
-
- ProtoDestructor(this);
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -262,7 +259,7 @@ static COLORREF crCols[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM)
{
- JHookEvent(ME_USERINFO_INITIALISE, &CJabberProto::OnUserInfoInit);
+ HookEvent(ME_USERINFO_INITIALISE, &CJabberProto::OnUserInfoInit);
XStatusInit();
m_pepServices.InitGui();
@@ -281,8 +278,8 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) gcr.pszModule = m_szModuleName;
CallServiceSync(MS_GC_REGISTER, NULL, (LPARAM)&gcr);
- JHookEvent(ME_GC_EVENT, &CJabberProto::JabberGcEventHook);
- JHookEvent(ME_GC_BUILDMENU, &CJabberProto::JabberGcMenuHook);
+ HookEvent(ME_GC_EVENT, &CJabberProto::JabberGcEventHook);
+ HookEvent(ME_GC_BUILDMENU, &CJabberProto::JabberGcMenuHook);
}
HICON hIcon = LoadIconEx("main");
@@ -294,8 +291,8 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) Srmm_AddIcon(&sid);
Skin_ReleaseIcon(hIcon);
- JHookEvent(ME_MSG_ICONPRESSED, &CJabberProto::OnProcessSrmmIconClick);
- JHookEvent(ME_MSG_WINDOWEVENT, &CJabberProto::OnProcessSrmmEvent);
+ HookEvent(ME_MSG_ICONPRESSED, &CJabberProto::OnProcessSrmmIconClick);
+ HookEvent(ME_MSG_WINDOWEVENT, &CJabberProto::OnProcessSrmmEvent);
DBEVENTTYPEDESCR dbEventType = { sizeof(dbEventType) };
dbEventType.module = m_szModuleName;
@@ -307,7 +304,7 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) dbEventType.descr = "Presence notifications";
CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
- JHookEvent(ME_IDLE_CHANGED, &CJabberProto::OnIdleChanged);
+ HookEvent(ME_IDLE_CHANGED, &CJabberProto::OnIdleChanged);
CheckAllContactsAreTransported();
@@ -593,7 +590,7 @@ HANDLE __cdecl CJabberProto::FileAllow(HANDLE /*hContact*/, HANDLE hTransfer, co switch (ft->type) {
case FT_OOB:
- JForkThread((JThreadFunc)&CJabberProto::FileReceiveThread, ft);
+ ForkThread((MyThreadFunc)&CJabberProto::FileReceiveThread, ft);
break;
case FT_BYTESTREAM:
FtAcceptSiRequest(ft);
@@ -869,7 +866,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid) Log("Adding '%s' without validation", jsb->jid);
jsb->hSearch = SerialNext();
- JForkThread((JThreadFunc)&CJabberProto::BasicSearchThread, jsb);
+ ForkThread((MyThreadFunc)&CJabberProto::BasicSearchThread, jsb);
return (HANDLE)jsb->hSearch;
}
@@ -1108,7 +1105,7 @@ HANDLE __cdecl CJabberProto::SendFile(HANDLE hContact, const TCHAR *szDescriptio if (jcb & JABBER_CAPS_SI_FT)
FtInitiate(item->jid, ft);
else if (jcb & JABBER_CAPS_OOB)
- JForkThread((JThreadFunc)&CJabberProto::FileServerThread, ft);
+ ForkThread((MyThreadFunc)&CJabberProto::FileServerThread, ft);
return ft;
}
@@ -1146,7 +1143,7 @@ int __cdecl CJabberProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc ptrT ptszJid( db_get_tsa(hContact, m_szModuleName, "jid"));
if ( !m_bJabberOnline || ptszJid == NULL) {
TFakeAckParams *param = new TFakeAckParams(hContact, Translate("Protocol is offline or no jid"));
- JForkThread(&CJabberProto::SendMessageAckThread, param);
+ ForkThread(&CJabberProto::SendMessageAckThread, param);
return 1;
}
@@ -1223,7 +1220,7 @@ int __cdecl CJabberProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc }
m_ThreadInfo->send(m);
- JForkThread(&CJabberProto::SendMessageAckThread, new TFakeAckParams(hContact, 0, id));
+ ForkThread(&CJabberProto::SendMessageAckThread, new TFakeAckParams(hContact, 0, id));
}
else {
xmlAddAttr(m, _T("to"), szClientJid); xmlAddAttrID(m, id);
@@ -1326,7 +1323,7 @@ int __cdecl CJabberProto::SetStatus(int iNewStatus) m_iStatus = ID_STATUS_CONNECTING;
ThreadData* thread = new ThreadData(this, JABBER_SESSION_NORMAL);
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
- thread->hThread = JForkThreadEx((JThreadFunc)&CJabberProto::ServerThread, thread);
+ thread->hThread = ForkThreadEx((MyThreadFunc)&CJabberProto::ServerThread, thread, 0);
RebuildInfoFrame();
}
@@ -1394,7 +1391,7 @@ HANDLE __cdecl CJabberProto::GetAwayMsg(HANDLE hContact) {
Log("GetAwayMsg called, hContact=%08X", hContact);
- JForkThread(&CJabberProto::GetAwayMsgThread, hContact);
+ ForkThread(&CJabberProto::GetAwayMsgThread, hContact);
return (HANDLE)1;
}
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index c07c79dd1e..848381579d 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -38,10 +38,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "jabber_send_manager.h"
struct CJabberProto;
-typedef void (__cdecl CJabberProto::*JThreadFunc)(void*);
-typedef int (__cdecl CJabberProto::*JEventFunc)(WPARAM, LPARAM);
-typedef INT_PTR (__cdecl CJabberProto::*JServiceFunc)(WPARAM, LPARAM);
-typedef INT_PTR (__cdecl CJabberProto::*JServiceFuncParam)(WPARAM, LPARAM, LPARAM);
enum TJabberGcLogInfoType { INFO_BAN, INFO_STATUS, INFO_CONFIG, INFO_AFFILIATION, INFO_ROLE };
@@ -147,10 +143,8 @@ struct CJabberInterface: public IJabberInterface CJabberProto *m_psProto;
};
-struct CJabberProto : public PROTO_INTERFACE
+struct CJabberProto : public PROTO<CJabberProto>
{
- typedef PROTO_INTERFACE CSuper;
-
CJabberProto(const char*, const TCHAR*);
~CJabberProto();
@@ -789,12 +783,6 @@ struct CJabberProto : public PROTO_INTERFACE //---- jabber_std.cpp ----------------------------------------------
- void JCreateService(const char* szService, JServiceFunc serviceProc);
- void JCreateServiceParam(const char* szService, JServiceFuncParam serviceProc, LPARAM lParam);
- HANDLE JCreateHookableEvent(const char* szService);
- void JForkThread(JThreadFunc, void*);
- HANDLE JForkThreadEx(JThreadFunc, void*, UINT* threadID = NULL);
-
void JDeleteSetting(HANDLE hContact, const char* valueName);
DWORD JGetByte(HANDLE hContact, const char* valueName, int parDefltValue);
DWORD JGetDword(HANDLE hContact, const char* valueName, DWORD parDefltValue);
@@ -805,7 +793,6 @@ struct CJabberProto : public PROTO_INTERFACE TCHAR *JGetStringT(HANDLE hContact, char* valueName, TCHAR *&out);
TCHAR *JGetStringT(HANDLE hContact, char* valueName, TCHAR *buf, int size);
WORD JGetWord(HANDLE hContact, const char* valueName, int parDefltValue);
- void JHookEvent(const char*, JEventFunc);
void JLoginFailed(int errorCode);
DWORD JSetByte(HANDLE hContact, const char* valueName, int parValue);
DWORD JSetDword(HANDLE hContact, const char* valueName, DWORD parValue);
diff --git a/protocols/JabberG/src/jabber_std.cpp b/protocols/JabberG/src/jabber_std.cpp index 559950cace..4eff7b90c9 100644 --- a/protocols/JabberG/src/jabber_std.cpp +++ b/protocols/JabberG/src/jabber_std.cpp @@ -23,47 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "jabber.h"
-void CJabberProto::JCreateService(const char* szService, JServiceFunc serviceProc)
-{
- char str[ MAXMODULELABELLENGTH ];
- strcpy(str, m_szModuleName);
- strcat(str, szService);
- ::CreateServiceFunctionObj(str, (MIRANDASERVICEOBJ)*(void**)&serviceProc, this);
-}
-
-void CJabberProto::JCreateServiceParam(const char* szService, JServiceFuncParam serviceProc, LPARAM lParam)
-{
- char str[ MAXMODULELABELLENGTH ];
- strcpy(str, m_szModuleName);
- strcat(str, szService);
- ::CreateServiceFunctionObjParam(str, (MIRANDASERVICEOBJPARAM)*(void**)&serviceProc, this, lParam);
-}
-
-void CJabberProto::JHookEvent(const char* szEvent, JEventFunc handler)
-{
- ::HookEventObj(szEvent, (MIRANDAHOOKOBJ)*(void**)&handler, this);
-}
-
-HANDLE CJabberProto::JCreateHookableEvent(const char* szService)
-{
- char str[ MAXMODULELABELLENGTH ];
- strcpy(str, m_szModuleName);
- strcat(str, szService);
- return CreateHookableEvent(str);
-}
-
-void CJabberProto::JForkThread(JThreadFunc pFunc, void *param)
-{
- UINT threadID;
- CloseHandle((HANDLE)::mir_forkthreadowner((pThreadFuncOwner) *(void**)&pFunc, this, param, &threadID));
-}
-
-HANDLE CJabberProto::JForkThreadEx(JThreadFunc pFunc, void *param, UINT* threadID)
-{
- UINT lthreadID;
- return (HANDLE)::mir_forkthreadowner((pThreadFuncOwner) *(void**)&pFunc, this, param, threadID ? threadID : <hreadID);
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
void CJabberProto::JDeleteSetting(HANDLE hContact, const char* valueName)
|