From 784620ca47daa53367e4b504b36adc5bd3d3cd70 Mon Sep 17 00:00:00 2001 From: sje Date: Fri, 13 Jul 2007 04:24:40 +0000 Subject: added BlogSubscriptionComment notification, and unknown event notification git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@280 4f64403b-2f21-0410-a795-97e2b3489a10 --- MySpace/notifications.cpp | 94 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 92 insertions(+), 2 deletions(-) (limited to 'MySpace/notifications.cpp') 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; -- cgit v1.2.3