diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-09 10:48:56 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-09 10:48:56 +0100 |
commit | bd5eee34fd1495820fb8440d515cbc86e8d912b2 (patch) | |
tree | a2893dfdce80c818c9b1c34a320b8f45e064cd82 | |
parent | 75610c3b53a68451d9eaf40fdc8a5e6419a13339 (diff) | |
parent | 5a599a1550c670649dba681e702864d55d2e3795 (diff) |
Merging mainline, mostly for chatroom fixes I implemented there.
-rw-r--r-- | doc/user-guide/commands.xml | 15 | ||||
-rw-r--r-- | protocols/oscar/oscar.c | 2 | ||||
-rw-r--r-- | protocols/twitter/twitter.c | 18 | ||||
-rw-r--r-- | protocols/yahoo/yahoo.c | 4 |
4 files changed, 35 insertions, 4 deletions
diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml index e681429c..f3633971 100644 --- a/doc/user-guide/commands.xml +++ b/doc/user-guide/commands.xml @@ -662,6 +662,21 @@ </bitlbee-setting> + <bitlbee-setting name="message_length" type="integer" scope="account"> + <default>140</default> + + <description> + <para> + Since Twitter rejects messages longer than 140 characters, BitlBee can count message length and emit a warning instead of waiting for Twitter to reject it. + </para> + + <para> + You can change this limit here but this won't disable length checks on Twitter's side. You can also set it to 0 to disable the check in case you believe BitlBee doesn't count the characters correctly. + </para> + </description> + + </bitlbee-setting> + <bitlbee-setting name="mode" type="string" scope="account"> <possible-values>one, many, chat</possible-values> <default>one</default> diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index de594eee..2d07f912 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -2658,9 +2658,7 @@ struct groupchat *oscar_chat_with(struct im_connection * ic, char *who) ic->acc->user, chat_id++); c = imcb_chat_new(ic, chatname); - ret = oscar_chat_join(ic, chatname, NULL, NULL); - aim_chat_invite(od->sess, od->conn, who, "", 4, chatname, 0x0); g_free(chatname); diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index 9c7b060c..98e85641 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -143,10 +143,24 @@ static char *set_eval_mode( set_t *set, char *value ) return NULL; } +static gboolean twitter_length_check( struct im_connection *ic, gchar *msg ) +{ + int max = set_getint( &ic->acc->set, "message_length" ), len; + + if( max == 0 || ( len = g_utf8_strlen( msg, -1 ) ) <= max ) + return TRUE; + + imcb_error( ic, "Maximum message length exceeded: %d > %d", len, max ); + + return FALSE; +} + static void twitter_init( account_t *acc ) { set_t *s; + s = set_add( &acc->set, "message_length", "140", set_eval_int, acc ); + s = set_add( &acc->set, "mode", "one", set_eval_mode, acc ); s->flags |= ACC_SET_OFFLINE_ONLY; @@ -230,7 +244,7 @@ static int twitter_buddy_msg( struct im_connection *ic, char *who, char *message return FALSE; } } - else + else if( twitter_length_check(ic, message) ) twitter_post_status(ic, message); } else @@ -261,7 +275,7 @@ static void twitter_remove_buddy( struct im_connection *ic, char *who, char *gro static void twitter_chat_msg( struct groupchat *c, char *message, int flags ) { - if( c && message ) + if( c && message && twitter_length_check(c->ic, message)) twitter_post_status(c->ic, message); } diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c index 4fd7bee5..68bc6f69 100644 --- a/protocols/yahoo/yahoo.c +++ b/protocols/yahoo/yahoo.c @@ -831,6 +831,10 @@ void ext_yahoo_got_conf_invite( int id, const char *ignored, char txt[1024]; YList *m; + if( g_strcasecmp( who, ic->acc->user ) == 0 ) + /* WTF, Yahoo! seems to echo these now? */ + return; + inv = g_malloc( sizeof( struct byahoo_conf_invitation ) ); memset( inv, 0, sizeof( struct byahoo_conf_invitation ) ); inv->name = g_strdup( room ); |