changeset 30007:0d3145e6b1d6

Change the oscar capabilities variable to be a guint64 everywhere instead of an enum, which can be 32 bits
author Mark Doliner <mark@kingant.net>
date Thu, 18 Mar 2010 04:53:49 +0000
parents ffc1f997cb91
children 59f4012b2b94
files libpurple/protocols/oscar/family_locate.c libpurple/protocols/oscar/oscar.c libpurple/protocols/oscar/oscar.h libpurple/protocols/oscar/peer.c libpurple/protocols/oscar/peer.h libpurple/protocols/oscar/tlv.c
diffstat 6 files changed, 66 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/family_locate.c	Wed Mar 17 20:42:48 2010 +0000
+++ b/libpurple/protocols/oscar/family_locate.c	Thu Mar 18 04:53:49 2010 +0000
@@ -577,10 +577,10 @@
 	return NULL;
 }
 
-guint32
+guint64
 aim_locate_getcaps(OscarData *od, ByteStream *bs, int len)
 {
-	guint32 flags = 0;
+	guint64 flags = 0;
 	int offset;
 
 	for (offset = 0; byte_stream_empty(bs) && (offset < len); offset += 0x10) {
@@ -637,10 +637,10 @@
 	return result;
 }
 
-guint32
+guint64
 aim_locate_getcaps_short(OscarData *od, ByteStream *bs, int len)
 {
-	guint32 flags = 0;
+	guint64 flags = 0;
 	int offset;
 
 	for (offset = 0; byte_stream_empty(bs) && (offset < len); offset += 0x02) {
@@ -667,7 +667,7 @@
 }
 
 int
-byte_stream_putcaps(ByteStream *bs, guint32 caps)
+byte_stream_putcaps(ByteStream *bs, guint64 caps)
 {
 	int i;
 
@@ -1400,7 +1400,7 @@
  * Subtype 0x0004 - Set your client's capabilities.
  */
 int
-aim_locate_setcaps(OscarData *od, guint32 caps)
+aim_locate_setcaps(OscarData *od, guint64 caps)
 {
 	FlapConnection *conn;
 	PurpleAccount *account = purple_connection_get_account(od->gc);
--- a/libpurple/protocols/oscar/oscar.c	Wed Mar 17 20:42:48 2010 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Thu Mar 18 04:53:49 2010 +0000
@@ -71,9 +71,18 @@
 
 #define OSCAR_CONNECT_STEPS 6
 
-static OscarCapability purple_caps = (OSCAR_CAPABILITY_CHAT | OSCAR_CAPABILITY_BUDDYICON | OSCAR_CAPABILITY_DIRECTIM |
-									  OSCAR_CAPABILITY_SENDFILE | OSCAR_CAPABILITY_UNICODE | OSCAR_CAPABILITY_INTEROPERATE |
-									  OSCAR_CAPABILITY_SHORTCAPS | OSCAR_CAPABILITY_TYPING |  OSCAR_CAPABILITY_ICQSERVERRELAY | OSCAR_CAPABILITY_NEWCAPS | OSCAR_CAPABILITY_XTRAZ);
+static guint64 purple_caps =
+	OSCAR_CAPABILITY_CHAT
+		| OSCAR_CAPABILITY_BUDDYICON
+		| OSCAR_CAPABILITY_DIRECTIM
+		| OSCAR_CAPABILITY_SENDFILE
+		| OSCAR_CAPABILITY_UNICODE
+		| OSCAR_CAPABILITY_INTEROPERATE
+		| OSCAR_CAPABILITY_SHORTCAPS
+		| OSCAR_CAPABILITY_TYPING
+		| OSCAR_CAPABILITY_ICQSERVERRELAY
+		| OSCAR_CAPABILITY_NEWCAPS
+		| OSCAR_CAPABILITY_XTRAZ;
 
 static guint8 features_aim[] = {0x01, 0x01, 0x01, 0x02};
 static guint8 features_icq[] = {0x01, 0x06};
@@ -673,7 +682,7 @@
 	return g_string_free(cpy, FALSE);
 }
 
-static gchar *oscar_caps_to_string(OscarCapability caps)
+static gchar *oscar_caps_to_string(guint64 caps)
 {
 	GString *str;
 	const gchar *tmp;
--- a/libpurple/protocols/oscar/oscar.h	Wed Mar 17 20:42:48 2010 +0000
+++ b/libpurple/protocols/oscar/oscar.h	Thu Mar 18 04:53:49 2010 +0000
@@ -344,44 +344,39 @@
 	OSCAR_DISCONNECT_RETRYING /* peer connections only */
 } OscarDisconnectReason;
 
-typedef enum
-{
-	OSCAR_CAPABILITY_BUDDYICON            = 0x00000001,
-	OSCAR_CAPABILITY_TALK                 = 0x00000002,
-	OSCAR_CAPABILITY_DIRECTIM             = 0x00000004,
-	OSCAR_CAPABILITY_CHAT                 = 0x00000008,
-	OSCAR_CAPABILITY_GETFILE              = 0x00000010,
-	OSCAR_CAPABILITY_SENDFILE             = 0x00000020,
-	OSCAR_CAPABILITY_GAMES                = 0x00000040,
-	OSCAR_CAPABILITY_ADDINS               = 0x00000080,
-	OSCAR_CAPABILITY_SENDBUDDYLIST        = 0x00000100,
-	OSCAR_CAPABILITY_GAMES2               = 0x00000200,
-	OSCAR_CAPABILITY_ICQ_DIRECT           = 0x00000400,
-	OSCAR_CAPABILITY_APINFO               = 0x00000800,
-	OSCAR_CAPABILITY_ICQRTF               = 0x00001000,
-	OSCAR_CAPABILITY_EMPTY                = 0x00002000,
-	OSCAR_CAPABILITY_ICQSERVERRELAY       = 0x00004000,
-	OSCAR_CAPABILITY_UNICODEOLD           = 0x00008000,
-	OSCAR_CAPABILITY_TRILLIANCRYPT        = 0x00010000,
-	OSCAR_CAPABILITY_UNICODE              = 0x00020000,
-	OSCAR_CAPABILITY_INTEROPERATE         = 0x00040000,
-	OSCAR_CAPABILITY_SHORTCAPS            = 0x00080000,
-	OSCAR_CAPABILITY_HIPTOP               = 0x00100000,
-	OSCAR_CAPABILITY_SECUREIM             = 0x00200000,
-	OSCAR_CAPABILITY_SMS                  = 0x00400000,
-	OSCAR_CAPABILITY_VIDEO                = 0x00800000,
-	OSCAR_CAPABILITY_ICHATAV              = 0x01000000,
-	OSCAR_CAPABILITY_LIVEVIDEO            = 0x02000000,
-	OSCAR_CAPABILITY_CAMERA               = 0x04000000,
-	OSCAR_CAPABILITY_ICHAT_SCREENSHARE    = 0x08000000,
-	OSCAR_CAPABILITY_TYPING               = 0x10000000,
-	OSCAR_CAPABILITY_NEWCAPS              = 0x20000000,
-	OSCAR_CAPABILITY_XTRAZ                = 0x40000000,
-	OSCAR_CAPABILITY_GENERICUNKNOWN       = 0x80000000,
-#warning Fix OSCAR_CAPABILITY_LAST situation
-	// TODO: We're out of bits.  Rework things that depend on this or remove some capability. (Or, ensure this is a 64-bit type.)
-	OSCAR_CAPABILITY_LAST                 = 0x100000000	
-} OscarCapability;
+#define OSCAR_CAPABILITY_BUDDYICON             0x0000000000000001
+#define OSCAR_CAPABILITY_TALK                  0x0000000000000002
+#define OSCAR_CAPABILITY_DIRECTIM              0x0000000000000004
+#define OSCAR_CAPABILITY_CHAT                  0x0000000000000008
+#define OSCAR_CAPABILITY_GETFILE               0x0000000000000010
+#define OSCAR_CAPABILITY_SENDFILE              0x0000000000000020
+#define OSCAR_CAPABILITY_GAMES                 0x0000000000000040
+#define OSCAR_CAPABILITY_ADDINS                0x0000000000000080
+#define OSCAR_CAPABILITY_SENDBUDDYLIST         0x0000000000000100
+#define OSCAR_CAPABILITY_GAMES2                0x0000000000000200
+#define OSCAR_CAPABILITY_ICQ_DIRECT            0x0000000000000400
+#define OSCAR_CAPABILITY_APINFO                0x0000000000000800
+#define OSCAR_CAPABILITY_ICQRTF                0x0000000000001000
+#define OSCAR_CAPABILITY_EMPTY                 0x0000000000002000
+#define OSCAR_CAPABILITY_ICQSERVERRELAY        0x0000000000004000
+#define OSCAR_CAPABILITY_UNICODEOLD            0x0000000000008000
+#define OSCAR_CAPABILITY_TRILLIANCRYPT         0x0000000000010000
+#define OSCAR_CAPABILITY_UNICODE               0x0000000000020000
+#define OSCAR_CAPABILITY_INTEROPERATE          0x0000000000040000
+#define OSCAR_CAPABILITY_SHORTCAPS             0x0000000000080000
+#define OSCAR_CAPABILITY_HIPTOP                0x0000000000100000
+#define OSCAR_CAPABILITY_SECUREIM              0x0000000000200000
+#define OSCAR_CAPABILITY_SMS                   0x0000000000400000
+#define OSCAR_CAPABILITY_VIDEO                 0x0000000000800000
+#define OSCAR_CAPABILITY_ICHATAV               0x0000000001000000
+#define OSCAR_CAPABILITY_LIVEVIDEO             0x0000000002000000
+#define OSCAR_CAPABILITY_CAMERA                0x0000000004000000
+#define OSCAR_CAPABILITY_ICHAT_SCREENSHARE     0x0000000008000000
+#define OSCAR_CAPABILITY_TYPING                0x0000000010000000
+#define OSCAR_CAPABILITY_NEWCAPS               0x0000000020000000
+#define OSCAR_CAPABILITY_XTRAZ                 0x0000000040000000
+#define OSCAR_CAPABILITY_GENERICUNKNOWN        0x0000000080000000
+#define OSCAR_CAPABILITY_LAST                  0x0000000100000000
 
 /*
  * Byte Stream type. Sort of.
@@ -1077,7 +1072,7 @@
 	guint32 membersince; /* time_t */
 	guint32 onlinesince; /* time_t */
 	guint32 sessionlen;  /* in seconds */
-	guint32 capabilities;
+	guint64 capabilities;
 	struct {
 		guint32 status;
 		guint32 ipaddr;
@@ -1142,7 +1137,7 @@
 void aim_locate_dorequest(OscarData *od);
 
 /* 0x0002 */ int aim_locate_reqrights(OscarData *od);
-/* 0x0004 */ int aim_locate_setcaps(OscarData *od, guint32 caps);
+/* 0x0004 */ int aim_locate_setcaps(OscarData *od, guint64 caps);
 /* 0x0004 */ int aim_locate_setprofile(OscarData *od, const char *profile_encoding, const gchar *profile, const int profile_len, const char *awaymsg_encoding, const gchar *awaymsg, const int awaymsg_len);
 /* 0x0005 */ int aim_locate_getinfo(OscarData *od, const char *, guint16);
 /* 0x0009 */ int aim_locate_setdirinfo(OscarData *od, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, guint16 privacy);
@@ -1150,8 +1145,8 @@
 /* 0x000f */ int aim_locate_setinterests(OscarData *od, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, guint16 privacy);
 /* 0x0015 */ int aim_locate_getinfoshort(OscarData *od, const char *bn, guint32 flags);
 
-guint32 aim_locate_getcaps(OscarData *od, ByteStream *bs, int len);
-guint32 aim_locate_getcaps_short(OscarData *od, ByteStream *bs, int len);
+guint64 aim_locate_getcaps(OscarData *od, ByteStream *bs, int len);
+guint64 aim_locate_getcaps_short(OscarData *od, ByteStream *bs, int len);
 void aim_info_free(aim_userinfo_t *);
 int aim_info_extract(OscarData *od, ByteStream *bs, aim_userinfo_t *);
 int aim_putuserinfo(ByteStream *bs, aim_userinfo_t *info);
@@ -1487,7 +1482,7 @@
 int aim_tlvlist_add_16(GSList **list, const guint16 type, const guint16 value);
 int aim_tlvlist_add_32(GSList **list, const guint16 type, const guint32 value);
 int aim_tlvlist_add_str(GSList **list, const guint16 type, const char *value);
-int aim_tlvlist_add_caps(GSList **list, const guint16 type, const guint32 caps, const char *mood);
+int aim_tlvlist_add_caps(GSList **list, const guint16 type, const guint64 caps, const char *mood);
 int aim_tlvlist_add_userinfo(GSList **list, guint16 type, aim_userinfo_t *userinfo);
 int aim_tlvlist_add_chatroom(GSList **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance);
 int aim_tlvlist_add_frozentlvlist(GSList **list, guint16 type, GSList **tl);
@@ -1650,7 +1645,7 @@
 int byte_stream_putstr(ByteStream *bs, const char *str);
 int byte_stream_putbs(ByteStream *bs, ByteStream *srcbs, int len);
 int byte_stream_putuid(ByteStream *bs, OscarData *od);
-int byte_stream_putcaps(ByteStream *bs, guint32 caps);
+int byte_stream_putcaps(ByteStream *bs, guint64 caps);
 
 /**
  * Inserts a BART asset block into the given byte stream.  The flags
--- a/libpurple/protocols/oscar/peer.c	Wed Mar 17 20:42:48 2010 +0000
+++ b/libpurple/protocols/oscar/peer.c	Thu Mar 18 04:53:49 2010 +0000
@@ -69,7 +69,7 @@
 #endif
 
 PeerConnection *
-peer_connection_find_by_type(OscarData *od, const char *bn, OscarCapability type)
+peer_connection_find_by_type(OscarData *od, const char *bn, guint64 type)
 {
 	GSList *cur;
 	PeerConnection *conn;
@@ -104,7 +104,7 @@
 }
 
 PeerConnection *
-peer_connection_new(OscarData *od, OscarCapability type, const char *bn)
+peer_connection_new(OscarData *od, guint64 type, const char *bn)
 {
 	PeerConnection *conn;
 	PurpleAccount *account;
@@ -897,7 +897,7 @@
  * Initiate a peer connection with someone.
  */
 void
-peer_connection_propose(OscarData *od, OscarCapability type, const char *bn)
+peer_connection_propose(OscarData *od, guint64 type, const char *bn)
 {
 	PeerConnection *conn;
 
--- a/libpurple/protocols/oscar/peer.h	Wed Mar 17 20:42:48 2010 +0000
+++ b/libpurple/protocols/oscar/peer.h	Thu Mar 18 04:53:49 2010 +0000
@@ -136,7 +136,7 @@
 struct _PeerConnection
 {
 	OscarData *od;
-	OscarCapability type;
+	guint64 type;
 	char *bn;
 	guchar magic[4];
 	guchar cookie[8];
@@ -228,11 +228,11 @@
  * @param type The type of the peer connection.  One of
  *        OSCAR_CAPABILITY_DIRECTIM or OSCAR_CAPABILITY_SENDFILE.
  */
-PeerConnection *peer_connection_new(OscarData *od, OscarCapability type, const char *bn);
+PeerConnection *peer_connection_new(OscarData *od, guint64 type, const char *bn);
 
 void peer_connection_destroy(PeerConnection *conn, OscarDisconnectReason reason, const gchar *error_message);
 void peer_connection_schedule_destroy(PeerConnection *conn, OscarDisconnectReason reason, const gchar *error_message);
-PeerConnection *peer_connection_find_by_type(OscarData *od, const char *bn, OscarCapability type);
+PeerConnection *peer_connection_find_by_type(OscarData *od, const char *bn, guint64 type);
 PeerConnection *peer_connection_find_by_cookie(OscarData *od, const char *bn, const guchar *cookie);
 
 void peer_connection_listen_cb(gpointer data, gint source, PurpleInputCondition cond);
@@ -241,7 +241,7 @@
 
 void peer_connection_trynext(PeerConnection *conn);
 void peer_connection_finalize_connection(PeerConnection *conn);
-void peer_connection_propose(OscarData *od, OscarCapability type, const char *bn);
+void peer_connection_propose(OscarData *od, guint64 type, const char *bn);
 void peer_connection_got_proposition(OscarData *od, const gchar *bn, const gchar *message, IcbmArgsCh2 *args);
 
 /*
--- a/libpurple/protocols/oscar/tlv.c	Wed Mar 17 20:42:48 2010 +0000
+++ b/libpurple/protocols/oscar/tlv.c	Thu Mar 18 04:53:49 2010 +0000
@@ -407,7 +407,7 @@
  * @param caps Bitfield of capability flags to send
  * @return The size of the value added.
  */
-int aim_tlvlist_add_caps(GSList **list, const guint16 type, const guint32 caps, const char *mood)
+int aim_tlvlist_add_caps(GSList **list, const guint16 type, const guint64 caps, const char *mood)
 {
 	guint8 buf[256]; /* TODO: Don't use a fixed length buffer */
 	ByteStream bs;