From ffa0fa4f142eb6ee5f919a96b10f36363c511b16 Mon Sep 17 00:00:00 2001 From: sje Date: Tue, 10 Jul 2007 14:23:37 +0000 Subject: implemented zaps git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@269 4f64403b-2f21-0410-a795-97e2b3489a10 --- MySpace/MySpace.cpp | 3 +++ MySpace/MySpace.rc | 1 + MySpace/MySpace_8.vcproj | 8 ++++++++ MySpace/common.h | 3 +++ MySpace/notifications.cpp | 16 ++++++++-------- MySpace/resource.h | 4 ++-- MySpace/server_con.cpp | 22 ++++++++++++++++++++++ MySpace/server_con.h | 2 ++ MySpace/version.h | 2 +- 9 files changed, 50 insertions(+), 11 deletions(-) diff --git a/MySpace/MySpace.cpp b/MySpace/MySpace.cpp index 4da6231..921d616 100644 --- a/MySpace/MySpace.cpp +++ b/MySpace/MySpace.cpp @@ -8,6 +8,7 @@ #include "menu.h" #include "arc4.h" #include "notifications.h" +#include "srmm_icon.h" /////////////////////////////////////////////// // Common Plugin Stuff @@ -89,6 +90,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) { InitNetlib(); InitMenu(); InitNotifications(); + InitSRMMIcon(); return 0; } @@ -158,6 +160,7 @@ extern "C" __declspec (dllexport) int Load(PLUGINLINK *link) { extern "C" __declspec (dllexport) int Unload(void) { UnhookEvent(hModulesLoaded); + DeinitSRMMIcon(); DeinitMenu(); DeinitNetlib(); DeinitProto(); diff --git a/MySpace/MySpace.rc b/MySpace/MySpace.rc index de4d472..313f698 100644 --- a/MySpace/MySpace.rc +++ b/MySpace/MySpace.rc @@ -142,6 +142,7 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_MYSPACE ICON "MySpace.ico" +IDI_ZAPS ICON "icon1.ico" #endif // English (Australia) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/MySpace/MySpace_8.vcproj b/MySpace/MySpace_8.vcproj index 57ddce5..7a5bc89 100644 --- a/MySpace/MySpace_8.vcproj +++ b/MySpace/MySpace_8.vcproj @@ -384,6 +384,10 @@ RelativePath=".\server_con.cpp" > + + + + diff --git a/MySpace/common.h b/MySpace/common.h index 9eb90b2..e7addcb 100644 --- a/MySpace/common.h +++ b/MySpace/common.h @@ -48,9 +48,12 @@ #include #include #include +#include +#include #include #include +#include extern MM_INTERFACE mmi; diff --git a/MySpace/notifications.cpp b/MySpace/notifications.cpp index 25b732b..d29db18 100644 --- a/MySpace/notifications.cpp +++ b/MySpace/notifications.cpp @@ -81,8 +81,8 @@ void NotifyMail() { if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { POPUPDATACLASS d = {sizeof(d), popup_class_name}; - d.pwszTitle = (wchar_t *)wproto; - d.pwszText = (wchar_t *)TranslateT("You have unread mail"); + d.ptszTitle = wproto; + d.ptszText = TranslateT("You have unread mail"); d.PluginData = (void *)pd; CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d); } else { @@ -121,8 +121,8 @@ void NotifyBlogComment() { if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { POPUPDATACLASS d = {sizeof(d), popup_class_name}; - d.pwszTitle = (wchar_t *)wproto; - d.pwszText = (wchar_t *)TranslateT("You have unread blog comments"); + d.ptszTitle = wproto; + d.ptszText = TranslateT("You have unread blog comments"); d.PluginData = (void *)pd; CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d); } else { @@ -162,8 +162,8 @@ void NotifyProfileComment() { if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { POPUPDATACLASS d = {sizeof(d), popup_class_name}; - d.pwszTitle = (wchar_t *)wproto; - d.pwszText = (wchar_t *)TranslateT("You have unread profile comments"); + d.ptszTitle = wproto; + d.ptszText = TranslateT("You have unread profile comments"); d.PluginData = (void *)pd; CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d); } else { @@ -200,8 +200,8 @@ void NotifyFriendRequest() { if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { POPUPDATACLASS d = {sizeof(d), popup_class_name}; - d.pwszTitle = (wchar_t *)wproto; - d.pwszText = (wchar_t *)TranslateT("You have new friend requests"); + d.ptszTitle = wproto; + d.ptszText = TranslateT("You have new friend requests"); d.PluginData = (void *)pd; CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d); } else { diff --git a/MySpace/resource.h b/MySpace/resource.h index 46972ab..45ab1c5 100644 --- a/MySpace/resource.h +++ b/MySpace/resource.h @@ -5,19 +5,19 @@ #define IDD_OPT1 109 #define IDD_NICK 121 #define IDI_MYSPACE 122 +#define IDI_ZAPS 123 #define IDC_ED_EMAIL 1001 #define IDC_ED_PW 1002 #define IDC_ED_NICK 1002 #define IDC_BTN_CHECK 1003 #define IDC_ST_MSG 1004 -#define IDC_CUSTOM1 1005 #define IDC_LNK_NEWACCOUNT 1005 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 123 +#define _APS_NEXT_RESOURCE_VALUE 125 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1006 #define _APS_NEXT_SYMED_VALUE 101 diff --git a/MySpace/server_con.cpp b/MySpace/server_con.cpp index 0ef40e6..71ebe09 100644 --- a/MySpace/server_con.cpp +++ b/MySpace/server_con.cpp @@ -36,6 +36,10 @@ int signon_status = ID_STATUS_ONLINE; char signon_status_msg[512] = {0}; CRITICAL_SECTION write_cs; +char *zap_array[11] = { + "zap", "whack", "torch", "smooch", "hug", "bslap", "goose", "hi-five", "punk'd", "raspberry", 0 +}; + bool WriteData(char *fn, int fn_size, char *data, int data_size) { char szTempPath[MAX_PATH], szTempFileName[MAX_PATH]; @@ -481,6 +485,24 @@ void __cdecl ServerThreadFunc(void*) { CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)5); else if(strcmp(smsg, "%stoptyping%") == 0) { CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)0); + } else if(strncmp(smsg, "!!!ZAP_SEND!!!=RTE_BTN_ZAPS_", 28) == 0) { + // recvd a zap + int zapnum = smsg[28] - '0'; + char rmsg[512]; + mir_snprintf(rmsg, 512, Translate("You received a ZAP: %s"), Translate(zap_array[zapnum])); + + PROTORECVEVENT pre = {0}; + pre.flags = PREF_UTF; + pre.szMessage = rmsg; + pre.timestamp = (DWORD)time(0); + + CCSDATA css = {0}; + css.hContact = hContact; + css.lParam = (LPARAM)⪯ + css.szProtoService = PSR_MESSAGE; + + CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&css); + } } } diff --git a/MySpace/server_con.h b/MySpace/server_con.h index c81ce07..4064744 100644 --- a/MySpace/server_con.h +++ b/MySpace/server_con.h @@ -25,4 +25,6 @@ typedef struct { int uid; } MYPROTOSEARCHRESULT; +extern char *zap_array[]; + #endif diff --git a/MySpace/version.h b/MySpace/version.h index 96a627f..1f73ce4 100644 --- a/MySpace/version.h +++ b/MySpace/version.h @@ -5,7 +5,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 0 #define __RELEASE_NUM 4 -#define __BUILD_NUM 0 +#define __BUILD_NUM 1 #define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM #define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM -- cgit v1.2.3