summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-03 20:16:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-03 20:16:42 +0000
commitf12d8b56f2894e94491bd7424d69f595d285f01f (patch)
tree3f54d66c8c248bb456da1cb0c5cc31661f144e5f /protocols
parent1b1a54dc156bec90be3ddc337c17b4e67179d4ea (diff)
no more MS_CLIST_EXTRA_ADD_ICON in the application code
git-svn-id: http://svn.miranda-ng.org/main/trunk@2175 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/AimOscar/src/aim.cpp8
-rw-r--r--protocols/AimOscar/src/theme.cpp121
-rw-r--r--protocols/AimOscar/src/theme.h2
-rw-r--r--protocols/AimOscar/src/utility.h1
-rw-r--r--protocols/JabberG/src/jabber.cpp1
-rw-r--r--protocols/JabberG/src/jabber.h2
-rw-r--r--protocols/JabberG/src/jabber_icolib.cpp54
-rw-r--r--protocols/JabberG/src/jabber_icolib.h5
-rw-r--r--protocols/JabberG/src/jabber_proto.h2
-rw-r--r--protocols/JabberG/src/jabber_xstatus.cpp49
-rw-r--r--protocols/MRA/src/Mra.h2
-rw-r--r--protocols/MRA/src/MraProto.cpp13
-rw-r--r--protocols/MRA/src/MraProto.h1
-rw-r--r--protocols/MRA/src/Mra_functions.cpp12
-rw-r--r--protocols/MRA/src/Mra_svcs.cpp15
-rw-r--r--protocols/Quotes/src/ExtraImages.cpp122
-rw-r--r--protocols/Quotes/src/ExtraImages.h1
-rw-r--r--protocols/Quotes/src/Forex.cpp7
18 files changed, 53 insertions, 365 deletions
diff --git a/protocols/AimOscar/src/aim.cpp b/protocols/AimOscar/src/aim.cpp
index 1cc9482e14..32ce3f8c58 100644
--- a/protocols/AimOscar/src/aim.cpp
+++ b/protocols/AimOscar/src/aim.cpp
@@ -21,13 +21,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
char AIM_CAP_MIRANDA[16] = "MirandaA";
-
int hLangpack;
HINSTANCE hInstance;
-static HANDLE hMooduleLoaded;
-
/////////////////////////////////////////////////////////////////////////////
// Protocol instances
static int sttCompareProtocols(const CAimProto *p1, const CAimProto *p2)
@@ -108,7 +105,7 @@ extern "C" int __declspec(dllexport) Load(void)
mir_getLP(&pluginInfo);
- hMooduleLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
PROTOCOLDESCRIPTOR pd = {0};
pd.cbSize = sizeof(pd);
@@ -130,8 +127,5 @@ extern "C" int __declspec(dllexport) Load(void)
extern "C" int __declspec(dllexport) Unload(void)
{
aim_links_destroy();
- UnhookEvent(hMooduleLoaded);
-
- DestroyExtraIcons();
return 0;
}
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp
index cec3df5708..9ba7307d0d 100644
--- a/protocols/AimOscar/src/theme.cpp
+++ b/protocols/AimOscar/src/theme.cpp
@@ -139,7 +139,6 @@ extern OBJLIST<CAimProto> g_Instances;
static HANDLE bot_icon, icq_icon, aol_icon, hiptop_icon;
static HANDLE admin_icon, confirmed_icon, unconfirmed_icon;
-static HANDLE hListRebuld, hIconApply;
static HANDLE hExtraAT, hExtraES;
static const char* extra_AT_icon_name[5] =
@@ -160,48 +159,14 @@ static const char* extra_ES_icon_name[2] =
static HANDLE extra_AT_icon_handle[5];
static HANDLE extra_ES_icon_handle[2];
-static void load_extra_icons(void)
-{
- if (!ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) return;
-
- unsigned i;
-
- for (i = 0; i < SIZEOF(extra_AT_icon_handle); ++i)
- {
- extra_AT_icon_handle[i] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)LoadIconEx(extra_AT_icon_name[i]), 0);
- ReleaseIconEx(extra_AT_icon_name[i]);
- }
-
- for (i = 0; i < SIZEOF(extra_ES_icon_handle); ++i)
- {
- extra_ES_icon_handle[i] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)LoadIconEx(extra_ES_icon_name[i]), 0);
- ReleaseIconEx(extra_ES_icon_name[i]);
- }
-}
-
-static void set_extra_icon(HANDLE hContact, HANDLE hImage, int column_type)
-{
- IconExtraColumn iec;
- iec.cbSize = sizeof(iec);
- iec.hImage = hImage;
- iec.ColumnType = column_type;
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
-}
-
static void clear_AT_icon(HANDLE hContact)
{
- if (hExtraAT)
- ExtraIcon_SetIcon(hExtraAT, hContact, (char*)NULL);
- else
- set_extra_icon(hContact, (HANDLE)-1, EXTRA_ICON_ADV2);
+ ExtraIcon_SetIcon(hExtraAT, hContact, (char*)NULL);
}
static void clear_ES_icon(HANDLE hContact)
{
- if (hExtraES)
- ExtraIcon_SetIcon(hExtraES, hContact, (char*)NULL);
- else
- set_extra_icon(hContact, (HANDLE)-1, EXTRA_ICON_ADV3);
+ ExtraIcon_SetIcon(hExtraES, hContact, (char*)NULL);
}
static void set_AT_icon(CAimProto* ppro, HANDLE hContact)
@@ -210,19 +175,12 @@ static void set_AT_icon(CAimProto* ppro, HANDLE hContact)
unsigned i = ppro->getByte(hContact, AIM_KEY_AC, 0) - 1;
- if (hExtraAT)
- {
- if (i < 5)
- {
- char name[64];
- mir_snprintf(name, sizeof(name), "AIM_%s", extra_AT_icon_name[i]);
- ExtraIcon_SetIcon(hExtraAT, hContact, name);
- }
- else
- ExtraIcon_SetIcon(hExtraAT, hContact, (char*)NULL);
+ if (i < 5) {
+ char name[64];
+ mir_snprintf(name, sizeof(name), "AIM_%s", extra_AT_icon_name[i]);
+ ExtraIcon_SetIcon(hExtraAT, hContact, name);
}
- else
- set_extra_icon(hContact, i < 5 ? extra_AT_icon_handle[i] : (HANDLE)-1, EXTRA_ICON_ADV2);
+ else ExtraIcon_SetIcon(hExtraAT, hContact, (char*)NULL);
}
static void set_ES_icon(CAimProto* ppro, HANDLE hContact)
@@ -231,19 +189,12 @@ static void set_ES_icon(CAimProto* ppro, HANDLE hContact)
unsigned i = ppro->getByte(hContact, AIM_KEY_ET, 0) - 1;
- if (hExtraES)
- {
- if (i < 2)
- {
- char name[64];
- mir_snprintf(name, sizeof(name), "AIM_%s", extra_ES_icon_name[i]);
- ExtraIcon_SetIcon(hExtraES, hContact, name);
- }
- else
- ExtraIcon_SetIcon(hExtraES, hContact, (char*)NULL);
+ if (i < 2) {
+ char name[64];
+ mir_snprintf(name, sizeof(name), "AIM_%s", extra_ES_icon_name[i]);
+ ExtraIcon_SetIcon(hExtraES, hContact, name);
}
- else
- set_extra_icon(hContact, i < 2 ? extra_ES_icon_handle[i] : (HANDLE)-1, EXTRA_ICON_ADV3);
+ else ExtraIcon_SetIcon(hExtraES, hContact, (char*)NULL);
}
void set_contact_icon(CAimProto* ppro, HANDLE hContact)
@@ -252,37 +203,8 @@ void set_contact_icon(CAimProto* ppro, HANDLE hContact)
if (!ppro->getByte(AIM_KEY_ES, 0)) set_ES_icon(ppro, hContact);
}
-static int OnExtraIconsRebuild(WPARAM /*wParam*/, LPARAM /*lParam*/)
-{
- load_extra_icons();
- return 0;
-}
-
-static int OnExtraIconsApply(WPARAM wParam, LPARAM /*lParam*/)
-{
- if (!ServiceExists(MS_CLIST_EXTRA_SET_ICON)) return 0;
-
- HANDLE hContact = (HANDLE)wParam;
-
- CAimProto *ppro = NULL;
- for (int i = 0; i < g_Instances.getCount(); ++i)
- {
- if (g_Instances[i].is_my_contact(hContact))
- {
- ppro = &g_Instances[i];
- break;
- }
- }
-
- if (ppro) set_contact_icon(ppro, hContact);
-
- return 0;
-}
-
void remove_AT_icons(CAimProto* ppro)
{
- if (!ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) return;
-
HANDLE hContact = db_find_first();
while (hContact)
{
@@ -295,8 +217,6 @@ void remove_AT_icons(CAimProto* ppro)
void remove_ES_icons(CAimProto* ppro)
{
- if (!ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) return;
-
HANDLE hContact = db_find_first();
while (hContact)
{
@@ -334,18 +254,6 @@ void InitExtraIcons(void)
{
hExtraAT = ExtraIcon_Register("aimaccounttype", LPGEN("AIM Account Type"), "AIM_aol");
hExtraES = ExtraIcon_Register("aimextstatus", LPGEN("AIM Extended Status"), "AIM_hiptop");
-
- if (hExtraAT == NULL)
- {
- hListRebuld = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, OnExtraIconsRebuild);
- hIconApply = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnExtraIconsApply);
- }
-}
-
-void DestroyExtraIcons(void)
-{
- UnhookEvent(hIconApply);
- UnhookEvent(hListRebuld);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -371,11 +279,6 @@ void InitThemeSupport(void)
}
}
-void DestroyThemeSupport(void)
-{
- DestroyExtraIcons();
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// OnPreBuildContactMenu
diff --git a/protocols/AimOscar/src/theme.h b/protocols/AimOscar/src/theme.h
index 41b098aff6..09566479ad 100644
--- a/protocols/AimOscar/src/theme.h
+++ b/protocols/AimOscar/src/theme.h
@@ -28,8 +28,6 @@ void InitThemeSupport(void);
void InitIcons(void);
void InitExtraIcons(void);
-void DestroyExtraIcons(void);
-
HICON LoadIconEx(const char* name, bool big = false);
HANDLE GetIconHandle(const char* name);
void ReleaseIconEx(const char* name, bool big = false);
diff --git a/protocols/AimOscar/src/utility.h b/protocols/AimOscar/src/utility.h
index a6608d38f3..447d78538e 100644
--- a/protocols/AimOscar/src/utility.h
+++ b/protocols/AimOscar/src/utility.h
@@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
char *normalize_name(const char *s);
char* trim_str(char* s);
void create_group(const char *group);
-void set_extra_icon(HANDLE hContact, HANDLE hImage, int column_type);
unsigned int aim_oft_checksum_file(TCHAR *filename, unsigned __int64 size = -1);
char* long_ip_to_char_ip(unsigned long host, char* ip);
unsigned long char_ip_to_long_ip(char* ip);
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp
index a3dd31a3fa..b492ffcddb 100644
--- a/protocols/JabberG/src/jabber.cpp
+++ b/protocols/JabberG/src/jabber.cpp
@@ -195,7 +195,6 @@ static int OnModulesLoaded( WPARAM, LPARAM )
// Init extra icons
hExtraActivity = ExtraIcon_Register("activity", "Jabber Activity" /* No icons registered, "working" */);
hExtraMood = ExtraIcon_Register("mood", "Jabber Mood" /* No icons registered, "amazed" */);
-
return 0;
}
diff --git a/protocols/JabberG/src/jabber.h b/protocols/JabberG/src/jabber.h
index 09751bb5b0..cfb87c90ab 100644
--- a/protocols/JabberG/src/jabber.h
+++ b/protocols/JabberG/src/jabber.h
@@ -637,7 +637,7 @@ HXML JabberFormGetData( HWND hwndStatic, HXML xNode );
void g_IconsInit();
HANDLE g_GetIconHandle( int iconId );
HICON g_LoadIconEx( const char* name, bool big = false );
-void g_ReleaseIcon( HICON hIcon );
+void g_ReleaseIcon( HICON hIcon );
void ImageList_AddIcon_Icolib( HIMAGELIST hIml, HICON hIcon );
void WindowSetIcon(HWND hWnd, CJabberProto *proto, const char* name);
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp
index 689ace5b09..828951e4ea 100644
--- a/protocols/JabberG/src/jabber_icolib.cpp
+++ b/protocols/JabberG/src/jabber_icolib.cpp
@@ -84,20 +84,20 @@ static int skinStatusToJabberStatus[] = {0,1,2,3,4,4,6,7,2,2};
///////////////////////////////////////////////////////////////////////////////
// CIconPool class
+
int CIconPool::CPoolItem::cmp(const CPoolItem *p1, const CPoolItem *p2)
{
return lstrcmpA(p1->m_name, p2->m_name);
}
CIconPool::CPoolItem::CPoolItem():
- m_name(NULL), m_szIcolibName(NULL), m_hIcolibItem(NULL), m_hClistItem(NULL)
+ m_name(NULL), m_szIcolibName(NULL), m_hIcolibItem(NULL)
{
}
CIconPool::CPoolItem::~CPoolItem()
{
- if (m_hIcolibItem && m_szIcolibName)
- {
+ if (m_hIcolibItem && m_szIcolibName) {
CallService(MS_SKIN2_REMOVEICON, 0, (LPARAM)m_szIcolibName);
mir_free(m_szIcolibName);
}
@@ -114,8 +114,7 @@ CIconPool::CIconPool(CJabberProto *proto):
CIconPool::~CIconPool()
{
- if (m_hOnExtraIconsRebuild)
- {
+ if (m_hOnExtraIconsRebuild) {
UnhookEvent(m_hOnExtraIconsRebuild);
m_hOnExtraIconsRebuild = NULL;
}
@@ -129,7 +128,6 @@ void CIconPool::RegisterIcon(const char *name, const char *filename, int iconid,
CPoolItem *item = new CPoolItem;
item->m_name = mir_strdup(name);
item->m_szIcolibName = mir_strdup(szSettingName);
- item->m_hClistItem = NULL;
SKINICONDESC sid = {0};
sid.cbSize = sizeof(SKINICONDESC);
@@ -168,35 +166,6 @@ HICON CIconPool::GetIcon(const char *name, bool big)
return NULL;
}
-HANDLE CIconPool::GetClistHandle(const char *name)
-{
- if (!name)
- return (HANDLE)-1;
-
- if (!ExtraIconsSupported())
- return (HANDLE)-1;
-
- if (!m_hOnExtraIconsRebuild)
- {
- int (__cdecl CIconPool::*hookProc)(WPARAM, LPARAM);
- hookProc = &CIconPool::OnExtraIconsRebuild;
- m_hOnExtraIconsRebuild = HookEventObj(ME_CLIST_EXTRA_LIST_REBUILD, (MIRANDAHOOKOBJ)*(void **)&hookProc, this);
- }
-
- if (CPoolItem *item = FindItemByName(name))
- {
- if (item->m_hClistItem)
- return item->m_hClistItem;
-
- HICON hIcon = Skin_GetIconByHandle(item->m_hIcolibItem);
- item->m_hClistItem = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0);
- g_ReleaseIcon(hIcon);
- return item->m_hClistItem;
- }
-
- return (HANDLE)-1;
-}
-
CIconPool::CPoolItem *CIconPool::FindItemByName(const char *name)
{
CPoolItem item;
@@ -204,21 +173,6 @@ CIconPool::CPoolItem *CIconPool::FindItemByName(const char *name)
return m_items.find(&item);
}
-int CIconPool::OnExtraIconsRebuild(WPARAM, LPARAM)
-{
- for (int i = 0; i < m_items.getCount(); ++i)
- m_items[i].m_hClistItem = NULL;
-
- return 0;
-}
-
-bool CIconPool::ExtraIconsSupported()
-{
- static int res = -1;
- if (res < 0) res = ServiceExists(MS_CLIST_EXTRA_ADD_ICON) ? 1 : 0;
- return res ? true : false;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// Icons init
diff --git a/protocols/JabberG/src/jabber_icolib.h b/protocols/JabberG/src/jabber_icolib.h
index 4b5f7d8e12..62924e5bae 100644
--- a/protocols/JabberG/src/jabber_icolib.h
+++ b/protocols/JabberG/src/jabber_icolib.h
@@ -38,7 +38,6 @@ public:
HANDLE GetIcolibHandle(const char *name);
char *GetIcolibName(const char *name);
HICON GetIcon(const char *name, bool big = false);
- HANDLE GetClistHandle(const char *name);
private:
struct CPoolItem
@@ -46,7 +45,6 @@ private:
char *m_name;
char *m_szIcolibName;
HANDLE m_hIcolibItem;
- HANDLE m_hClistItem;
static int cmp(const CPoolItem *p1, const CPoolItem *p2);
@@ -59,9 +57,6 @@ private:
HANDLE m_hOnExtraIconsRebuild;
CPoolItem *FindItemByName(const char *name);
-
- int __cdecl OnExtraIconsRebuild(WPARAM, LPARAM);
- static bool ExtraIconsSupported();
};
#endif // _JABBER_ICOLIB_H_
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index eff59bb002..002408dcae 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -228,8 +228,6 @@ struct CJabberProto : public PROTO_INTERFACE, public MZeroedObject
int __cdecl JabberGcMenuHook( WPARAM, LPARAM );
int __cdecl JabberGcInit( WPARAM, LPARAM );
- int __cdecl CListMW_ExtraIconsApply( WPARAM, LPARAM );
-
// Google Shared Status
BOOL m_bGoogleSharedStatus;
BOOL m_bGoogleSharedStatusLock;
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp
index 5078d7c5c0..c0e278de66 100644
--- a/protocols/JabberG/src/jabber_xstatus.cpp
+++ b/protocols/JabberG/src/jabber_xstatus.cpp
@@ -713,18 +713,7 @@ void CPepMood::ResetExtraIcon(HANDLE hContact)
void CPepMood::SetExtraIcon(HANDLE hContact, char *szMood)
{
- if (hExtraMood != NULL)
- {
- ExtraIcon_SetIcon(hExtraMood, hContact, szMood == NULL ? NULL : m_icons.GetIcolibName(szMood));
- }
- else
- {
- IconExtraColumn iec;
- iec.cbSize = sizeof(iec);
- iec.hImage = m_icons.GetClistHandle(szMood);
- iec.ColumnType = EXTRA_ICON_ADV1;
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
- }
+ ExtraIcon_SetIcon(hExtraMood, hContact, szMood == NULL ? NULL : m_icons.GetIcolibName(szMood));
}
void CPepMood::SetMood(HANDLE hContact, const TCHAR *szMood, const TCHAR *szText)
@@ -1145,19 +1134,7 @@ void CPepActivity::ResetExtraIcon(HANDLE hContact)
void CPepActivity::SetExtraIcon(HANDLE hContact, char *szActivity)
{
- if (hExtraActivity != NULL)
- {
- ExtraIcon_SetIcon(hExtraActivity, hContact,
- szActivity == NULL ? NULL : m_icons.GetIcolibName(szActivity));
- }
- else
- {
- IconExtraColumn iec;
- iec.cbSize = sizeof(iec);
- iec.hImage = m_icons.GetClistHandle(szActivity);
- iec.ColumnType = EXTRA_ICON_ADV2;
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
- }
+ ExtraIcon_SetIcon(hExtraActivity, hContact, szActivity == NULL ? NULL : m_icons.GetIcolibName(szActivity));
}
void CPepActivity::SetActivity(HANDLE hContact, LPCTSTR szFirst, LPCTSTR szSecond, LPCTSTR szText)
@@ -1245,19 +1222,6 @@ HICON CJabberProto::GetXStatusIcon(int bStatus, UINT flags)
return ( flags & LR_SHARED ) ? icon : CopyIcon( icon );
}
-int CJabberProto::CListMW_ExtraIconsApply( WPARAM wParam, LPARAM )
-{
- if (m_bJabberOnline && m_bPepSupported && ServiceExists(MS_CLIST_EXTRA_SET_ICON))
- {
- char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 );
- if ( szProto==NULL || strcmp( szProto, m_szModuleName ))
- return 0; // only apply icons to our contacts, do not mess others
-
- m_pepServices.ResetExtraIcon((HANDLE)wParam);
- }
- return 0;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// JabberGetXStatus - gets the extended status info (mood)
@@ -1465,12 +1429,9 @@ void CJabberProto::InfoFrame_OnUserActivity(CJabberInfoFrame_Event*)
void CJabberProto::XStatusInit()
{
- if (hExtraMood == NULL)
- JHookEvent( ME_CLIST_EXTRA_IMAGE_APPLY, &CJabberProto::CListMW_ExtraIconsApply );
-
- RegisterAdvStatusSlot( ADVSTATUS_MOOD );
- RegisterAdvStatusSlot( ADVSTATUS_TUNE );
- RegisterAdvStatusSlot( ADVSTATUS_ACTIVITY );
+ RegisterAdvStatusSlot(ADVSTATUS_MOOD);
+ RegisterAdvStatusSlot(ADVSTATUS_TUNE);
+ RegisterAdvStatusSlot(ADVSTATUS_ACTIVITY);
}
void CJabberProto::XStatusUninit()
diff --git a/protocols/MRA/src/Mra.h b/protocols/MRA/src/Mra.h
index 67a5aadcec..a4773a74e0 100644
--- a/protocols/MRA/src/Mra.h
+++ b/protocols/MRA/src/Mra.h
@@ -242,7 +242,7 @@ BOOL IsEMailMR (LPSTR lpszEMail, size_t dwEMailSize);
BOOL GetEMailFromString (LPSTR lpszBuff, size_t dwBuffSize, LPSTR *plpszEMail, size_t *pdwEMailSize);
DWORD CreateBlobFromContact (HANDLE hContact, LPWSTR lpwszRequestReason, size_t dwRequestReasonSize, LPBYTE lpbBuff, size_t dwBuffSize, size_t *pdwBuffSizeRet);
-int ExtraSetIcon (HANDLE hExtraIcon, HANDLE hContact, HANDLE hImage, int iColumnType);
+int ExtraSetIcon (HANDLE hExtraIcon, HANDLE hContact, HANDLE hImage);
size_t CopyNumber (LPCVOID lpcOutBuff, LPCVOID lpcBuff, size_t dwLen);
BOOL IsPhone (LPSTR lpszString, size_t dwStringSize);
BOOL IsContactPhone (HANDLE hContact, LPSTR lpszPhone, size_t dwPhoneSize);
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp
index f1b826767c..5eb10e6832 100644
--- a/protocols/MRA/src/MraProto.cpp
+++ b/protocols/MRA/src/MraProto.cpp
@@ -7,13 +7,6 @@ static int MraExtraIconsApplyAll(WPARAM, LPARAM)
return 0;
}
-static int MraExtraIconsRebuildAll(WPARAM, LPARAM)
-{
- for (int i=0; i < g_Instances.getCount(); i++)
- g_Instances[i]->MraExtraIconsRebuild(0, 0);
- return 0;
-}
-
CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) :
m_bLoggedIn(false)
{
@@ -58,7 +51,6 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) :
hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
HookEvent(ME_SYSTEM_PRESHUTDOWN, &CMraProto::OnPreShutdown);
- HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, &CMraProto::MraExtraIconsRebuild);
InitContactMenu();
@@ -75,10 +67,9 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) :
HookEvent(ME_CLIST_PREBUILDSTATUSMENU, &CMraProto::MraRebuildStatusMenu);
MraRebuildStatusMenu(0, 0);
- MraExtraIconsRebuild(0, 0);
- hExtraXstatusIcon = ExtraIcon_Register("MRAXstatus", "Mail.ru Xstatus", "MRA_xstatus25", MraExtraIconsRebuildAll, MraExtraIconsApplyAll, NULL, NULL);
- hExtraInfo = ExtraIcon_Register("MRAStatus", "Mail.ru extra info", "MRA_xstatus49", MraExtraIconsRebuildAll, MraExtraIconsApplyAll, NULL, NULL);
+ hExtraXstatusIcon = ExtraIcon_Register("MRAXstatus", "Mail.ru Xstatus", "MRA_xstatus25");
+ hExtraInfo = ExtraIcon_Register("MRAStatus", "Mail.ru extra info", "MRA_xstatus49");
bHideXStatusUI = FALSE;
m_iXStatus = mraGetByte(NULL, DBSETTING_XSTATUSID, MRA_MIR_XSTATUS_NONE);
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h
index 7c3302119c..ea2c8da7ff 100644
--- a/protocols/MRA/src/MraProto.h
+++ b/protocols/MRA/src/MraProto.h
@@ -193,7 +193,6 @@ struct CMraProto : public PROTO_INTERFACE, public MZeroedObject
int __cdecl MraChatGcEventHook(WPARAM, LPARAM);
int __cdecl MraExtraIconsApply(WPARAM, LPARAM);
- int __cdecl MraExtraIconsRebuild(WPARAM, LPARAM);
int __cdecl MraContactDeleted(WPARAM, LPARAM);
int __cdecl MraDbSettingChanged(WPARAM, LPARAM);
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp
index 7083da1b8d..7ea81b6369 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -1153,19 +1153,11 @@ void CMraProto::CListShowMenuItem(HANDLE hMenuItem, BOOL bShow)
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&mi);
}
-int ExtraSetIcon(HANDLE hExtraIcon, HANDLE hContact, HANDLE hImage, int iColumnType)
+int ExtraSetIcon(HANDLE hExtraIcon, HANDLE hContact, HANDLE hImage)
{
if (hImage == NULL)
hImage = INVALID_HANDLE_VALUE;
-
- if (hExtraIcon)
- return ExtraIcon_SetIcon(hExtraIcon, hContact, hImage);
-
- IconExtraColumn iec;
- iec.cbSize = sizeof(iec);
- iec.ColumnType = iColumnType;
- iec.hImage = hImage;
- return CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
+ return ExtraIcon_SetIcon(hExtraIcon, hContact, hImage);
}
size_t CopyNumber(LPCVOID lpcOutBuff, LPCVOID lpcBuff, size_t dwLen)
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp
index 897f76f1a9..78dc74c032 100644
--- a/protocols/MRA/src/Mra_svcs.cpp
+++ b/protocols/MRA/src/Mra_svcs.cpp
@@ -157,8 +157,8 @@ void CMraProto::SetExtraIcons(HANDLE hContact)
if (dwBlogStatusMsgSize) dwIconID = ADV_ICON_BLOGSTATUS;
}
- ExtraSetIcon(hExtraXstatusIcon, hContact, (( IsXStatusValid(dwXStatus) || dwXStatus == MRA_MIR_XSTATUS_UNKNOWN)? hXStatusAdvancedStatusItems[dwXStatus]:NULL), EXTRA_ICON_ADV1);
- ExtraSetIcon(hExtraInfo, hContact, ((dwIconID != -1) ? hAdvancedStatusItems[dwIconID]:NULL), EXTRA_ICON_ADV2);
+ ExtraSetIcon(hExtraXstatusIcon, hContact, (( IsXStatusValid(dwXStatus) || dwXStatus == MRA_MIR_XSTATUS_UNKNOWN)? hXStatusAdvancedStatusItems[dwXStatus]:NULL));
+ ExtraSetIcon(hExtraInfo, hContact, ((dwIconID != -1) ? hAdvancedStatusItems[dwIconID]:NULL));
}
INT_PTR CMraProto::MraXStatusMenu(WPARAM wParam, LPARAM lParam, LPARAM param)
@@ -649,17 +649,6 @@ int CMraProto::MraExtraIconsApply(WPARAM wParam, LPARAM lParam)
return 0;
}
-int CMraProto::MraExtraIconsRebuild(WPARAM wParam, LPARAM lParam)
-{
- for (size_t i = 0; i < ADV_ICON_MAX; i++)
- hAdvancedStatusItems[i] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)IconLibGetIcon(gdiExtraStatusIconsItems[i].hIconHandle), 0);
-
- for (size_t i = 0; i < MRA_XSTATUS_COUNT+1; i++)
- hXStatusAdvancedStatusItems[i] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)IconLibGetIcon(hXStatusAdvancedStatusIcons[i]), 0);
-
- return 0;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
int CMraProto::MraRebuildStatusMenu(WPARAM wParam, LPARAM lParam)
diff --git a/protocols/Quotes/src/ExtraImages.cpp b/protocols/Quotes/src/ExtraImages.cpp
index 35a59a8c1d..5b7a16991c 100644
--- a/protocols/Quotes/src/ExtraImages.cpp
+++ b/protocols/Quotes/src/ExtraImages.cpp
@@ -8,25 +8,14 @@
#include "Log.h"
#include "DBUtils.h"
-namespace
+CExtraImages::CExtraImages() :
+ m_hExtraIcons(ExtraIcon_Register(ICON_STR_QUOTE,QUOTES_PROTOCOL_NAME,Quotes_MakeIconName(ICON_STR_MAIN).c_str())),
+ m_bExtraImagesInit(false),
+ m_nSlot(DBGetContactSettingWord(NULL,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_EXTRA_IMAGE_SLOT,EXTRA_ICON_ADV1))
{
- inline HANDLE extra_add_icon(const char* psz)
- {
- return reinterpret_cast<HANDLE>(
- CallService(MS_CLIST_EXTRA_ADD_ICON,reinterpret_cast<WPARAM>(Quotes_LoadIconEx(psz)),0));
- }
-
- const HANDLE INVALID_IMAGE_HANDLE = reinterpret_cast<HANDLE>(-1);
-}
-
-CExtraImages::CExtraImages()
- : m_hExtraIcons(ExtraIcon_Register(ICON_STR_QUOTE,QUOTES_PROTOCOL_NAME,Quotes_MakeIconName(ICON_STR_MAIN).c_str())),
- m_bExtraImagesInit(false),
- m_nSlot(DBGetContactSettingWord(NULL,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_EXTRA_IMAGE_SLOT,EXTRA_ICON_ADV1))
-{
- m_ahExtraImages[eiUp] = INVALID_IMAGE_HANDLE;
- m_ahExtraImages[eiDown] = INVALID_IMAGE_HANDLE;
- m_ahExtraImages[eiNotChanged] = INVALID_IMAGE_HANDLE;
+ m_ahExtraImages[eiUp] = INVALID_HANDLE_VALUE;
+ m_ahExtraImages[eiDown] = INVALID_HANDLE_VALUE;
+ m_ahExtraImages[eiNotChanged] = INVALID_HANDLE_VALUE;
}
CExtraImages::~CExtraImages()
@@ -41,89 +30,26 @@ CExtraImages& CExtraImages::GetInstance()
void CExtraImages::RebuildExtraImages()
{
- if(NULL == m_hExtraIcons)
- {
- m_bExtraImagesInit = false;
- CGuard<CLightMutex> cs(m_lmExtraImages);
- m_ahExtraImages[eiUp] = extra_add_icon(ICON_STR_QUOTE_UP);
- m_ahExtraImages[eiDown] = extra_add_icon(ICON_STR_QUOTE_DOWN);
- m_ahExtraImages[eiNotChanged] = extra_add_icon(ICON_STR_QUOTE_NOT_CHANGED);
- m_bExtraImagesInit = true;
- }
}
-
bool CExtraImages::SetContactExtraImage(HANDLE hContact,EImageIndex nIndex)const
{
-// tstring s = Quotes_DBGetStringT(hContact,LIST_MODULE_NAME,CONTACT_LIST_NAME);
-// tostringstream o;
-// o << _T("SetContactExtraImage for ") << s << _T("\nExtra image list init: ") << m_bExtraImagesInit << _T("\n");
-
- bool bResult = false;
- if(m_hExtraIcons)
- {
-// o << "Using extra icon interface\n";
- std::string sIconName;
- switch(nIndex)
- {
- case eiUp:
- sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_UP);
- break;
- case eiDown:
- sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_DOWN);
- break;
- case eiNotChanged:
- sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_NOT_CHANGED);
- break;
- }
- bResult = (0 == ExtraIcon_SetIcon(m_hExtraIcons,hContact,sIconName.c_str()));
- }
- else if(m_bExtraImagesInit && ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
- {
-// o << "Using contact list interface index is ";
- IconExtraColumn iec = {0};
- iec.cbSize = sizeof(iec);
- iec.ColumnType = m_nSlot;
-
- {
- CGuard<CLightMutex> cs(m_lmExtraImages);
- switch(nIndex)
- {
- case eiUp:
-// o << "up\n";
- iec.hImage = m_ahExtraImages[eiUp];
- break;
- case eiDown:
-// o << "down\n";
- iec.hImage = m_ahExtraImages[eiDown];
- break;
- case eiNotChanged:
-// o << "not changed\n";
- iec.hImage = m_ahExtraImages[eiNotChanged];
- break;
- default:
-// o << "invalid\n";
- iec.hImage = INVALID_IMAGE_HANDLE;
- break;
- }
- }
-
- bResult = (0 == CallService(MS_CLIST_EXTRA_SET_ICON,reinterpret_cast<WPARAM>(hContact),reinterpret_cast<LPARAM>(&iec)));
- }
-
-// o << "Result is " << bResult;
-// LogIt(Info,o.str());
- return bResult;
-}
-
-int QuotesEventFunc_onExtraImageListRebuild(WPARAM /*wp*/,LPARAM /*lp*/)
-{
- if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
- {
- CExtraImages::GetInstance().RebuildExtraImages();
+ if (!m_hExtraIcons)
+ return false;
+
+ std::string sIconName;
+ switch(nIndex) {
+ case eiUp:
+ sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_UP);
+ break;
+ case eiDown:
+ sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_DOWN);
+ break;
+ case eiNotChanged:
+ sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_NOT_CHANGED);
+ break;
}
-
- return 0;
+ return (0 == ExtraIcon_SetIcon(m_hExtraIcons,hContact,sIconName.c_str()));
}
int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp)
@@ -133,11 +59,7 @@ int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp)
const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact);
if(pProvider)
- {
pProvider->SetContactExtraIcon(hContact);
- }
return 0;
}
-
-
diff --git a/protocols/Quotes/src/ExtraImages.h b/protocols/Quotes/src/ExtraImages.h
index ec8ae01e39..e6988cca06 100644
--- a/protocols/Quotes/src/ExtraImages.h
+++ b/protocols/Quotes/src/ExtraImages.h
@@ -33,7 +33,6 @@ private:
int m_nSlot;
};
-int QuotesEventFunc_onExtraImageListRebuild(WPARAM wp,LPARAM lp);
int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp);
#endif //__9d0dac0c_12e4_46ce_809a_db6dc7d6f269_ExtraImages_h__
diff --git a/protocols/Quotes/src/Forex.cpp b/protocols/Quotes/src/Forex.cpp
index ab27ba41c3..063e812b04 100644
--- a/protocols/Quotes/src/Forex.cpp
+++ b/protocols/Quotes/src/Forex.cpp
@@ -206,17 +206,12 @@ namespace
{
CHTTPSession::Init();
- HANDLE h = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD,QuotesEventFunc_onExtraImageListRebuild);
- g_ahEvents.push_back(h);
-// QuotesEventFunc_onExtraImageListRebuild(0,0);
-
- h = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY,QuotesEventFunc_onExtraImageApply);
+ HANDLE h = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY,QuotesEventFunc_onExtraImageApply);
g_ahEvents.push_back(h);
g_hEventWorkThreadStop = ::CreateEvent(NULL,TRUE,FALSE,NULL);
h = (ME_USERINFO_INITIALISE,QuotesEventFunc_OnUserInfoInit);
g_ahEvents.push_back(h);
-
h = HookEvent(ME_CLIST_DOUBLECLICKED,Quotes_OnContactDoubleClick);
g_ahEvents.push_back(h);