summarylogtreecommitdiffstats
path: root/fix_groupchat.patch
blob: e55fe5b1e9c84e4ea9a31c849b7c65c5649885fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
--- a/src/srvc_place.c	2013-10-02 13:49:18.048588870 -0500
+++ b/src/srvc_place.c	2013-10-02 13:50:18.027648225 -0500
@@ -37,6 +37,16 @@
 #define PROTOCOL_TYPE  0x00
 #define PROTOCOL_VER   0x05
 
+/*
+  As of Sametime ~v8.5, there's a slightly different group chat invite message.
+  This identifies the earliest server version using the new format. Currently,
+  it's set for 8.5.1. If other people are having issues, we'll need to decrease
+  this to their version.
+*/
+#define NEW_FORMAT_SERVER_VER_MAJOR  0x001e
+#define NEW_FORMAT_SERVER_VER_MINOR  0x196f
+
+#define GUINT(val)     (GPOINTER_TO_UINT((val)))
 
 enum incoming_msg {
   msg_in_JOIN_RESPONSE  = 0x0000,  /* ? */
@@ -163,6 +173,7 @@
   guint16 login_type;
   guint32 unknown_a;
   guint32 unknown_b;
+  char *extraname;
 };
 
 
@@ -187,6 +198,7 @@
   mwIdBlock_clear(&p->idb);
   g_free(p->login_id);
   g_free(p->name);
+  g_free(p->extraname);
   g_free(p);
 }
 
@@ -392,6 +404,9 @@
   guint16_get(b, &pm->login_type);
   guint32_get(b, &pm->unknown_a);
   guint32_get(b, &pm->unknown_b);
+  /* TODO: Since the Notes upgrade, an extra name string is sent to 
+           recv_SECTION_LIST(). It might be sent here, but since we're only 
+           parsing one user, it probably doesn't matter here. */
 
   PUT_MEMBER(place, pm);
   if(srvc->handler && srvc->handler->peerJoined)
@@ -517,8 +532,18 @@
 
 static int recv_SECTION_LIST(struct mwPlace *place,
 			     struct mwGetBuffer *b) {
-  int ret = 0;
+  int ret = 0, major, minor;
   guint32 sec, count;
+  struct mwSession *session;
+  gboolean newMsgFormat;
+
+  /* Check the server version to see if the message uses the new format */
+  session = mwService_getSession(MW_SERVICE(place->service));
+  major = GUINT(mwSession_getProperty(session, mwSession_SERVER_VER_MAJOR));
+  minor = GUINT(mwSession_getProperty(session, mwSession_SERVER_VER_MINOR));
+  newMsgFormat = (major == NEW_FORMAT_SERVER_VER_MAJOR
+                    && minor >= NEW_FORMAT_SERVER_VER_MINOR)
+                    || major > NEW_FORMAT_SERVER_VER_MAJOR;
 
   mwGetBuffer_advance(b, 4);
   guint32_get(b, &sec);
@@ -542,6 +567,10 @@
     guint32_get(b, &m->unknown_a);
     guint32_get(b, &m->unknown_b);
 
+    if(newMsgFormat) {
+        mwString_get(b, &m->extraname);
+    }
+
     PUT_MEMBER(place, m);
   }