SHA256
8
0
forked from pool/meanwhile
Files
meanwhile/meanwhile-fix-groupchat.patch

77 lines
2.4 KiB
Diff
Raw Permalink Normal View History

--- a/src/srvc_place.c
+++ b/src/srvc_place.c
@@ -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 0x213f
+
+#define GUINT(val) (GPOINTER_TO_UINT((val)))
enum incoming_msg {
msg_in_JOIN_RESPONSE = 0x0000, /* ? */
@@ -163,6 +173,7 @@ struct place_member {
guint16 login_type;
guint32 unknown_a;
guint32 unknown_b;
+ char *extraname;
};
@@ -187,6 +198,7 @@ static void member_free(struct place_member *p) {
mwIdBlock_clear(&p->idb);
g_free(p->login_id);
g_free(p->name);
+ g_free(p->extraname);
g_free(p);
}
@@ -392,6 +404,9 @@ static int recv_SECTION_PEER_JOIN(struct mwPlace *place,
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_PEER(struct mwPlace *place,
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);
@@ -543,6 +568,10 @@ static int recv_SECTION_LIST(struct mwPlace *place,
guint32_get(b, &m->unknown_a);
guint32_get(b, &m->unknown_b);
+ if(newMsgFormat) {
+ mwString_get(b, &m->extraname);
+ }
+
PUT_MEMBER(place, m);
}