summaryrefslogtreecommitdiff
path: root/protocols/IcqOscarJ
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-03 17:32:37 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-03 17:32:37 +0000
commit31b191bc8ddb639e488ab8306f71ac1dbabf16f0 (patch)
treeaa661023372aa18381e46c7f6fcecf67856ac8ae /protocols/IcqOscarJ
parent6ba829af4e0c008865675b67b868f33d8e7641df (diff)
removing built-in Clist Modern extra icons part I
git-svn-id: http://svn.miranda-ng.org/main/trunk@2167 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IcqOscarJ')
-rw-r--r--protocols/IcqOscarJ/icqoscar8_10.vcxproj.filters4
-rw-r--r--protocols/IcqOscarJ/src/globals.h2
-rw-r--r--protocols/IcqOscarJ/src/icq_proto.cpp24
-rw-r--r--protocols/IcqOscarJ/src/icq_proto.h2
-rw-r--r--protocols/IcqOscarJ/src/icq_xstatus.cpp81
-rw-r--r--protocols/IcqOscarJ/src/init.cpp50
6 files changed, 28 insertions, 135 deletions
diff --git a/protocols/IcqOscarJ/icqoscar8_10.vcxproj.filters b/protocols/IcqOscarJ/icqoscar8_10.vcxproj.filters
index 3917331d49..8d5fae987d 100644
--- a/protocols/IcqOscarJ/icqoscar8_10.vcxproj.filters
+++ b/protocols/IcqOscarJ/icqoscar8_10.vcxproj.filters
@@ -21,10 +21,6 @@
<Filter Include="Miranda Bits">
<UniqueIdentifier>{33754d1e-5911-4ebf-bbb2-f7f9ac930bb5}</UniqueIdentifier>
</Filter>
- <Filter Include="Documentation">
- <UniqueIdentifier>{a21400e8-a7db-41a3-9bae-b2f9e0bde49a}</UniqueIdentifier>
- <Extensions>.txt</Extensions>
- </Filter>
<Filter Include="UI">
<UniqueIdentifier>{b50a315e-0455-4a42-8aa6-e73618237ff3}</UniqueIdentifier>
</Filter>
diff --git a/protocols/IcqOscarJ/src/globals.h b/protocols/IcqOscarJ/src/globals.h
index c0d8326689..f179110030 100644
--- a/protocols/IcqOscarJ/src/globals.h
+++ b/protocols/IcqOscarJ/src/globals.h
@@ -38,6 +38,8 @@ typedef char uid_str[MAX_PATH];
extern HINSTANCE hInst;
extern DWORD MIRANDA_VERSION;
+extern HANDLE hExtraXStatus;
+
extern IcqIconHandle hStaticIcons[];
extern const int moodXStatus[];
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp
index 77f86c6133..cf91ecb38d 100644
--- a/protocols/IcqOscarJ/src/icq_proto.cpp
+++ b/protocols/IcqOscarJ/src/icq_proto.cpp
@@ -32,7 +32,6 @@
#include "m_icolib.h"
extern PLUGININFOEX pluginInfo;
-extern HANDLE hExtraXStatus;
#pragma warning(disable:4355)
@@ -340,25 +339,14 @@ int CIcqProto::OnModulesLoaded( WPARAM wParam, LPARAM lParam )
InitPopUps();
InitXStatusItems(FALSE);
- if (hExtraXStatus == NULL)
+ HANDLE hContact = FindFirstContact();
+ while (hContact != NULL)
{
- if (HookProtoEvent(ME_CLIST_EXTRA_LIST_REBUILD, &CIcqProto::CListMW_ExtraIconsRebuild))
- { // note if the Hook was successful (e.g. clist_nicer creates them too late)
- HookProtoEvent(ME_CLIST_EXTRA_IMAGE_APPLY, &CIcqProto::CListMW_ExtraIconsApply);
- bXStatusExtraIconsReady = 1;
- }
- }
- else
- {
- HANDLE hContact = FindFirstContact();
- while (hContact != NULL)
- {
- DWORD bXStatus = getContactXStatus(hContact);
- if (bXStatus > 0)
- setContactExtraIcon(hContact, bXStatus);
+ DWORD bXStatus = getContactXStatus(hContact);
+ if (bXStatus > 0)
+ setContactExtraIcon(hContact, bXStatus);
- hContact = FindNextContact(hContact);
- }
+ hContact = FindNextContact(hContact);
}
return 0;
diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h
index aa903689ad..597b66a2e1 100644
--- a/protocols/IcqOscarJ/src/icq_proto.h
+++ b/protocols/IcqOscarJ/src/icq_proto.h
@@ -152,8 +152,6 @@ struct CIcqProto : public PROTO_INTERFACE, public MZeroedObject
void __cdecl OnRenameGroup( DBCONTACTWRITESETTING* cws, HANDLE hContact );
int __cdecl OnUserInfoInit( WPARAM, LPARAM );
- int __cdecl CListMW_ExtraIconsRebuild( WPARAM, LPARAM );
- int __cdecl CListMW_ExtraIconsApply( WPARAM, LPARAM );
int __cdecl OnPreBuildStatusMenu( WPARAM, LPARAM );
//====| Data |========================================================================
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp
index b567105dbe..95dc43dd43 100644
--- a/protocols/IcqOscarJ/src/icq_xstatus.cpp
+++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp
@@ -31,9 +31,6 @@
#include "m_extraicons.h"
#include "..\icons_pack\src\resource.h"
-
-extern HANDLE hExtraXStatus;
-
void CListShowMenuItem(HANDLE hMenuItem, BYTE bShow);
BYTE CIcqProto::getContactXStatus(HANDLE hContact)
@@ -187,79 +184,15 @@ void CIcqProto::releaseXStatusIcon(int bStatus, UINT flags)
void CIcqProto::setContactExtraIcon(HANDLE hContact, int xstatus)
{
- HANDLE hIcon;
-
- if (hExtraXStatus == NULL)
- {
- if (xstatus > 0 && bXStatusExtraIconsReady < 2)
- CListMW_ExtraIconsRebuild(0, 0);
-
- hIcon = (xstatus <= 0 ? (HANDLE)-1 : hXStatusExtraIcons[xstatus-1]);
-
- IconExtraColumn iec;
-
- iec.cbSize = sizeof(iec);
- iec.hImage = hIcon;
- iec.ColumnType = EXTRA_ICON_ADV1;
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
+ if (xstatus <= 0)
+ ExtraIcon_SetIcon(hExtraXStatus, hContact, (char *) NULL);
+ else {
+ char szTemp[MAX_PATH];
+ null_snprintf(szTemp, sizeof(szTemp), "%s_xstatus%d", m_szModuleName, xstatus-1);
+ ExtraIcon_SetIcon(hExtraXStatus, hContact, szTemp);
}
- else
- {
- hIcon = (HANDLE) -1;
-
- if (xstatus <= 0)
- {
- ExtraIcon_SetIcon(hExtraXStatus, hContact, (char *) NULL);
- }
- else
- {
- char szTemp[MAX_PATH];
- null_snprintf(szTemp, sizeof(szTemp), "%s_xstatus%d", m_szModuleName, xstatus-1);
- ExtraIcon_SetIcon(hExtraXStatus, hContact, szTemp);
- }
- }
-
- NotifyEventHooks(hxstatusiconchanged, (WPARAM)hContact, (LPARAM)hIcon);
-}
-
-int CIcqProto::CListMW_ExtraIconsRebuild(WPARAM wParam, LPARAM lParam)
-{
- if ((m_bXStatusEnabled || m_bMoodsEnabled) && ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
- {
- for (int i = 0; i < XSTATUS_COUNT; i++)
- {
- hXStatusExtraIcons[i] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)getXStatusIcon(i + 1, LR_SHARED), 0);
- releaseXStatusIcon(i + 1, 0);
- }
-
- if (!bXStatusExtraIconsReady)
- { // try to hook the events again if they did not existed during init
- HookProtoEvent(ME_CLIST_EXTRA_LIST_REBUILD, &CIcqProto::CListMW_ExtraIconsRebuild);
- HookProtoEvent(ME_CLIST_EXTRA_IMAGE_APPLY, &CIcqProto::CListMW_ExtraIconsApply);
- }
-
- bXStatusExtraIconsReady = 2;
- }
- return 0;
-}
-
-
-int CIcqProto::CListMW_ExtraIconsApply(WPARAM wParam, LPARAM lParam)
-{
- if ((m_bXStatusEnabled || m_bMoodsEnabled) && ServiceExists(MS_CLIST_EXTRA_SET_ICON))
- {
- if (IsICQContact((HANDLE)wParam))
- {
- // only apply icons to our contacts, do not mess others
- DWORD bXStatus = getContactXStatus((HANDLE)wParam);
-
- if ((m_bXStatusEnabled && CheckContactCapabilities((HANDLE)wParam, CAPF_XSTATUS)) ||
- (m_bMoodsEnabled && CheckContactCapabilities((HANDLE)wParam, CAPF_STATUS_MOOD)))
- setContactExtraIcon((HANDLE)wParam, bXStatus);
- }
- }
- return 0;
+ NotifyEventHooks(hxstatusiconchanged, (WPARAM)hContact, (LPARAM)INVALID_HANDLE_VALUE);
}
#define NULLCAP {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp
index 450ea73b16..ab4bae973a 100644
--- a/protocols/IcqOscarJ/src/init.cpp
+++ b/protocols/IcqOscarJ/src/init.cpp
@@ -33,10 +33,8 @@
HINSTANCE hInst;
int hLangpack;
-HANDLE hStaticServices[1];
IcqIconHandle hStaticIcons[4];
-HANDLE hStaticHooks[1];;
-HANDLE hExtraXStatus = NULL;
+HANDLE hExtraXStatus;
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -73,7 +71,6 @@ static PROTO_INTERFACE* icqProtoInit( const char* pszProtoName, const TCHAR* tsz
return ppro;
}
-
static int icqProtoUninit( PROTO_INTERFACE* ppro )
{
g_Instances.remove(( CIcqProto* )ppro);
@@ -81,14 +78,6 @@ static int icqProtoUninit( PROTO_INTERFACE* ppro )
return 0;
}
-
-static int OnModulesLoaded( WPARAM, LPARAM )
-{
- hExtraXStatus = ExtraIcon_Register("xstatus", "ICQ XStatus");
- return 0;
-}
-
-
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP( &pluginInfo );
@@ -109,22 +98,20 @@ extern "C" int __declspec(dllexport) Load(void)
InitI18N();
// Register static services
- hStaticServices[0] = CreateServiceFunction(ICQ_DB_GETEVENTTEXT_MISSEDMESSAGE, icq_getEventTextMissedMessage);
+ CreateServiceFunction(ICQ_DB_GETEVENTTEXT_MISSEDMESSAGE, icq_getEventTextMissedMessage);
- {
- // Define global icons
- char szSectionName[MAX_PATH];
- null_snprintf(szSectionName, sizeof(szSectionName), "Protocols/%s", ICQ_PROTOCOL_NAME);
-
- TCHAR lib[MAX_PATH];
- GetModuleFileName(hInst, lib, MAX_PATH);
- hStaticIcons[ISI_AUTH_REQUEST] = IconLibDefine(LPGEN("Request authorization"), szSectionName, NULL, "req_auth", lib, -IDI_AUTH_ASK);
- hStaticIcons[ISI_AUTH_GRANT] = IconLibDefine(LPGEN("Grant authorization"), szSectionName, NULL, "grant_auth", lib, -IDI_AUTH_GRANT);
- hStaticIcons[ISI_AUTH_REVOKE] = IconLibDefine(LPGEN("Revoke authorization"), szSectionName, NULL, "revoke_auth", lib, -IDI_AUTH_REVOKE);
- hStaticIcons[ISI_ADD_TO_SERVLIST] = IconLibDefine(LPGEN("Add to server list"), szSectionName, NULL, "add_to_server", lib, -IDI_SERVLIST_ADD);
- }
+ // Define global icons
+ char szSectionName[MAX_PATH];
+ null_snprintf(szSectionName, sizeof(szSectionName), "Protocols/%s", ICQ_PROTOCOL_NAME);
- hStaticHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ TCHAR lib[MAX_PATH];
+ GetModuleFileName(hInst, lib, MAX_PATH);
+ hStaticIcons[ISI_AUTH_REQUEST] = IconLibDefine(LPGEN("Request authorization"), szSectionName, NULL, "req_auth", lib, -IDI_AUTH_ASK);
+ hStaticIcons[ISI_AUTH_GRANT] = IconLibDefine(LPGEN("Grant authorization"), szSectionName, NULL, "grant_auth", lib, -IDI_AUTH_GRANT);
+ hStaticIcons[ISI_AUTH_REVOKE] = IconLibDefine(LPGEN("Revoke authorization"), szSectionName, NULL, "revoke_auth", lib, -IDI_AUTH_REVOKE);
+ hStaticIcons[ISI_ADD_TO_SERVLIST] = IconLibDefine(LPGEN("Add to server list"), szSectionName, NULL, "add_to_server", lib, -IDI_SERVLIST_ADD);
+
+ hExtraXStatus = ExtraIcon_Register("xstatus", "ICQ XStatus");
g_MenuInit();
return 0;
@@ -139,21 +126,10 @@ extern "C" int __declspec(dllexport) Unload(void)
for (i = 0; i < SIZEOF(hStaticIcons); i++)
IconLibRemove(&hStaticIcons[i]);
- // Release static event hooks
- for (i = 0; i < SIZEOF(hStaticHooks); i++)
- if (hStaticHooks[i])
- UnhookEvent(hStaticHooks[i]);
-
// destroying contact menu
g_MenuUninit();
- // Destroy static service functions
- for (i = 0; i < SIZEOF(hStaticServices); i++)
- if (hStaticServices[i])
- DestroyServiceFunction(hStaticServices[i]);
-
g_Instances.destroy();
-
return 0;
}