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/IcqOscarJ/src/icq_proto.cpp | |
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/IcqOscarJ/src/icq_proto.cpp')
-rw-r--r-- | protocols/IcqOscarJ/src/icq_proto.cpp | 68 |
1 files changed, 32 insertions, 36 deletions
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index f25d21827a..cb5ee9948e 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -71,14 +71,13 @@ static int CompareContactsCache(const icq_contacts_cache *p1, const icq_contacts }
CIcqProto::CIcqProto( const char* aProtoName, const TCHAR* aUserName ) :
+ PROTO<CIcqProto>(aProtoName, aUserName),
cookies(10, CompareCookies),
directConns(10, CompareConns),
expectedFileRecvs(10, CompareFT),
contactsCache(10, CompareContactsCache),
- cheekySearchId( -1 )
+ cheekySearchId(-1)
{
- ProtoConstructor(this, aProtoName, aUserName);
-
NetLog_Server( "Setting protocol/module name to '%s'", m_szModuleName );
oftMutex = new icq_critical_section();
@@ -90,7 +89,7 @@ CIcqProto::CIcqProto( const char* aProtoName, const TCHAR* aUserName ) : // Initialize server lists
servlistMutex = new icq_critical_section();
servlistQueueMutex = new icq_critical_section();
- HookProtoEvent(ME_CLIST_GROUPCHANGE, &CIcqProto::ServListCListGroupChange);
+ HookEvent(ME_CLIST_GROUPCHANGE, &CIcqProto::ServListCListGroupChange);
// Initialize status message struct
ZeroMemory(&m_modeMsgs, sizeof(icq_mode_messages));
@@ -98,7 +97,7 @@ CIcqProto::CIcqProto( const char* aProtoName, const TCHAR* aUserName ) : connectionHandleMutex = new icq_critical_section();
localSeqMutex = new icq_critical_section();
- m_modeMsgsEvent = CreateProtoEvent(ME_ICQ_STATUSMSGREQ);
+ m_modeMsgsEvent = CreateHookableEvent(ME_ICQ_STATUSMSGREQ);
// Initialize cookies
cookieMutex = new icq_critical_section();
@@ -123,42 +122,42 @@ CIcqProto::CIcqProto( const char* aProtoName, const TCHAR* aUserName ) : db_set_resident(m_szModuleName, DBSETTING_STATUS_MOOD);
// Setup services
- CreateProtoService(PS_CREATEACCMGRUI, &CIcqProto::OnCreateAccMgrUI );
- CreateProtoService(MS_ICQ_SENDSMS, &CIcqProto::SendSms);
- CreateProtoService(PS_SET_NICKNAME, &CIcqProto::SetNickName);
+ CreateService(PS_CREATEACCMGRUI, &CIcqProto::OnCreateAccMgrUI );
+ CreateService(MS_ICQ_SENDSMS, &CIcqProto::SendSms);
+ CreateService(PS_SET_NICKNAME, &CIcqProto::SetNickName);
- CreateProtoService(PS_GETMYAWAYMSG, &CIcqProto::GetMyAwayMsg);
+ CreateService(PS_GETMYAWAYMSG, &CIcqProto::GetMyAwayMsg);
- CreateProtoService(PS_GETINFOSETTING, &CIcqProto::GetInfoSetting);
+ CreateService(PS_GETINFOSETTING, &CIcqProto::GetInfoSetting);
- CreateProtoService(PSS_ADDED, &CIcqProto::SendYouWereAdded);
+ CreateService(PSS_ADDED, &CIcqProto::SendYouWereAdded);
// Session password API
- CreateProtoService(PS_ICQ_SETPASSWORD, &CIcqProto::SetPassword);
+ CreateService(PS_ICQ_SETPASSWORD, &CIcqProto::SetPassword);
// ChangeInfo API
- CreateProtoService(PS_CHANGEINFOEX, &CIcqProto::ChangeInfoEx);
+ CreateService(PS_CHANGEINFOEX, &CIcqProto::ChangeInfoEx);
// Avatar API
- CreateProtoService(PS_GETAVATARINFOT, &CIcqProto::GetAvatarInfo);
- CreateProtoService(PS_GETAVATARCAPS, &CIcqProto::GetAvatarCaps);
- CreateProtoService(PS_GETMYAVATART, &CIcqProto::GetMyAvatar);
- CreateProtoService(PS_SETMYAVATART, &CIcqProto::SetMyAvatar);
+ CreateService(PS_GETAVATARINFOT, &CIcqProto::GetAvatarInfo);
+ CreateService(PS_GETAVATARCAPS, &CIcqProto::GetAvatarCaps);
+ CreateService(PS_GETMYAVATART, &CIcqProto::GetMyAvatar);
+ CreateService(PS_SETMYAVATART, &CIcqProto::SetMyAvatar);
// Custom Status API
- CreateProtoService(PS_SETCUSTOMSTATUSEX, &CIcqProto::SetXStatusEx);
- CreateProtoService(PS_GETCUSTOMSTATUSEX, &CIcqProto::GetXStatusEx);
- CreateProtoService(PS_GETCUSTOMSTATUSICON, &CIcqProto::GetXStatusIcon);
- CreateProtoService(PS_GETADVANCEDSTATUSICON, &CIcqProto::RequestAdvStatusIconIdx);
- CreateProtoService(PS_ICQ_REQUESTCUSTOMSTATUS, &CIcqProto::RequestXStatusDetails);
+ CreateService(PS_SETCUSTOMSTATUSEX, &CIcqProto::SetXStatusEx);
+ CreateService(PS_GETCUSTOMSTATUSEX, &CIcqProto::GetXStatusEx);
+ CreateService(PS_GETCUSTOMSTATUSICON, &CIcqProto::GetXStatusIcon);
+ CreateService(PS_GETADVANCEDSTATUSICON, &CIcqProto::RequestAdvStatusIconIdx);
+ CreateService(PS_ICQ_REQUESTCUSTOMSTATUS, &CIcqProto::RequestXStatusDetails);
- CreateProtoService(MS_ICQ_ADDSERVCONTACT, &CIcqProto::AddServerContact);
+ CreateService(MS_ICQ_ADDSERVCONTACT, &CIcqProto::AddServerContact);
- CreateProtoService(MS_REQ_AUTH, &CIcqProto::RequestAuthorization);
- CreateProtoService(MS_GRANT_AUTH, &CIcqProto::GrantAuthorization);
- CreateProtoService(MS_REVOKE_AUTH, &CIcqProto::RevokeAuthorization);
+ CreateService(MS_REQ_AUTH, &CIcqProto::RequestAuthorization);
+ CreateService(MS_GRANT_AUTH, &CIcqProto::GrantAuthorization);
+ CreateService(MS_REVOKE_AUTH, &CIcqProto::RevokeAuthorization);
- CreateProtoService(MS_XSTATUS_SHOWDETAILS, &CIcqProto::ShowXStatusDetails);
+ CreateService(MS_XSTATUS_SHOWDETAILS, &CIcqProto::ShowXStatusDetails);
// Custom caps
- CreateProtoService(PS_ICQ_ADDCAPABILITY, &CIcqProto::IcqAddCapability);
- CreateProtoService(PS_ICQ_CHECKCAPABILITY, &CIcqProto::IcqCheckCapability);
+ CreateService(PS_ICQ_ADDCAPABILITY, &CIcqProto::IcqAddCapability);
+ CreateService(PS_ICQ_CHECKCAPABILITY, &CIcqProto::IcqCheckCapability);
// Reset a bunch of session specific settings
UpdateGlobalSettings();
@@ -170,7 +169,7 @@ CIcqProto::CIcqProto( const char* aProtoName, const TCHAR* aUserName ) : // Startup Auto Info-Update thread
icq_InitInfoUpdate();
- HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &CIcqProto::OnPreBuildStatusMenu);
+ HookEvent(ME_CLIST_PREBUILDSTATUSMENU, &CIcqProto::OnPreBuildStatusMenu);
// Register netlib users
NETLIBUSER nlu = {0};
@@ -265,14 +264,11 @@ CIcqProto::~CIcqProto() SAFE_FREE(&m_modeMsgs.szFfc);
NetLog_Server("%s: Protocol instance '%s' destroyed.", ICQ_PROTOCOL_NAME, m_szModuleName);
- ProtoDestructor(this);
}
-
////////////////////////////////////////////////////////////////////////////////////////
// OnModulesLoadedEx - performs hook registration
-
int CIcqProto::OnModulesLoaded( WPARAM wParam, LPARAM lParam )
{
char pszP2PName[MAX_PATH];
@@ -289,9 +285,9 @@ int CIcqProto::OnModulesLoaded( WPARAM wParam, LPARAM lParam ) modules[3] = pszSrvGroupsName;
CallService("DBEditorpp/RegisterModule",(WPARAM)modules,(LPARAM)4);
- HookProtoEvent(ME_OPT_INITIALISE, &CIcqProto::OnOptionsInit);
- HookProtoEvent(ME_USERINFO_INITIALISE, &CIcqProto::OnUserInfoInit);
- HookProtoEvent(ME_IDLE_CHANGED, &CIcqProto::OnIdleChanged);
+ HookEvent(ME_OPT_INITIALISE, &CIcqProto::OnOptionsInit);
+ HookEvent(ME_USERINFO_INITIALISE, &CIcqProto::OnUserInfoInit);
+ HookEvent(ME_IDLE_CHANGED, &CIcqProto::OnIdleChanged);
InitAvatars();
|