summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MySpace/formatting.cpp6
-rw-r--r--MySpace/srmm_icon.cpp31
-rw-r--r--MySpace/version.h2
3 files changed, 29 insertions, 10 deletions
diff --git a/MySpace/formatting.cpp b/MySpace/formatting.cpp
index cd27f65..d6b4055 100644
--- a/MySpace/formatting.cpp
+++ b/MySpace/formatting.cpp
@@ -63,6 +63,12 @@ void strip_tags(char *buff) {
// add a space after a link in case there's something inside the <a></a> tags
if(buff[in] && buff[in] != ' ' && buff[in] != '\r' && buff[in] != '\n' && buff[in] != '\t')
buff[out++] = ' ';
+ } else if(buff[in] == '<' && buff[in + 1] == 'i') {
+ if(buff[in + 2] == 'c' && buff[in + 3] == 'o' && buff[in + 4] == 'n') { // <icon... (otherwise it could be and '<i...' tag, which is a smiley thing (see below)
+ while(buff[in] && buff[in] != '>') in++;
+ in++;
+ } else
+ buff[out++] = buff[in++];
} else
buff[out++] = buff[in++];
}
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 );
+ }
}
}
diff --git a/MySpace/version.h b/MySpace/version.h
index c477cff..13053b9 100644
--- a/MySpace/version.h
+++ b/MySpace/version.h
@@ -5,7 +5,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 0
#define __RELEASE_NUM 5
-#define __BUILD_NUM 6
+#define __BUILD_NUM 7
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM