diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2015-01-17 20:13:19 +0000 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2015-01-17 20:13:19 +0000 |
commit | eb4ad8d31f7ed4210f24beb8753ecce594b0beef (patch) | |
tree | f7f9cf04738522a79f874e0e8ce9b915014861fc | |
parent | 1065dd4f38c81c83934ba51526471072837700ae (diff) | |
parent | 664bac38fcdf6889d3ceb29b73a0c3a4e27820ce (diff) |
Merging random other fixes/cleanups.
-rwxr-xr-x | configure | 8 | ||||
-rw-r--r-- | ipc.c | 8 | ||||
-rw-r--r-- | irc_channel.c | 2 | ||||
-rw-r--r-- | irc_commands.c | 4 | ||||
-rw-r--r-- | irc_im.c | 4 | ||||
-rw-r--r-- | lib/misc.c | 9 | ||||
-rw-r--r-- | lib/misc.h | 1 | ||||
-rw-r--r-- | lib/ns_parse.c | 2 | ||||
-rw-r--r-- | lib/proxy.c | 14 | ||||
-rw-r--r-- | nick.c | 12 | ||||
-rw-r--r-- | otr.c | 17 | ||||
-rw-r--r-- | protocols/bee_chat.c | 12 | ||||
-rw-r--r-- | protocols/jabber/jabber_util.c | 46 | ||||
-rw-r--r-- | protocols/msn/ns.c | 2 | ||||
-rw-r--r-- | protocols/oscar/conn.c | 2 | ||||
-rw-r--r-- | protocols/twitter/twitter.c | 7 | ||||
-rw-r--r-- | protocols/twitter/twitter_lib.c | 29 | ||||
-rw-r--r-- | protocols/yahoo/libyahoo2.c | 15 | ||||
-rw-r--r-- | protocols/yahoo/yahoo_util.h | 3 | ||||
-rw-r--r-- | set.c | 8 | ||||
-rw-r--r-- | tests/check_arc.c | 2 | ||||
-rw-r--r-- | tests/check_irc.c | 1 | ||||
-rw-r--r-- | tests/check_jabber_sasl.c | 1 |
23 files changed, 131 insertions, 78 deletions
@@ -56,6 +56,14 @@ GLIB_MIN_VERSION=2.14 echo BitlBee configure +# Cygwin and Darwin don't support PIC/PIE +case "$arch" in + CYGWIN* ) + pie=0;; + Darwin ) + pie=0;; +esac + while [ -n "$1" ]; do e="`expr "X$1" : 'X--\(.*=.*\)'`" if [ -z "$e" ]; then @@ -462,7 +462,7 @@ gboolean ipc_child_identify( irc_t *irc ) else if( global.conf->runmode == RUNMODE_DAEMON ) { GSList *l; - irc_t *old; + irc_t *old = NULL; char *to_init[] = { "TAKEOVER", "INIT", NULL }; for( l = irc_connection_list; l; l = l->next ) @@ -476,7 +476,7 @@ gboolean ipc_child_identify( irc_t *irc ) strcmp( irc->password, old->password ) == 0 ) break; } - if( l == NULL || + if( l == NULL || old == NULL || !set_getbool( &irc->b->set, "allow_takeover" ) || !set_getbool( &old->b->set, "allow_takeover" ) ) return FALSE; @@ -523,7 +523,9 @@ static void ipc_command_exec( void *data, char **cmd, const command_t *commands if( g_strcasecmp( commands[i].command, cmd[0] ) == 0 ) { /* There is no typo in this line: */ - for( j = 1; cmd[j]; j ++ ); j --; + for( j = 1; cmd[j]; j ++ ) + ; + j--; if( j < commands[i].required_parameters ) break; diff --git a/irc_channel.c b/irc_channel.c index 0a6e11d2..f3ec296c 100644 --- a/irc_channel.c +++ b/irc_channel.c @@ -431,7 +431,7 @@ void irc_channel_auto_joins( irc_t *irc, account_t *acc ) can only auto-join them if their account is online. */ char *acc_s; - if( !aj && !( ic->flags & IRC_CHANNEL_JOINED ) ) + if( !aj || ( ic->flags & IRC_CHANNEL_JOINED ) ) /* Only continue if this one's marked as auto_join or if we're in it already. (Possible if the client auto-rejoined it before identyfing.) */ diff --git a/irc_commands.c b/irc_commands.c index 743fb417..6be756ff 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -769,7 +769,9 @@ void irc_exec( irc_t *irc, char *cmd[] ) if( g_strcasecmp( irc_commands[i].command, cmd[0] ) == 0 ) { /* There should be no typo in the next line: */ - for( n_arg = 0; cmd[n_arg]; n_arg ++ ); n_arg --; + for( n_arg = 0; cmd[n_arg]; n_arg ++ ) + ; + n_arg--; if( irc_commands[i].flags & IRC_CMD_PRE_LOGIN && irc->status & USTATUS_LOGGED_IN ) { @@ -910,10 +910,8 @@ static gboolean bee_irc_channel_chat_part( irc_channel_t *ic, const char *msg ) if( c && c->ic->acc->prpl->chat_leave ) c->ic->acc->prpl->chat_leave( c ); - /* Remove references in both directions now. We don't need each other anymore. */ + /* Remove the reference. We don't need it anymore. */ ic->data = NULL; - if( c ) - c->ui_data = NULL; return TRUE; } @@ -779,3 +779,12 @@ char *get_rfc822_header( const char *text, const char *header, int len ) return NULL; } + +/* Takes a string, truncates it where it's safe, returns the new length */ +int truncate_utf8( char *string, int maxlen ) +{ + char *end; + g_utf8_validate( (const gchar *) string, maxlen, (const gchar **) &end ); + *end = '\0'; + return end - string; +} @@ -149,5 +149,6 @@ G_MODULE_EXPORT gboolean ssl_sockerr_again( void *ssl ); G_MODULE_EXPORT int md5_verify_password( char *password, char *hash ); G_MODULE_EXPORT char **split_command_parts( char *command, int limit ); G_MODULE_EXPORT char *get_rfc822_header( const char *text, const char *header, int len ); +G_MODULE_EXPORT int truncate_utf8( char *string, int maxlen ); #endif diff --git a/lib/ns_parse.c b/lib/ns_parse.c index ba45d513..0462b67e 100644 --- a/lib/ns_parse.c +++ b/lib/ns_parse.c @@ -18,7 +18,7 @@ #include "bitlbee.h" #ifndef lint -static const char rcsid[] = "$Id: ns_parse.c,v 1.10 2009/01/23 19:59:16 each Exp $"; +//static const char rcsid[] = "$Id: ns_parse.c,v 1.10 2009/01/23 19:59:16 each Exp $"; #endif #ifdef HAVE_RESOLV_A diff --git a/lib/proxy.c b/lib/proxy.c index 86bb0dcc..2e0dc2cf 100644 --- a/lib/proxy.c +++ b/lib/proxy.c @@ -65,7 +65,7 @@ static int proxy_connect_none(const char *host, unsigned short port_, struct PHB static gboolean gaim_io_connected(gpointer data, gint source, b_input_condition cond) { struct PHB *phb = data; - unsigned int len; + socklen_t len; int error = ETIMEDOUT; len = sizeof(error); @@ -85,6 +85,7 @@ static gboolean gaim_io_connected(gpointer data, gint source, b_input_condition freeaddrinfo(phb->gai); closesocket(source); b_event_remove(phb->inpa); + phb->inpa = 0; if( phb->proxy_func ) phb->proxy_func(phb->proxy_data, -1, B_EV_IO_READ); else { @@ -96,6 +97,7 @@ static gboolean gaim_io_connected(gpointer data, gint source, b_input_condition freeaddrinfo(phb->gai); sock_make_blocking(source); b_event_remove(phb->inpa); + phb->inpa = 0; if( phb->proxy_func ) phb->proxy_func(phb->proxy_data, source, B_EV_IO_READ); else { @@ -173,8 +175,8 @@ static int proxy_connect_none(const char *host, unsigned short port_, struct PHB /* Connecting to HTTP proxies */ -#define HTTP_GOODSTRING "HTTP/1.0 200 Connection established" -#define HTTP_GOODSTRING2 "HTTP/1.1 200 Connection established" +#define HTTP_GOODSTRING "HTTP/1.0 200" +#define HTTP_GOODSTRING2 "HTTP/1.1 200" static gboolean http_canread(gpointer data, gint source, b_input_condition cond) { @@ -213,7 +215,7 @@ static gboolean http_canwrite(gpointer data, gint source, b_input_condition cond { char cmd[384]; struct PHB *phb = data; - unsigned int len; + socklen_t len; int error = ETIMEDOUT; if (phb->inpa > 0) b_event_remove(phb->inpa); @@ -308,7 +310,7 @@ static gboolean s4_canwrite(gpointer data, gint source, b_input_condition cond) unsigned char packet[12]; struct hostent *hp; struct PHB *phb = data; - unsigned int len; + socklen_t len; int error = ETIMEDOUT; if (phb->inpa > 0) b_event_remove(phb->inpa); @@ -500,7 +502,7 @@ static gboolean s5_canwrite(gpointer data, gint source, b_input_condition cond) unsigned char buf[512]; int i; struct PHB *phb = data; - unsigned int len; + socklen_t len; int error = ETIMEDOUT; if (phb->inpa > 0) b_event_remove(phb->inpa); @@ -226,7 +226,7 @@ char *nick_gen( bee_user_t *bu ) if( ok && rets && *rets ) { nick_strip( irc, rets ); - rets[MAX_NICK_LENGTH] = '\0'; + truncate_utf8( rets, MAX_NICK_LENGTH ); return rets; } g_free( rets ); @@ -251,7 +251,12 @@ void nick_dedupe( bee_user_t *bu, char nick[MAX_NICK_LENGTH+1] ) } else { - nick[0] ++; + /* We've got no more space for underscores, + so truncate it and replace the last three + chars with a random "_XX" suffix */ + int len = truncate_utf8( nick, MAX_NICK_LENGTH - 3 ); + nick[len] = '_'; + g_snprintf(nick + len + 1, 3, "%2x", rand() ); } if( inf_protection-- == 0 ) @@ -399,8 +404,7 @@ int nick_lc( irc_t *irc, char *nick ) gchar *down = g_utf8_strdown( nick, -1 ); if( strlen( down ) > strlen( nick ) ) { - /* Well crap. Corrupt it if we have to. */ - down[strlen(nick)] = '\0'; + truncate_utf8( down, strlen( nick ) ); } strcpy( nick, down ); g_free( down ); @@ -1116,29 +1116,20 @@ void cmd_otr_info(irc_t *irc, char **args) void cmd_otr_keygen(irc_t *irc, char **args) { - int i, n; account_t *a; - n = atoi(args[1]); - if(n<0 || (!n && strcmp(args[1], "0"))) { - irc_rootmsg(irc, "%s: invalid account number", args[1]); - return; - } - - a = irc->b->accounts; - for(i=0; i<n && a; i++, a=a->next); - if(!a) { - irc_rootmsg(irc, "%s: no such account", args[1]); + if ((a = account_get(irc->b, args[1])) == NULL) { + irc_rootmsg(irc, "Could not find account `%s'.", args[1]); return; } if(keygen_in_progress(irc, a->user, a->prpl->name)) { - irc_rootmsg(irc, "keygen for account %d already in progress", n); + irc_rootmsg(irc, "keygen for account `%s' already in progress", a->tag); return; } if(otrl_privkey_find(irc->otr->us, a->user, a->prpl->name)) { - char *s = g_strdup_printf("account %d already has a key, replace it?", n); + char *s = g_strdup_printf("account `%s' already has a key, replace it?", a->tag); query_add(irc, NULL, s, yes_keygen, NULL, NULL, a); g_free(s); } else { diff --git a/protocols/bee_chat.c b/protocols/bee_chat.c index 1b741730..39110a10 100644 --- a/protocols/bee_chat.c +++ b/protocols/bee_chat.c @@ -84,6 +84,7 @@ void imcb_chat_msg( struct groupchat *c, const char *who, char *msg, uint32_t fl struct im_connection *ic = c->ic; bee_t *bee = ic->bee; bee_user_t *bu; + gboolean temp; char *s; /* Gaim sends own messages through this too. IRC doesn't want this, so kill them */ @@ -91,16 +92,21 @@ void imcb_chat_msg( struct groupchat *c, const char *who, char *msg, uint32_t fl return; bu = bee_user_by_handle( bee, ic, who ); + temp = ( bu == NULL ); + + if( temp ) + bu = bee_user_new( bee, ic, who, BEE_USER_ONLINE ); s = set_getstr( &ic->bee->set, "strip_html" ); if( ( g_strcasecmp( s, "always" ) == 0 ) || ( ( ic->flags & OPT_DOES_HTML ) && s ) ) strip_html( msg ); - if( bu && bee->ui->chat_msg ) + if( bee->ui->chat_msg ) bee->ui->chat_msg( bee, c, bu, msg, sent_at ); - else - imcb_chat_log( c, "Message from unknown participant %s: %s", who, msg ); + + if( temp ) + bee_user_free( bee, bu ); } void imcb_chat_log( struct groupchat *c, char *format, ... ) diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c index 9d8011f8..d6396802 100644 --- a/protocols/jabber/jabber_util.c +++ b/protocols/jabber/jabber_util.c @@ -329,23 +329,37 @@ int jabber_compare_jid( const char *jid1, const char *jid2 ) return TRUE; } -/* Returns a new string. Don't leak it! */ +/* The /resource part is case sensitive. This stops once we see a slash. + Returns a new string. Don't leak it! */ char *jabber_normalize( const char *orig ) { - int len, i; - char *new; - - len = strlen( orig ); - new = g_new( char, len + 1 ); - - /* So it turns out the /resource part is case sensitive. Yeah, and - it's Unicode but feck Unicode. :-P So stop once we see a slash. */ - for( i = 0; i < len && orig[i] != '/' ; i ++ ) - new[i] = g_ascii_tolower( orig[i] ); - for( ; orig[i]; i ++ ) - new[i] = orig[i]; - - new[i] = 0; + char *lower, *new, *s; + + if ( ! ( s = strchr( orig, '/' ) ) ) + return g_utf8_strdown( orig, -1 ); + + lower = g_utf8_strdown( orig, (s - orig) ); /* stop in s */ + new = g_strconcat( lower, s, NULL ); + g_free( lower ); + return new; +} + +/* Similar to jabber_normalize, but works with addresses in the form + * resource=chatroom@example.com */ +char *jabber_normalize_ext( const char *orig ) +{ + char *lower, *new, *s; + + if ( ! ( s = strchr( orig, '=' ) ) ) + return g_utf8_strdown( orig, -1 ); + + lower = g_utf8_strdown( s, -1 ); /* start in s */ + + *s = 0; + new = g_strconcat( orig, lower, NULL ); + *s = '='; + + g_free( lower ); return new; } @@ -555,7 +569,7 @@ struct jabber_buddy *jabber_buddy_by_ext_jid( struct im_connection *ic, char *ji struct jabber_buddy *bud; char *s, *jid; - jid = jabber_normalize( jid_ ); + jid = jabber_normalize_ext( jid_ ); if( ( s = strchr( jid, '=' ) ) == NULL ) return NULL; diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index c4b6c462..7646e237 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -880,7 +880,7 @@ static gboolean msn_ns_send_adl_1( gpointer key, gpointer value, gpointer data ) struct bee_user *bu = value; struct msn_buddy_data *bd = bu->data; struct msn_data *md = bu->ic->proto_data; - char handle[strlen(bu->handle)]; + char handle[strlen(bu->handle) + 1]; char *domain; char l[4]; diff --git a/protocols/oscar/conn.c b/protocols/oscar/conn.c index a178761e..16b6ac07 100644 --- a/protocols/oscar/conn.c +++ b/protocols/oscar/conn.c @@ -570,7 +570,7 @@ int aim_conn_completeconnect(aim_session_t *sess, aim_conn_t *conn) } if (FD_ISSET(conn->fd, &fds) || FD_ISSET(conn->fd, &wfds)) { - unsigned int len = sizeof(error); + socklen_t len = sizeof(error); if (getsockopt(conn->fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) error = errno; diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index ca32b3ce..d2aafcb4 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -50,6 +50,10 @@ static void twitter_main_loop_start(struct im_connection *ic) { struct twitter_data *td = ic->proto_data; + char *last_tweet = set_getstr(&ic->acc->set, "_last_tweet"); + if (last_tweet) + td->timeline_id = g_ascii_strtoull(last_tweet, NULL, 0); + /* Create the room now that we "logged in". */ if (td->flags & TWITTER_MODE_CHAT) twitter_groupchat_init(ic); @@ -326,6 +330,9 @@ static void twitter_init(account_t * acc) s = set_add(&acc->set, "strip_newlines", "false", set_eval_bool, acc); + s = set_add(&acc->set, "_last_tweet", "0", NULL, acc); + s->flags |= SET_HIDDEN | SET_NOSAVE; + if (strcmp(acc->prpl->name, "twitter") == 0) { s = set_add(&acc->set, "stream", "true", set_eval_bool, acc); s->flags |= ACC_SET_OFFLINE_ONLY; diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index b1995e73..718867a7 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -233,10 +233,10 @@ static void twitter_http_get_friends_ids(struct http_request *req); */ void twitter_get_friends_ids(struct im_connection *ic, gint64 next_cursor) { - // Primitive, but hey! It works... + // Primitive, but hey! It works... char *args[2]; args[0] = "cursor"; - args[1] = g_strdup_printf("%lld", (long long) next_cursor); + args[1] = g_strdup_printf("%" G_GINT64_FORMAT, next_cursor); twitter_http(ic, TWITTER_FRIENDS_IDS_URL, twitter_http_get_friends_ids, ic, 0, args, 2); g_free(args[1]); @@ -720,6 +720,7 @@ static void twitter_status_show_msg(struct im_connection *ic, struct twitter_xml static void twitter_status_show(struct im_connection *ic, struct twitter_xml_status *status) { struct twitter_data *td = ic->proto_data; + char *last_id_str; if (status->user == NULL || status->text == NULL) return; @@ -737,6 +738,10 @@ static void twitter_status_show(struct im_connection *ic, struct twitter_xml_sta // Update the timeline_id to hold the highest id, so that by the next request // we won't pick up the updates already in the list. td->timeline_id = MAX(td->timeline_id, status->rt_id); + + last_id_str = g_strdup_printf("%" G_GUINT64_FORMAT, td->timeline_id); + set_setstr(&ic->acc->set, "last_tweet", last_id_str); + g_free(last_id_str); } static gboolean twitter_stream_handle_object(struct im_connection *ic, json_value *o); @@ -996,12 +1001,12 @@ static void twitter_get_home_timeline(struct im_connection *ic, gint64 next_curs char *args[6]; args[0] = "cursor"; - args[1] = g_strdup_printf("%lld", (long long) next_cursor); + args[1] = g_strdup_printf("%" G_GINT64_FORMAT, next_cursor); args[2] = "include_entities"; args[3] = "true"; if (td->timeline_id) { args[4] = "since_id"; - args[5] = g_strdup_printf("%llu", (long long unsigned int) td->timeline_id); + args[5] = g_strdup_printf("%" G_GUINT64_FORMAT, td->timeline_id); } if (twitter_http(ic, TWITTER_HOME_TIMELINE_URL, twitter_http_get_home_timeline, ic, 0, args, @@ -1032,12 +1037,12 @@ static void twitter_get_mentions(struct im_connection *ic, gint64 next_cursor) char *args[6]; args[0] = "cursor"; - args[1] = g_strdup_printf("%lld", (long long) next_cursor); + args[1] = g_strdup_printf("%" G_GINT64_FORMAT, next_cursor); args[2] = "include_entities"; args[3] = "true"; if (td->timeline_id) { args[4] = "since_id"; - args[5] = g_strdup_printf("%llu", (long long unsigned int) td->timeline_id); + args[5] = g_strdup_printf("%" G_GUINT64_FORMAT, td->timeline_id); } else { args[4] = "count"; args[5] = g_strdup_printf("%d", set_getint(&ic->acc->set, "show_old_mentions")); @@ -1166,7 +1171,7 @@ void twitter_post_status(struct im_connection *ic, char *msg, guint64 in_reply_t char *args[4] = { "status", msg, "in_reply_to_status_id", - g_strdup_printf("%llu", (unsigned long long) in_reply_to) + g_strdup_printf("%" G_GUINT64_FORMAT, in_reply_to) }; twitter_http(ic, TWITTER_STATUS_UPDATE_URL, twitter_http_post, ic, 1, args, in_reply_to ? 4 : 2); @@ -1200,8 +1205,8 @@ void twitter_friendships_create_destroy(struct im_connection *ic, char *who, int void twitter_status_destroy(struct im_connection *ic, guint64 id) { char *url; - url = g_strdup_printf("%s%llu%s", TWITTER_STATUS_DESTROY_URL, - (unsigned long long) id, ".json"); + url = g_strdup_printf("%s%" G_GUINT64_FORMAT "%s", + TWITTER_STATUS_DESTROY_URL, id, ".json"); twitter_http_f(ic, url, twitter_http_post, ic, 1, NULL, 0, TWITTER_HTTP_USER_ACK); g_free(url); @@ -1210,8 +1215,8 @@ void twitter_status_destroy(struct im_connection *ic, guint64 id) void twitter_status_retweet(struct im_connection *ic, guint64 id) { char *url; - url = g_strdup_printf("%s%llu%s", TWITTER_STATUS_RETWEET_URL, - (unsigned long long) id, ".json"); + url = g_strdup_printf("%s%" G_GUINT64_FORMAT "%s", + TWITTER_STATUS_RETWEET_URL, id, ".json"); twitter_http_f(ic, url, twitter_http_post, ic, 1, NULL, 0, TWITTER_HTTP_USER_ACK); g_free(url); @@ -1240,7 +1245,7 @@ void twitter_favourite_tweet(struct im_connection *ic, guint64 id) "id", NULL, }; - args[1] = g_strdup_printf("%llu", (unsigned long long) id); + args[1] = g_strdup_printf("%" G_GUINT64_FORMAT, id); twitter_http_f(ic, TWITTER_FAVORITE_CREATE_URL, twitter_http_post, ic, 1, args, 2, TWITTER_HTTP_USER_ACK); g_free(args[1]); diff --git a/protocols/yahoo/libyahoo2.c b/protocols/yahoo/libyahoo2.c index cc4724f6..9956514d 100644 --- a/protocols/yahoo/libyahoo2.c +++ b/protocols/yahoo/libyahoo2.c @@ -973,7 +973,8 @@ static void yahoo_process_conference(struct yahoo_input_data *yid, if (pair->key == 14) /* decline/conf message */ msg = pair->value; - if (pair->key == 13) ; + if (pair->key == 13) + ; if (pair->key == 16) /* error */ msg = pair->value; @@ -1794,9 +1795,9 @@ static enum yahoo_status yahoo_https_status_parse(int code) { switch (code) { - case 1212: return YAHOO_LOGIN_PASSWD; - case 1213: return YAHOO_LOGIN_LOCK; - case 1235: return YAHOO_LOGIN_UNAME; + case 1212: return (enum yahoo_status) YAHOO_LOGIN_PASSWD; + case 1213: return (enum yahoo_status) YAHOO_LOGIN_LOCK; + case 1235: return (enum yahoo_status) YAHOO_LOGIN_UNAME; default: return (enum yahoo_status) code; } } @@ -3609,7 +3610,7 @@ void yahoo_send_im(int id, const char *from, const char *who, const char *what, yd = yid->yd; - pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, + pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, (enum ypacket_status) YAHOO_STATUS_OFFLINE, yd->session_id); snprintf(pic_str, sizeof(pic_str), "%d", picture); @@ -3676,7 +3677,7 @@ void yahoo_set_away(int id, enum yahoo_status state, const char *msg, int away) /* Thank you libpurple :) */ if (yd->current_status == YAHOO_STATUS_INVISIBLE) { pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, - YAHOO_STATUS_AVAILABLE, 0); + (enum ypacket_status) YAHOO_STATUS_AVAILABLE, 0); yahoo_packet_hash(pkt, 13, "2"); yahoo_send_packet(yid, pkt, 0); yahoo_packet_free(pkt); @@ -3695,7 +3696,7 @@ void yahoo_set_away(int id, enum yahoo_status state, const char *msg, int away) if (old_status == YAHOO_STATUS_INVISIBLE) { pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, - YAHOO_STATUS_AVAILABLE, 0); + (enum ypacket_status) YAHOO_STATUS_AVAILABLE, 0); yahoo_packet_hash(pkt, 13, "1"); yahoo_send_packet(yid, pkt, 0); yahoo_packet_free(pkt); diff --git a/protocols/yahoo/yahoo_util.h b/protocols/yahoo/yahoo_util.h index 1f55e064..6099bf8f 100644 --- a/protocols/yahoo/yahoo_util.h +++ b/protocols/yahoo/yahoo_util.h @@ -47,6 +47,9 @@ # endif # define snprintf g_snprintf +#ifdef vsnprintf +#undef vsnprintf +#endif # define vsnprintf g_vsnprintf #else @@ -174,10 +174,10 @@ int set_setstr( set_t **head, const char *key, char *value ) int set_setint( set_t **head, const char *key, int value ) { - char s[24]; /* Not quite 128-bit clean eh? ;-) */ - - g_snprintf( s, sizeof( s ), "%d", value ); - return set_setstr( head, key, s ); + char *s = g_strdup_printf( "%d", value ); + int retval = set_setstr( head, key, s ); + g_free( s ); + return retval; } void set_del( set_t **head, const char *key ) diff --git a/tests/check_arc.c b/tests/check_arc.c index 9d913dcd..e9e7d382 100644 --- a/tests/check_arc.c +++ b/tests/check_arc.c @@ -87,6 +87,8 @@ static void check_decod(int l) len = arc_decode( decrypt_tests[i].crypted, decrypt_tests[i].len, &decrypted, password ); + fail_if( len == -1, + "`%s' didn't decrypt properly", decrypt_tests[i].decrypted ); fail_if( strcmp( decrypt_tests[i].decrypted, decrypted ) != 0, "`%s' didn't decrypt properly", decrypt_tests[i].decrypted ); diff --git a/tests/check_irc.c b/tests/check_irc.c index 66fe0021..a4b9a1e9 100644 --- a/tests/check_irc.c +++ b/tests/check_irc.c @@ -27,7 +27,6 @@ END_TEST START_TEST(test_login) GIOChannel *ch1, *ch2; irc_t *irc; - GError *error = NULL; char *raw; fail_unless(g_io_channel_pair(&ch1, &ch2)); diff --git a/tests/check_jabber_sasl.c b/tests/check_jabber_sasl.c index 63118d39..81fc60aa 100644 --- a/tests/check_jabber_sasl.c +++ b/tests/check_jabber_sasl.c @@ -86,7 +86,6 @@ static void check_get_part(int l) { tcase_fn_start( get_part_tests[i].key, __FILE__, i ); char *res; - int len; res = sasl_get_part( get_part_tests[i].challenge, get_part_tests[i].key ); |