Mercurial > pidgin.yaz
changeset 30025:eb72ae3357dc
merge of 'a758341daab23fe08b983dd3e00c8db27e225d59'
and 'c651e3b4b90d5aa93b3e45769bab26a0d9fa9039'
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 20 Mar 2010 16:20:35 +0000 |
parents | 40fee5f86bf8 (current diff) 8a2ab625753e (diff) |
children | 4c3cc12c3a69 fce17268c9ec |
files | |
diffstat | 16 files changed, 223 insertions(+), 241 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Mar 20 16:20:09 2010 +0000 +++ b/ChangeLog Sat Mar 20 16:20:35 2010 +0000 @@ -22,6 +22,7 @@ in the distant past. (Greg McNew) * Added a menu set mood globally for all mood-supporting accounts (currently XMPP and ICQ). + * Use standard (but small) GTK+ buttons instead of custom "X" symbol. Bonjour: * Added support for IPv6. (Thanks to T_X for testing) @@ -47,6 +48,8 @@ * Direct messages to a specific resource only upon receipt of a message with content (as opposed to a typing notification, etc). (Thanks to rjoly for testing) + * When sending data using in-band-bytestreams, interpret the block-size + attribute as the size of the BASE64-encoded representation of the data. Yahoo: * Attempt to better handle transparent proxies interfering with HTTP-based
--- a/libpurple/protocols/jabber/ibb.c Sat Mar 20 16:20:09 2010 +0000 +++ b/libpurple/protocols/jabber/ibb.c Sat Mar 20 16:20:35 2010 +0000 @@ -157,6 +157,12 @@ } } +gsize +jabber_ibb_session_get_max_data_size(const JabberIBBSession *sess) +{ + return (gsize) floor((sess->block_size - 2) * (float) 3 / 4); +} + gpointer jabber_ibb_session_get_user_data(JabberIBBSession *sess) { @@ -321,7 +327,7 @@ if (state != JABBER_IBB_SESSION_OPENED) { purple_debug_error("jabber", "trying to send data on a non-open IBB session\n"); - } else if (size > jabber_ibb_session_get_block_size(sess)) { + } else if (size > jabber_ibb_session_get_max_data_size(sess)) { purple_debug_error("jabber", "trying to send a too large packet in the IBB session\n"); } else { @@ -416,6 +422,10 @@ purple_debug_info("jabber", "got %" G_GSIZE_FORMAT " bytes of data on IBB stream\n", size); + /* we accept other clients to send up to block-size + of _unencoded_ data, since there's been some confusions + regarding the interpretation of this attribute + (including previous versions of libpurple) */ if (size > jabber_ibb_session_get_block_size(sess)) { purple_debug_error("jabber", "IBB: received a too large packet\n");
--- a/libpurple/protocols/jabber/ibb.h Sat Mar 20 16:20:09 2010 +0000 +++ b/libpurple/protocols/jabber/ibb.h Sat Mar 20 16:20:35 2010 +0000 @@ -107,6 +107,10 @@ gsize jabber_ibb_session_get_block_size(const JabberIBBSession *sess); void jabber_ibb_session_set_block_size(JabberIBBSession *sess, gsize size); +/* get maximum size data block to send (in bytes) + (before encoded to BASE64) */ +gsize jabber_ibb_session_get_max_data_size(const JabberIBBSession *sess); + gpointer jabber_ibb_session_get_user_data(JabberIBBSession *sess); /* handle incoming packet */
--- a/libpurple/protocols/jabber/si.c Sat Mar 20 16:20:09 2010 +0000 +++ b/libpurple/protocols/jabber/si.c Sat Mar 20 16:20:35 2010 +0000 @@ -1075,6 +1075,9 @@ jabber_si_xfer_ibb_error_cb); jsx->ibb_session = sess; + /* we handle up to block-size bytes of decoded data, to handle + clients interpreting the block-size attribute as that + (see also remark in ibb.c) */ jsx->ibb_buffer = purple_circ_buffer_new(jabber_ibb_session_get_block_size(sess)); @@ -1103,8 +1106,8 @@ { JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; JabberIBBSession *sess = jsx->ibb_session; - gsize packet_size = len < jabber_ibb_session_get_block_size(sess) ? - len : jabber_ibb_session_get_block_size(sess); + gsize packet_size = len < jabber_ibb_session_get_max_data_size(sess) ? + len : jabber_ibb_session_get_max_data_size(sess); jabber_ibb_session_send_data(sess, buffer, packet_size); @@ -1170,7 +1173,7 @@ purple_xfer_set_write_fnc(xfer, jabber_si_xfer_ibb_write); jsx->ibb_buffer = - purple_circ_buffer_new(jabber_ibb_session_get_block_size(jsx->ibb_session)); + purple_circ_buffer_new(jabber_ibb_session_get_max_data_size(jsx->ibb_session)); /* open the IBB session */ jabber_ibb_session_open(jsx->ibb_session);
--- a/libpurple/protocols/oscar/family_locate.c Sat Mar 20 16:20:09 2010 +0000 +++ b/libpurple/protocols/oscar/family_locate.c Sat Mar 20 16:20:35 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/msgcookie.c Sat Mar 20 16:20:09 2010 +0000 +++ b/libpurple/protocols/oscar/msgcookie.c Sat Mar 20 16:20:35 2010 +0000 @@ -179,7 +179,7 @@ } /* XXX I hate switch */ -int aim_msgcookie_gettype(int type) +int aim_msgcookie_gettype(guint64 type) { /* XXX: hokey-assed. needs fixed. */ switch(type) {
--- a/libpurple/protocols/oscar/oscar.c Sat Mar 20 16:20:09 2010 +0000 +++ b/libpurple/protocols/oscar/oscar.c Sat Mar 20 16:20:35 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}; @@ -471,7 +480,7 @@ charsetstr1 = "UTF-8"; charsetstr2 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); } - + purple_debug_info("oscar", "Parsing IM part, charset=0x%04hx, charsubset=0x%04hx, datalen=%" G_GSIZE_FORMAT ", choice1=%s, choice2=%s, choice3=%s\n", charset, charsubset, datalen, charsetstr1, charsetstr2, (charsetstr3 ? charsetstr3 : "")); @@ -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; @@ -2594,7 +2603,6 @@ PurpleAccount *account; PurpleMessageFlags flags = 0; char *message = NULL; - char *rtfmsg = NULL; g_return_val_if_fail(od != NULL, 0); g_return_val_if_fail(od->gc != NULL, 0); @@ -2606,8 +2614,9 @@ if (args == NULL) return 0; - purple_debug_misc("oscar", "Incoming rendezvous message of type %u, " - "user %s, status %hu\n", args->type, userinfo->bn, args->status); + purple_debug_misc("oscar", "Incoming rendezvous message of type %" + G_GUINT64_FORMAT ", user %s, status %hu\n", + args->type, userinfo->bn, args->status); if (args->msg != NULL) { @@ -2624,20 +2633,6 @@ } } - if (args->info.rtfmsg.rtfmsg != NULL) - { - if (args->encoding != NULL) - { - char *encoding = NULL; - encoding = oscar_encoding_extract(args->encoding); - rtfmsg = oscar_encoding_to_utf8(account, encoding, args->info.rtfmsg.rtfmsg, - strlen(args->info.rtfmsg.rtfmsg)); - g_free(encoding); - } else { - if (g_utf8_validate(args->info.rtfmsg.rtfmsg, strlen(args->info.rtfmsg.rtfmsg), NULL)) - rtfmsg = g_strdup(args->info.rtfmsg.rtfmsg); - } - } if (args->type & OSCAR_CAPABILITY_CHAT) { char *encoding, *utf8name, *tmp; @@ -2725,30 +2720,35 @@ { purple_debug_info("oscar", "Got an ICQ Server Relay message of " "type %d\n", args->info.rtfmsg.msgtype); - purple_debug_info("oscar", "Sending X-Status Reply\n"); - - if(args->info.rtfmsg.msgtype == 26) - icq_relay_xstatus(od, userinfo->bn, args->cookie); - - if(args->info.rtfmsg.msgtype == 1) + + if (args->info.rtfmsg.msgtype == 1) { - if(rtfmsg) + if (args->info.rtfmsg.rtfmsg != NULL) { - serv_got_im(gc, userinfo->bn, rtfmsg, flags, - time(NULL)); + char *rtfmsg = NULL; + if (args->encoding != NULL) { + char *encoding = oscar_encoding_extract(args->encoding); + rtfmsg = oscar_encoding_to_utf8(account, encoding, + args->info.rtfmsg.rtfmsg, strlen(args->info.rtfmsg.rtfmsg)); + g_free(encoding); + } else { + if (g_utf8_validate(args->info.rtfmsg.rtfmsg, strlen(args->info.rtfmsg.rtfmsg), NULL)) + rtfmsg = g_strdup(args->info.rtfmsg.rtfmsg); + } + if (rtfmsg) { + serv_got_im(gc, userinfo->bn, rtfmsg, flags, time(NULL)); + g_free(rtfmsg); + } } - else - { - serv_got_im(gc, userinfo->bn, - args->info.rtfmsg.rtfmsg, flags, - time(NULL)); - } - } + } else if (args->info.rtfmsg.msgtype == 26) + purple_debug_info("oscar", "Sending X-Status Reply\n"); + icq_relay_xstatus(od, userinfo->bn, args->cookie); + } else { - purple_debug_error("oscar", "Unknown request class %hu\n", - args->type); + purple_debug_error("oscar", "Unknown request class %" + G_GUINT64_FORMAT "\n", args->type); } g_free(message); @@ -3331,9 +3331,9 @@ /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ statusmsg = oscar_icqstatus(state); splitmsg = g_strsplit(msg, "\r\n", 0); - + user_info = purple_notify_user_info_new(); - + purple_notify_user_info_add_pair(user_info, _("UIN"), who); purple_notify_user_info_add_pair(user_info, _("Status"), statusmsg); purple_notify_user_info_add_section_break(user_info); @@ -4758,8 +4758,8 @@ img = purple_buddy_icons_find_account_icon(account); if (img) { gconstpointer data = purple_imgstore_get_data(img); - args.iconlen = purple_imgstore_get_size(img); - args.iconsum = aimutil_iconsum(data, args.iconlen); + args.iconlen = purple_imgstore_get_size(img); + args.iconsum = aimutil_iconsum(data, args.iconlen); args.iconstamp = purple_buddy_icons_get_account_icon_timestamp(account); if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) { @@ -5368,7 +5368,7 @@ { /* If not in server list then prune from local list */ GSList *cur, *next; GSList *buddies = purple_find_buddies(account, NULL); - + /* Buddies */ cur = NULL; @@ -5807,28 +5807,34 @@ return 1; } -static int purple_ssi_authrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { +static int purple_ssi_authrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) +{ PurpleConnection *gc = od->gc; va_list ap; - char *bn; - char *msg; + const char *bn; + const char *msg; PurpleAccount *account = purple_connection_get_account(gc); - gchar *reason = NULL; struct name_data *data; PurpleBuddy *buddy; va_start(ap, fr); - bn = va_arg(ap, char *); - msg = va_arg(ap, char *); + bn = va_arg(ap, const char *); + msg = va_arg(ap, const char *); va_end(ap); purple_debug_info("oscar", - "ssi: received authorization request from %s\n", bn); + "ssi: received authorization request from %s\n", bn); buddy = purple_find_buddy(account, bn); - if (msg != NULL) - reason = purple_plugin_oscar_decode_im_part(account, bn, AIM_CHARSET_LATIN_1, 0x0000, msg, strlen(msg)); + if (!msg) { + purple_debug_warning("oscar", "Received auth request from %s with " + "empty message\n", bn); + } else if (!g_utf8_validate(msg, -1, NULL)) { + purple_debug_warning("oscar", "Received auth request from %s with " + "invalid UTF-8 message\n", bn); + msg = NULL; + } data = g_new(struct name_data, 1); data->gc = gc; @@ -5837,9 +5843,8 @@ purple_account_request_authorization(account, bn, NULL, (buddy ? purple_buddy_get_alias_only(buddy) : NULL), - reason, buddy != NULL, purple_auth_grant, + msg, buddy != NULL, purple_auth_grant, purple_auth_dontgrant_msgprompt, data); - g_free(reason); return 1; } @@ -6389,7 +6394,7 @@ purple_value_new(PURPLE_TYPE_STRING), NULL); status_types = g_list_prepend(status_types, type); - + type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, OSCAR_STATUS_ID_EVIL, _("Evil"), TRUE, is_icq, FALSE, @@ -6651,23 +6656,22 @@ * window. Let the user know that we canceled the Direct IM. */ conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); purple_conversation_write(conv, NULL, _("You closed the connection."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - } -} - -static void oscar_get_icqxstatusmsg (PurpleBlistNode *node, gpointer ignore) + PURPLE_MESSAGE_SYSTEM, time(NULL)); + } +} + +static void oscar_get_icqxstatusmsg(PurpleBlistNode *node, gpointer ignore) { PurpleBuddy *buddy; PurpleConnection *gc; PurpleAccount *account; - - + g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *)node; gc = purple_account_get_connection(buddy->account); account = purple_connection_get_account(gc); - purple_debug_info("oscar", "Manual X-Status Get From %s to %s:\n", purple_buddy_get_name(buddy), account->username); + purple_debug_info("oscar", "Manual X-Status Get From %s to %s:\n", purple_buddy_get_name(buddy), account->username); icq_im_xstatus_request(gc->proto_data, purple_buddy_get_name(buddy)); }
--- a/libpurple/protocols/oscar/oscar.h Sat Mar 20 16:20:09 2010 +0000 +++ b/libpurple/protocols/oscar/oscar.h Sat Mar 20 16:20:35 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. @@ -949,7 +944,7 @@ { guint16 status; guchar cookie[8]; - int type; /* One of the OSCAR_CAPABILITY_ constants */ + guint64 type; /* One of the OSCAR_CAPABILITY_ constants */ const char *proxyip; const char *clientip; const char *verifiedip; @@ -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 @@ -1710,7 +1705,7 @@ IcbmCookie *aim_mkcookie(guint8 *, int, void *); IcbmCookie *aim_checkcookie(OscarData *, const unsigned char *, const int); int aim_freecookie(OscarData *od, IcbmCookie *cookie); -int aim_msgcookie_gettype(int type); +int aim_msgcookie_gettype(guint64 type); int aim_cookie_free(OscarData *od, IcbmCookie *cookie); int aim_chat_readroominfo(ByteStream *bs, struct aim_chat_roominfo *outinfo);
--- a/libpurple/protocols/oscar/peer.c Sat Mar 20 16:20:09 2010 +0000 +++ b/libpurple/protocols/oscar/peer.c Sat Mar 20 16:20:35 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 Sat Mar 20 16:20:09 2010 +0000 +++ b/libpurple/protocols/oscar/peer.h Sat Mar 20 16:20:35 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 Sat Mar 20 16:20:09 2010 +0000 +++ b/libpurple/protocols/oscar/tlv.c Sat Mar 20 16:20:35 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;
--- a/pidgin/gtkblist.c Sat Mar 20 16:20:09 2010 +0000 +++ b/pidgin/gtkblist.c Sat Mar 20 16:20:35 2010 +0000 @@ -70,8 +70,6 @@ #include <gtk/gtk.h> #include <gdk/gdk.h> -#define HEADLINE_CLOSE_SIZE 11 - typedef struct { PurpleAccount *account; @@ -4983,58 +4981,16 @@ } static gboolean -headline_hover_close(int x, int y) -{ - GtkWidget *w = gtkblist->headline_hbox; - if (x <= w->allocation.width && x >= w->allocation.width - HEADLINE_CLOSE_SIZE && - y >= 0 && y <= HEADLINE_CLOSE_SIZE) - return TRUE; - return FALSE; -} - -static gboolean headline_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginBuddyList *gtkblist) { gdk_window_set_cursor(widget->window, gtkblist->hand_cursor); - - if (gtkblist->headline_close) { - gdk_draw_pixbuf(widget->window, NULL, gtkblist->headline_close, - 0, 0, - widget->allocation.width - 2 - HEADLINE_CLOSE_SIZE, 2, - HEADLINE_CLOSE_SIZE, HEADLINE_CLOSE_SIZE, - GDK_RGB_DITHER_NONE, 0, 0); - gtk_paint_focus(widget->style, widget->window, GTK_STATE_PRELIGHT, - NULL, widget, NULL, - widget->allocation.width - HEADLINE_CLOSE_SIZE - 3, 1, - HEADLINE_CLOSE_SIZE + 2, HEADLINE_CLOSE_SIZE + 2); - } - return FALSE; } -#if 0 -static gboolean -headline_box_motion_cb(GtkWidget *widget, GdkEventMotion *event, PidginBuddyList *gtkblist) -{ - purple_debug_fatal("motion", "%d %d\n", (int)event->x, (int)event->y); - if (headline_hover_close((int)event->x, (int)event->y)) - gtk_paint_focus(widget->style, widget->window, GTK_STATE_PRELIGHT, - NULL, widget, NULL, - widget->allocation.width - HEADLINE_CLOSE_SIZE - 3, 1, - HEADLINE_CLOSE_SIZE + 2, HEADLINE_CLOSE_SIZE + 2); - return FALSE; -} -#endif - static gboolean headline_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, PidginBuddyList *gtkblist) { gdk_window_set_cursor(widget->window, gtkblist->arrow_cursor); - if (gtkblist->headline_close) { - GdkRectangle rect = {widget->allocation.width - 3 - HEADLINE_CLOSE_SIZE, 1, - HEADLINE_CLOSE_SIZE + 2, HEADLINE_CLOSE_SIZE + 2}; - gdk_window_invalidate_rect(widget->window, &rect, TRUE); - } return FALSE; } @@ -5057,10 +5013,17 @@ } static gboolean +headline_close_press_cb(GtkButton *button, PidginBuddyList *gtkblist) +{ + gtk_widget_hide(gtkblist->headline_hbox); + return FALSE; +} + +static gboolean headline_box_press_cb(GtkWidget *widget, GdkEventButton *event, PidginBuddyList *gtkblist) { gtk_widget_hide(gtkblist->headline_hbox); - if (gtkblist->headline_callback && !headline_hover_close((int)event->x, (int)event->y)) + if (gtkblist->headline_callback) g_idle_add(headline_click_callback, NULL); else { if (gtkblist->headline_destroy) @@ -5812,6 +5775,7 @@ GtkWidget *sw; GtkWidget *sep; GtkWidget *label; + GtkWidget *close; char *pretty, *tmp; const char *theme_name; GtkAccelGroup *accel_group; @@ -5945,16 +5909,18 @@ gtkblist->hand_cursor = gdk_cursor_new (GDK_HAND2); gtkblist->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR); + /* Close button. */ + close = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); + close = pidgin_create_small_button(close); + gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), close, FALSE, FALSE, 0); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(close, _("Close")); +#endif + g_signal_connect(close, "clicked", G_CALLBACK(headline_close_press_cb), gtkblist); + g_signal_connect(G_OBJECT(ebox), "enter-notify-event", G_CALLBACK(headline_box_enter_cb), gtkblist); g_signal_connect(G_OBJECT(ebox), "leave-notify-event", G_CALLBACK(headline_box_leave_cb), gtkblist); g_signal_connect(G_OBJECT(ebox), "button-press-event", G_CALLBACK(headline_box_press_cb), gtkblist); -#if 0 - /* I couldn't get this to work. The idea was to draw the focus-border only - * when hovering over the close image. So for now, the focus-border is - * always there. -- sad */ - gtk_widget_set_events(ebox, gtk_widget_get_events(ebox) | GDK_POINTER_MOTION_HINT_MASK); - g_signal_connect(G_OBJECT(ebox), "motion-notify-event", G_CALLBACK(headline_box_motion_cb), gtkblist); -#endif /****************************** GtkTreeView **********************************/ sw = gtk_scrolled_window_new(NULL,NULL); @@ -6949,7 +6915,7 @@ purple_signals_disconnect_by_handle(gtkblist); if (gtkblist->headline_close) - g_object_unref(G_OBJECT(gtkblist->headline_close)); + gdk_pixbuf_unref(gtkblist->headline_close); gtk_widget_destroy(gtkblist->window);
--- a/pidgin/gtkblist.h Sat Mar 20 16:20:09 2010 +0000 +++ b/pidgin/gtkblist.h Sat Mar 20 16:20:35 2010 +0000 @@ -119,7 +119,7 @@ GtkWidget *headline_hbox; /**< Hbox for headline notification */ GtkWidget *headline_label; /**< Label for headline notifications */ GtkWidget *headline_image; /**< Image for headline notifications */ - GdkPixbuf *headline_close; /**< Close image for closing the headline without triggering the callback */ + GdkPixbuf *headline_close; /**< @deprecated: Close image for closing the headline without triggering the callback */ GCallback headline_callback; /**< Callback for headline notifications */ gpointer headline_data; /**< User data for headline notifications */ GDestroyNotify headline_destroy; /**< Callback to use for destroying the headline-data */
--- a/pidgin/gtkconv.c Sat Mar 20 16:20:09 2010 +0000 +++ b/pidgin/gtkconv.c Sat Mar 20 16:20:35 2010 +0000 @@ -229,7 +229,7 @@ } static gboolean -close_conv_cb(GtkWidget *w, GdkEventButton *dontuse, PidginConversation *gtkconv) +close_conv_cb(GtkButton *button, PidginConversation *gtkconv) { /* We are going to destroy the conversations immediately only if the 'close immediately' * preference is selected. Otherwise, close the conversation after a reasonable timeout @@ -1325,7 +1325,7 @@ { PidginWindow *win = data; - close_conv_cb(NULL, NULL, PIDGIN_CONVERSATION(pidgin_conv_window_get_active_conversation(win))); + close_conv_cb(NULL, PIDGIN_CONVERSATION(pidgin_conv_window_get_active_conversation(win))); } static void @@ -4824,52 +4824,6 @@ return FALSE; } -/* Close button {{{ */ -static gboolean -close_button_left_cb(GtkWidget *widget, GdkEventCrossing *event, GtkLabel *label) -{ - static GdkCursor *ptr = NULL; - if (ptr == NULL) { - ptr = gdk_cursor_new(GDK_LEFT_PTR); - } - - gtk_label_set_markup(label, "×"); - gdk_window_set_cursor(event->window, ptr); - return FALSE; -} - -static gboolean -close_button_entered_cb(GtkWidget *widget, GdkEventCrossing *event, GtkLabel *label) -{ - static GdkCursor *hand = NULL; - if (hand == NULL) { - hand = gdk_cursor_new(GDK_HAND2); - } - - gtk_label_set_markup(label, "<u>×</u>"); - gdk_window_set_cursor(event->window, hand); - return FALSE; -} - -static GtkWidget * -create_close_button(void) -{ - GtkWidget *ebox = gtk_event_box_new(); - GtkWidget *close_image; - - gtk_event_box_set_visible_window(GTK_EVENT_BOX(ebox), FALSE); - gtk_widget_set_events(ebox, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); - close_image = gtk_label_new("×"); - g_signal_connect(G_OBJECT(ebox), "enter-notify-event", G_CALLBACK(close_button_entered_cb), close_image); - g_signal_connect(G_OBJECT(ebox), "leave-notify-event", G_CALLBACK(close_button_left_cb), close_image); - gtk_widget_show(close_image); - gtk_container_add(GTK_CONTAINER(ebox), close_image); - - return ebox; -} - -/* }}} */ - /* Quick Find {{{ */ static gboolean pidgin_conv_end_quickfind(PidginConversation *gtkconv) @@ -4912,11 +4866,12 @@ pidgin_conv_setup_quickfind(PidginConversation *gtkconv, GtkWidget *container) { GtkWidget *widget = gtk_hbox_new(FALSE, 0); - GtkWidget *label, *entry, *close; + GtkWidget *label, *entry, *close, *image; gtk_box_pack_start(GTK_BOX(container), widget, FALSE, FALSE, 0); - close = create_close_button(); + image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); + close = pidgin_create_small_button(image); gtk_box_pack_start(GTK_BOX(widget), close, FALSE, FALSE, 0); gtk_tooltips_set_tip(gtkconv->tooltips, close, _("Close Find bar"), NULL); @@ -8677,7 +8632,7 @@ return FALSE; gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, tab_clicked); - close_conv_cb(NULL, NULL, gtkconv); + close_conv_cb(NULL, gtkconv); return TRUE; } @@ -8945,7 +8900,7 @@ if (gconv != gtkconv) { - close_conv_cb(NULL, NULL, gconv); + close_conv_cb(NULL, gconv); } } } @@ -8957,7 +8912,7 @@ gtkconv = g_object_get_data(menu, "clicked_tab"); if (gtkconv) - close_conv_cb(NULL, NULL, gtkconv); + close_conv_cb(NULL, gtkconv); } static gboolean @@ -9421,7 +9376,7 @@ if (win->gtkconvs) { while (win->gtkconvs) { gboolean last = (win->gtkconvs->next == NULL); - close_conv_cb(NULL, NULL, win->gtkconvs->data); + close_conv_cb(NULL, win->gtkconvs->data); if (last) break; } @@ -9495,6 +9450,7 @@ GtkWidget *tab_cont = gtkconv->tab_cont; PurpleConversationType conv_type; const gchar *tmp_lab; + GtkWidget *close_image; conv_type = purple_conversation_get_type(conv); @@ -9506,12 +9462,12 @@ /* Close button. */ - gtkconv->close = create_close_button(); + close_image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); + gtkconv->close = pidgin_create_small_button(close_image); gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, _("Close conversation"), NULL); - g_signal_connect(G_OBJECT(gtkconv->close), "button-press-event", - G_CALLBACK(close_conv_cb), gtkconv); + g_signal_connect(gtkconv->close, "clicked", G_CALLBACK (close_conv_cb), gtkconv); /* Status icon. */ gtkconv->icon = gtk_image_new();
--- a/pidgin/gtkutils.c Sat Mar 20 16:20:09 2010 +0000 +++ b/pidgin/gtkutils.c Sat Mar 20 16:20:35 2010 +0000 @@ -153,6 +153,27 @@ } GtkWidget * +pidgin_create_small_button(GtkWidget *image) +{ + GtkWidget *button; + + button = gtk_button_new(); + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); + + /* don't allow focus on the close button */ + gtk_button_set_focus_on_click(GTK_BUTTON(button), FALSE); + + /* set style to make it as small as possible */ + gtk_widget_set_name(button, "pidgin-small-close-button"); + + gtk_widget_show(image); + + gtk_container_add(GTK_CONTAINER(button), image); + + return button; +} + +GtkWidget * pidgin_create_dialog(const char *title, guint border_width, const char *role, gboolean resizable) { GtkWindow *wnd = NULL; @@ -3448,6 +3469,16 @@ if (purple_running_gnome()) register_gnome_url_handlers(); + /* Used to make small buttons */ + gtk_rc_parse_string("style \"pidgin-small-close-button\"\n" + "{\n" + "GtkWidget::focus-padding = 0\n" + "GtkWidget::focus-line-width = 0\n" + "xthickness = 0\n" + "ythickness = 0\n" + "}\n" + "widget \"*.pidgin-small-close-button\" style \"pidgin-small-close-button\""); + #ifdef _WIN32 winpidgin_register_win32_url_handlers(); #endif
--- a/pidgin/gtkutils.h Sat Mar 20 16:20:09 2010 +0000 +++ b/pidgin/gtkutils.h Sat Mar 20 16:20:35 2010 +0000 @@ -109,6 +109,16 @@ GtkWidget *pidgin_create_imhtml(gboolean editable, GtkWidget **imhtml_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret); /** + * Creates a small button + * + * @param image A button image. + * + * @return A GtkButton created from the image. + * @since 2.7.0 + */ +GtkWidget *pidgin_create_small_button(GtkWidget *image); + +/** * Creates a new window * * @param title The window title, or @c NULL