From 3c50a9aa27d2138b757dd7822841c106f4c99b18 Mon Sep 17 00:00:00 2001 From: sje Date: Fri, 20 Jul 2007 17:26:51 +0000 Subject: convert to new popup api (see m_yapp.h in yapp/docs) git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@297 4f64403b-2f21-0410-a795-97e2b3489a10 --- MySpace/notifications.cpp | 90 +++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 45 deletions(-) (limited to 'MySpace/notifications.cpp') diff --git a/MySpace/notifications.cpp b/MySpace/notifications.cpp index 702c965..df387ad 100644 --- a/MySpace/notifications.cpp +++ b/MySpace/notifications.cpp @@ -24,7 +24,7 @@ bool bWndMailPopup = false, bWndBlogPopup = false, bWndProfilePopup = false, bWn typedef struct { char *url; bool *bWnd; -} PopupData; +} PopupProcData; char popup_class_name[128]; @@ -33,14 +33,14 @@ LRESULT CALLBACK NotifyPopupWindowProc( HWND hWnd, UINT message, WPARAM wParam, switch( message ) { case UM_INITPOPUP: { - PopupData *pd = (PopupData *)PUGetPluginData(hWnd); + PopupProcData *pd = (PopupProcData *)PUGetPluginData(hWnd); if(pd) *pd->bWnd = true; } break; case WM_COMMAND: { - PopupData *pd = (PopupData *)PUGetPluginData(hWnd); + PopupProcData *pd = (PopupProcData *)PUGetPluginData(hWnd); if(pd) { CallService(MS_UTILS_OPENURL, (WPARAM)TRUE, (LPARAM)pd->url); //"http://messaging.myspace.com/index.cfm?fuseaction=mail.inbox" *pd->bWnd = false; @@ -52,7 +52,7 @@ LRESULT CALLBACK NotifyPopupWindowProc( HWND hWnd, UINT message, WPARAM wParam, case WM_CONTEXTMENU: { - PopupData *pd = (PopupData *)PUGetPluginData(hWnd); + PopupProcData *pd = (PopupProcData *)PUGetPluginData(hWnd); if(pd) *pd->bWnd = false; } PUDeletePopUp( hWnd ); @@ -61,7 +61,7 @@ LRESULT CALLBACK NotifyPopupWindowProc( HWND hWnd, UINT message, WPARAM wParam, case UM_FREEPLUGINDATA: { - PopupData *pd = (PopupData *)PUGetPluginData(hWnd); + PopupProcData *pd = (PopupProcData *)PUGetPluginData(hWnd); if(pd) { free(pd->url); delete pd; @@ -86,16 +86,16 @@ void NotifyMail() { MultiByteToWideChar(code_page, 0, MODULE, -1, wproto, 256); #endif - PopupData *pd = new PopupData; + PopupProcData *pd = new PopupProcData; pd->url = strdup(URL_MAIL); pd->bWnd = &bWndMailPopup; - if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { - POPUPDATACLASS d = {sizeof(d), popup_class_name}; + if(ServiceExists(MS_YAPP_CLASSINSTANCE)) { + PopupClassInstance d = {sizeof(d), popup_class_name}; d.ptszTitle = wproto; d.ptszText = TranslateT("You have unread mail"); - d.PluginData = (void *)pd; - CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d); + d.opaque = (void *)pd; + CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d); } else { _tcsncpy(ppd.lptzContactName, wproto, 256); _tcscpy(ppd.lptzText, TranslateT("You have unread mail")); @@ -126,16 +126,16 @@ void NotifyBlogComment() { MultiByteToWideChar(code_page, 0, MODULE, -1, wproto, 256); #endif - PopupData *pd = new PopupData; + PopupProcData *pd = new PopupProcData; pd->url = strdup(URL_BLOG); pd->bWnd = &bWndBlogPopup; - if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { - POPUPDATACLASS d = {sizeof(d), popup_class_name}; + if(ServiceExists(MS_YAPP_CLASSINSTANCE)) { + PopupClassInstance d = {sizeof(d), popup_class_name}; d.ptszTitle = wproto; d.ptszText = TranslateT("You have unread blog comments"); - d.PluginData = (void *)pd; - CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d); + d.opaque = (void *)pd; + CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d); } else { _tcsncpy(ppd.lptzContactName, wproto, 256); _tcscpy(ppd.lptzText, TranslateT("You have unread blog comments")); @@ -165,18 +165,18 @@ void NotifyProfileComment() { MultiByteToWideChar(code_page, 0, MODULE, -1, wproto, 256); #endif - PopupData *pd = new PopupData; + PopupProcData *pd = new PopupProcData; char url[1024]; mir_snprintf(url, 1024, URL_PROFILE, DBGetContactSettingDword(0, MODULE, "UID", 0)); pd->url = strdup(url); pd->bWnd = &bWndProfilePopup; - if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { - POPUPDATACLASS d = {sizeof(d), popup_class_name}; + if(ServiceExists(MS_YAPP_CLASSINSTANCE)) { + PopupClassInstance d = {sizeof(d), popup_class_name}; d.ptszTitle = wproto; d.ptszText = TranslateT("You have unread profile comments"); - d.PluginData = (void *)pd; - CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d); + d.opaque = (void *)pd; + CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d); } else { _tcsncpy(ppd.lptzContactName, wproto, 256); _tcscpy(ppd.lptzText, TranslateT("You have unread profile comments")); @@ -205,16 +205,16 @@ void NotifyFriendRequest() { MultiByteToWideChar(code_page, 0, MODULE, -1, wproto, 256); #endif - PopupData *pd = new PopupData; + PopupProcData *pd = new PopupProcData; pd->url = strdup(URL_FRIEND); pd->bWnd = &bWndFriendPopup; - if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { - POPUPDATACLASS d = {sizeof(d), popup_class_name}; + if(ServiceExists(MS_YAPP_CLASSINSTANCE)) { + PopupClassInstance d = {sizeof(d), popup_class_name}; d.ptszTitle = wproto; d.ptszText = TranslateT("You have new friend requests"); - d.PluginData = (void *)pd; - CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d); + d.opaque = (void *)pd; + CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d); } else { _tcsncpy(ppd.lptzContactName, wproto, 256); _tcscpy(ppd.lptzText, TranslateT("You have new friend requests")); @@ -243,18 +243,18 @@ void NotifyPictureComment() { MultiByteToWideChar(code_page, 0, MODULE, -1, wproto, 256); #endif - PopupData *pd = new PopupData; + PopupProcData *pd = new PopupProcData; char url[1024]; mir_snprintf(url, 1024, URL_PICTURE, DBGetContactSettingDword(0, MODULE, "UID", 0)); pd->url = strdup(url); pd->bWnd = &bWndPicPopup; - if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { - POPUPDATACLASS d = {sizeof(d), popup_class_name}; + if(ServiceExists(MS_YAPP_CLASSINSTANCE)) { + PopupClassInstance d = {sizeof(d), popup_class_name}; d.ptszTitle = wproto; d.ptszText = TranslateT("You have unread picture comments"); - d.PluginData = (void *)pd; - CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d); + d.opaque = (void *)pd; + CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d); } else { _tcsncpy(ppd.lptzContactName, wproto, 256); _tcscpy(ppd.lptzText, TranslateT("You have unread picture comments")); @@ -283,16 +283,16 @@ void NotifyBlogSubscriptPost() { MultiByteToWideChar(code_page, 0, MODULE, -1, wproto, 256); #endif - PopupData *pd = new PopupData; + PopupProcData *pd = new PopupProcData; pd->url = strdup(URL_BLOGSUB); pd->bWnd = &bWndBlogSubPopup; - if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { - POPUPDATACLASS d = {sizeof(d), popup_class_name}; + if(ServiceExists(MS_YAPP_CLASSINSTANCE)) { + PopupClassInstance 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); + d.opaque = (void *)pd; + CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d); } else { _tcsncpy(ppd.lptzContactName, wproto, 256); _tcscpy(ppd.lptzText, TranslateT("You have unread log subscription posts")); @@ -321,7 +321,7 @@ void NotifyUnknown(char *name) { MultiByteToWideChar(code_page, 0, MODULE, -1, wproto, 256); #endif - PopupData *pd = new PopupData; + PopupProcData *pd = new PopupProcData; pd->url = strdup(URL_HOME); pd->bWnd = &bWndUnknownPopup; @@ -335,12 +335,12 @@ void NotifyUnknown(char *name) { 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}; + if(ServiceExists(MS_YAPP_CLASSINSTANCE)) { + PopupClassInstance d = {sizeof(d), popup_class_name}; d.ptszTitle = wproto; d.ptszText = text; - d.PluginData = (void *)pd; - CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d); + d.opaque = (void *)pd; + CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d); } else { _tcsncpy(ppd.lptzContactName, wproto, 256); _tcscpy(ppd.lptzText, text); @@ -455,7 +455,7 @@ void InitNotifications() { } hProtoIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MYSPACE), IMAGE_ICON, SM_CXSMICON, SM_CYSMICON, 0); - if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { + if(ServiceExists(MS_YAPP_REGISTERCLASS)) { TCHAR tmod[128]; #ifdef _UNICODE MultiByteToWideChar(code_page, 0, MODULE, -1, tmod, 128); @@ -465,15 +465,15 @@ void InitNotifications() { mir_snprintf(popup_class_name, 128, "%s/Notify", MODULE); - POPUPCLASS test = {0}; + PopupClass test = {0}; test.cbSize = sizeof(test); test.flags = PCF_TCHAR; test.hIcon = hProtoIcon; - test.iSeconds = -1; + test.timeout = -1; test.ptszDescription = tmod; test.pszName = popup_class_name; - test.PluginWindowProc = NotifyPopupWindowProc; - CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&test); + test.windowProc = NotifyPopupWindowProc; + CallService(MS_YAPP_REGISTERCLASS, 0, (WPARAM)&test); } } -- cgit v1.2.3