diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-03 20:16:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-03 20:16:42 +0000 |
commit | f12d8b56f2894e94491bd7424d69f595d285f01f (patch) | |
tree | 3f54d66c8c248bb456da1cb0c5cc31661f144e5f /protocols/JabberG/src | |
parent | 1b1a54dc156bec90be3ddc337c17b4e67179d4ea (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/JabberG/src')
-rw-r--r-- | protocols/JabberG/src/jabber.cpp | 1 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber.h | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_icolib.cpp | 54 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_icolib.h | 5 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.h | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_xstatus.cpp | 49 |
6 files changed, 10 insertions, 103 deletions
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()
|