summaryrefslogtreecommitdiff
path: root/MySpace/proto.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'MySpace/proto.cpp')
-rw-r--r--MySpace/proto.cpp44
1 files changed, 43 insertions, 1 deletions
diff --git a/MySpace/proto.cpp b/MySpace/proto.cpp
index 7633141..fbd9e69 100644
--- a/MySpace/proto.cpp
+++ b/MySpace/proto.cpp
@@ -7,6 +7,11 @@
#include <malloc.h>
#include <ctime>
+// in case it's not in m_protosvc.h
+#ifndef PF4_IMSENDOFFLINE
+#define PF4_IMSENDOFFLINE 0x00000100 // protocol is able to send offline messages (v.0.8.0+ 2007/10/3)
+#endif
+
#define FAILED_MESSAGE_HANDLE 99998
int msg_id = 1;
@@ -385,6 +390,41 @@ int GetAvatarInfo(WPARAM wParam,LPARAM lParam) {
}
+int GetMyAvatar(WPARAM wParam,LPARAM lParam) {
+ char *buff = (char *)wParam;
+ DBVARIANT dbv;
+ if(!DBGetContactSettingString(0, MODULE, "ImageURL", &dbv)) {
+ mir_snprintf(buff, (int)lParam, "%s", dbv.pszVal);
+ DBFreeVariant(&dbv);
+ return 0;
+ }
+ return 1;
+}
+
+int GetAvatarCaps(WPARAM wParam,LPARAM lParam) {
+ switch(wParam) {
+ case AF_MAXSIZE:
+ {
+ POINT *p = (POINT *)lParam;
+ p->x = p->y = -1;
+ }
+ return 0;
+ case AF_PROPORTION:
+ return PIP_NONE;
+ case AF_FORMATSUPPORTED:
+ return 1;
+ case AF_ENABLED:
+ return 1;
+ case AF_DONTNEEDDELAYS:
+ return 1;
+ case AF_MAXFILESIZE:
+ return 0;
+ case AF_DELAYAFTERFAIL:
+ return 0;
+ }
+ return 0;
+}
+
int ContactDeleted(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = (HANDLE)wParam;
int uid = DBGetContactSettingDword(hContact, MODULE, "UID", 0);
@@ -463,7 +503,7 @@ int SettingChanged(WPARAM wParam, LPARAM lParam) {
return 0;
}
-#define NUM_FILTER_SERVICES 17
+#define NUM_FILTER_SERVICES 19
HANDLE hServices[NUM_FILTER_SERVICES];
HANDLE hEventContactDeleted, hEventIdle, hEventSettingChanged;
@@ -492,6 +532,8 @@ void CreateProtoServices() {
hServices[i++] = CreateProtoServiceFunction(MODULE, PSS_USERISTYPING, SendTyping);
hServices[i++] = CreateProtoServiceFunction(MODULE, PS_GETAVATARINFO, GetAvatarInfo);
+ hServices[i++] = CreateProtoServiceFunction(MODULE, PS_GETMYAVATAR, GetMyAvatar);
+ hServices[i++] = CreateProtoServiceFunction(MODULE, PS_GETAVATARCAPS, GetAvatarCaps);
// remember to modify the NUM_FILTER_SERVICES #define above if you add more services!
hEventContactDeleted = HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted);