Index: doc/user-guide/commands.xml
===================================================================
--- doc/user-guide/commands.xml (revision 75610c3b53a68451d9eaf40fdc8a5e6419a13339)
+++ doc/user-guide/commands.xml (revision bd5eee34fd1495820fb8440d515cbc86e8d912b2)
@@ -663,4 +663,19 @@
+
+ 140
+
+
+
+ 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.
+
+
+
+ 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.
+
+
+
+
+
one, many, chat
Index: protocols/oscar/oscar.c
===================================================================
--- protocols/oscar/oscar.c (revision 75610c3b53a68451d9eaf40fdc8a5e6419a13339)
+++ protocols/oscar/oscar.c (revision bd5eee34fd1495820fb8440d515cbc86e8d912b2)
@@ -2659,7 +2659,5 @@
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);
Index: protocols/twitter/twitter.c
===================================================================
--- protocols/twitter/twitter.c (revision 75610c3b53a68451d9eaf40fdc8a5e6419a13339)
+++ protocols/twitter/twitter.c (revision bd5eee34fd1495820fb8440d515cbc86e8d912b2)
@@ -144,7 +144,21 @@
}
+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 );
@@ -231,5 +245,5 @@
}
}
- else
+ else if( twitter_length_check(ic, message) )
twitter_post_status(ic, message);
}
@@ -262,5 +276,5 @@
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);
}
Index: protocols/yahoo/yahoo.c
===================================================================
--- protocols/yahoo/yahoo.c (revision 75610c3b53a68451d9eaf40fdc8a5e6419a13339)
+++ protocols/yahoo/yahoo.c (revision bd5eee34fd1495820fb8440d515cbc86e8d912b2)
@@ -832,4 +832,8 @@
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 ) );