diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-07-27 15:42:22 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-07-27 15:42:22 +0000 |
commit | 3436bfa6059138bdb2007ae0a97a7d9d313e83c7 (patch) | |
tree | eb4be4a6207f1997e6a6c47c9111f6137962ce9a /MySpace/srmm_icon.cpp | |
parent | 1a6e26b0a84571eadb2156e5e18b8278f07ad754 (diff) |
remove <icon tags
remove unecessary icon flags in all contacts
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@304 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'MySpace/srmm_icon.cpp')
-rw-r--r-- | MySpace/srmm_icon.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/MySpace/srmm_icon.cpp b/MySpace/srmm_icon.cpp index 23251e0..053b0c7 100644 --- a/MySpace/srmm_icon.cpp +++ b/MySpace/srmm_icon.cpp @@ -10,12 +10,11 @@ int WindowEvent(WPARAM wParam, LPARAM lParam) { MessageWindowEventData *wd = (MessageWindowEventData *)lParam;
if(wd->uType != MSG_WINDOW_EVT_OPEN) return 0;
- HANDLE hContact = wd->hContact, hTemp;
- if(ServiceExists(MS_MC_GETMOSTONLINECONTACT) && (hTemp = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0)
- hContact = hTemp;
+ HANDLE hContact = wd->hContact, hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0);
+ if(!hSub) return 0;
bool hide = false;
- if(!CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)MODULE))
+ if(!CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hSub, (LPARAM)MODULE))
hide = true;
StatusIconData sid = {0};
@@ -31,9 +30,9 @@ int IconPressed(WPARAM wParam, LPARAM lParam) { StatusIconClickData *cd = (StatusIconClickData *)lParam;
if(strcmp(cd->szModule, MODULE) != 0) return 0;
- HANDLE hContact = (HANDLE)wParam, hTemp;
- if(ServiceExists(MS_MC_GETMOSTONLINECONTACT) && (hTemp = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0)
- hContact = hTemp;
+ HANDLE hContact = (HANDLE)wParam, hSub;
+ if(ServiceExists(MS_MC_GETMOSTONLINECONTACT) && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0)
+ hContact = hSub;
if(!CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)MODULE))
return 0;
@@ -58,16 +57,30 @@ void InitSRMMIcon() { // add icon to srmm status icons
if(ServiceExists(MS_MSG_ADDICON)) {
hZapIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ZAPS));
+ // create icon hidden
StatusIconData sid = {0};
sid.cbSize = sizeof(sid);
sid.szModule = MODULE;
sid.hIcon = hZapIcon;
+ sid.flags = MBF_HIDDEN;
sid.szTooltip = Translate("Send ZAP");
CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid);
- // hook the window events so that we can can change the status of the icon
- hEventWindow = HookEvent(ME_MSG_WINDOWEVENT, WindowEvent);
+ // hook the window events so that we can can change the status of the icon for metacontacts
+ if(ServiceExists(MS_MC_GETMOSTONLINECONTACT)) // metas installed
+ hEventWindow = HookEvent(ME_MSG_WINDOWEVENT, WindowEvent);
hEventIconPressed = HookEvent(ME_MSG_ICONPRESSED, IconPressed);
+
+ // show for all MySpace contacts
+ HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ while ( hContact != NULL ) {
+ char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 );
+ if ( szProto != NULL && !strcmp( szProto, MODULE)) {
+ sid.flags = 0;
+ CallService(MS_MSG_MODIFYICON, (WPARAM)hContact, (LPARAM)&sid);
+ }
+ hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 );
+ }
}
}
|