summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MySpace/notifications.cpp94
-rw-r--r--MySpace/notifications.h3
-rw-r--r--MySpace/server_con.cpp11
-rw-r--r--MySpace/version.h2
4 files changed, 103 insertions, 7 deletions
diff --git a/MySpace/notifications.cpp b/MySpace/notifications.cpp
index e7574e7..702c965 100644
--- a/MySpace/notifications.cpp
+++ b/MySpace/notifications.cpp
@@ -11,12 +11,16 @@
#define URL_PROFILE "http://comment.myspace.com/index.cfm?fuseaction=user.viewComments&friendID=%d"
#define URL_FRIEND "http://messaging.myspace.com/index.cfm?fuseaction=mail.friendRequests"
#define URL_PICTURE "http://viewmorepics.myspace.com/index.cfm?fuseaction=user.viewPictureComments&friendID=%d"
+#define URL_BLOGSUB "http://blog.myspace.com/index.cfm?fuseaction=blog.controlcenter"
+
+#define URL_HOME "http://home.myspace.com/index.cfm?fuseaction=user"
char *zap_array[11] = {
"zap", "whack", "torch", "smooch", "hug", "bslap", "goose", "hi-five", "punk'd", "raspberry", 0
};
-bool bWndMailPopup = false, bWndBlogPopup = false, bWndProfilePopup = false, bWndFriendPopup = false, bWndPicPopup = false;
+bool bWndMailPopup = false, bWndBlogPopup = false, bWndProfilePopup = false, bWndFriendPopup = false, bWndPicPopup = false,
+ bWndBlogSubPopup = false, bWndUnknownPopup = false;
typedef struct {
char *url;
bool *bWnd;
@@ -228,7 +232,6 @@ void NotifyFriendRequest() {
}
void NotifyPictureComment() {
-
if (!ServiceExists( MS_POPUP_ADDPOPUPT)) return;
if(bWndPicPopup) return;
@@ -268,6 +271,88 @@ void NotifyPictureComment() {
SkinPlaySound(temp);
}
+void NotifyBlogSubscriptPost() {
+ if (!ServiceExists( MS_POPUP_ADDPOPUPT)) return;
+ if(bWndBlogSubPopup) return;
+
+ POPUPDATAT ppd = {0};
+ TCHAR wproto[256];
+#ifndef _UNICODE
+ strncpy(wproto, MODULE, 256);
+#else
+ MultiByteToWideChar(code_page, 0, MODULE, -1, wproto, 256);
+#endif
+
+ PopupData *pd = new PopupData;
+ pd->url = strdup(URL_BLOGSUB);
+ pd->bWnd = &bWndBlogSubPopup;
+
+ if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
+ POPUPDATACLASS d = {sizeof(d), popup_class_name};
+ d.ptszTitle = wproto;
+ d.ptszText = TranslateT("You have unread blog subscription posts");
+ d.PluginData = (void *)pd;
+ CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
+ } else {
+ _tcsncpy(ppd.lptzContactName, wproto, 256);
+ _tcscpy(ppd.lptzText, TranslateT("You have unread log subscription posts"));
+ ppd.lchIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MYSPACE), IMAGE_ICON, SM_CXSMICON, SM_CYSMICON, 0);
+ ppd.PluginWindowProc = ( WNDPROC )NotifyPopupWindowProc;
+ ppd.PluginData = (void *)pd;
+ ppd.iSeconds = -1;
+
+ PUAddPopUpT(&ppd);
+ }
+
+ char temp[512];
+ mir_snprintf(temp, 512, "%s/BlogSubscriptionPost", MODULE);
+ SkinPlaySound(temp);
+}
+
+void NotifyUnknown(char *name) {
+ if (!ServiceExists( MS_POPUP_ADDPOPUPT)) return;
+ if(bWndUnknownPopup) return;
+
+ POPUPDATAT ppd = {0};
+ TCHAR wproto[256];
+#ifndef _UNICODE
+ strncpy(wproto, MODULE, 256);
+#else
+ MultiByteToWideChar(code_page, 0, MODULE, -1, wproto, 256);
+#endif
+
+ PopupData *pd = new PopupData;
+ pd->url = strdup(URL_HOME);
+ pd->bWnd = &bWndUnknownPopup;
+
+ TCHAR tname[256];
+#ifdef _UNICODE
+ MultiByteToWideChar(CP_UTF8, 0, name, -1, tname, 256);
+#else
+ strncpy(tname, name, 256);
+#endif
+
+ TCHAR text[512];
+ mir_sntprintf(text, 512, TranslateT("Unknown event: %s\n\nClick here to go to your homepage"), tname);
+
+ if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
+ POPUPDATACLASS d = {sizeof(d), popup_class_name};
+ d.ptszTitle = wproto;
+ d.ptszText = text;
+ d.PluginData = (void *)pd;
+ CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
+ } else {
+ _tcsncpy(ppd.lptzContactName, wproto, 256);
+ _tcscpy(ppd.lptzText, text);
+ ppd.lchIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MYSPACE), IMAGE_ICON, SM_CXSMICON, SM_CYSMICON, 0);
+ ppd.PluginWindowProc = ( WNDPROC )NotifyPopupWindowProc;
+ ppd.PluginData = (void *)pd;
+ ppd.iSeconds = -1;
+
+ PUAddPopUpT(&ppd);
+ }
+}
+
void NotifyZapRecv(HANDLE hContact, int zap_num) {
char rmsg[512];
mir_snprintf(rmsg, 512, Translate("You received a ZAP: %s"), Translate(zap_array[zap_num]));
@@ -356,6 +441,11 @@ void InitNotifications() {
sd.pszDescription = "New picture comment";
CallService(MS_SKIN_ADDNEWSOUND, 0, (LPARAM)&sd);
+ mir_snprintf(name, 512, "%s/BlogSubscriptionPost", MODULE);
+ sd.pszName = name;
+ sd.pszDescription = "New blog subscription post";
+ CallService(MS_SKIN_ADDNEWSOUND, 0, (LPARAM)&sd);
+
for(int i = 0; zap_array[i]; i++) {
mir_snprintf(name, 512, "%s/Zap/%s", MODULE, zap_array[i]);
sd.pszName = name;
diff --git a/MySpace/notifications.h b/MySpace/notifications.h
index 9795f07..3acbb18 100644
--- a/MySpace/notifications.h
+++ b/MySpace/notifications.h
@@ -6,6 +6,9 @@ void NotifyBlogComment();
void NotifyProfileComment();
void NotifyFriendRequest();
void NotifyPictureComment();
+void NotifyBlogSubscriptPost();
+
+void NotifyUnknown(char *name);
void InitNotifications();
void DeinitNotifications();
diff --git a/MySpace/server_con.cpp b/MySpace/server_con.cpp
index b540b3a..9701bf0 100644
--- a/MySpace/server_con.cpp
+++ b/MySpace/server_con.cpp
@@ -739,7 +739,10 @@ void __cdecl ServerThreadFunc(void*) {
if(body.get_string("PictureComment", b, 10)) {
NotifyPictureComment();
}
- if(DBGetContactSettingByte(0, MODULE, "DebugMail", 0)) {
+ if(body.get_string("BlogSubscriptionPost", b, 10)) {
+ NotifyBlogSubscriptPost();
+ }
+ if(DBGetContactSettingByte(0, MODULE, "UnknownNotify", 1)) {
char pmsg[512];
for(LinkedList<KeyValue>::Iterator i = body.start(); i.has_val(); i.next()) {
KeyValue &kv = i.val();
@@ -749,10 +752,10 @@ void __cdecl ServerThreadFunc(void*) {
&& strcmp(kv.first.text, "ProfileComment") != 0
&& strcmp(kv.first.text, "FriendRequest") != 0
&& strcmp(kv.first.text, "PictureComment") != 0
- && strcmp(kv.first.text, "€") != 0)
+ && strcmp(kv.first.text, "BlogSubscriptionPost") != 0
+ && strcmp(kv.first.text, "€") != 0)
{
- mir_snprintf(pmsg, 512, "%s = %s", kv.first.text, kv.second.text);
- PUShowMessage(pmsg, SM_NOTIFY);
+ NotifyUnknown(kv.first.text);
}
}
}
diff --git a/MySpace/version.h b/MySpace/version.h
index 109f19d..5996198 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 1
+#define __BUILD_NUM 2
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM