From 17dd2eda62fa0b38907a6f565ab2203c7fbd270c Mon Sep 17 00:00:00 2001 From: Jan Hruban Date: Wed, 15 Jun 2011 14:13:58 +0200 Subject: Fix crash on inviting people to skype groupchats --- protocols/skype/skype.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'protocols') diff --git a/protocols/skype/skype.c b/protocols/skype/skype.c index 80279c54..ccbcaf37 100644 --- a/protocols/skype/skype.c +++ b/protocols/skype/skype.c @@ -1391,10 +1391,7 @@ void skype_chat_invite(struct groupchat *gc, char *who, char *message) struct im_connection *ic = gc->ic; char *ptr, *nick; - /* Unused parameter */ - who = who; - - nick = g_strdup(message); + nick = g_strdup(who); ptr = strchr(nick, '@'); if (ptr) *ptr = '\0'; -- cgit v1.2.3 From c573f1b53466e34c26296227e4c661df9cae1c15 Mon Sep 17 00:00:00 2001 From: Jan Hruban Date: Wed, 15 Jun 2011 14:18:16 +0200 Subject: Don't create new channel when skype groupchat turns from DIALOG to MULTI_SUBSCRIBED (works only when user initiates the chat, otherwise new channel is created anyway) --- protocols/skype/skype.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'protocols') diff --git a/protocols/skype/skype.c b/protocols/skype/skype.c index ccbcaf37..e681a2c4 100644 --- a/protocols/skype/skype.c +++ b/protocols/skype/skype.c @@ -911,8 +911,11 @@ static void skype_parse_chat(struct im_connection *ic, char *line) if (gc) imcb_chat_free(gc); if (!strcmp(info, "STATUS MULTI_SUBSCRIBED")) { - gc = imcb_chat_new(ic, id); - imcb_chat_name_hint(gc, id); + gc = bee_chat_by_title(ic->bee, ic, id); + if (!gc) { + gc = imcb_chat_new(ic, id); + imcb_chat_name_hint(gc, id); + } skype_printf(ic, "GET CHAT %s ADDER\n", id); skype_printf(ic, "GET CHAT %s TOPIC\n", id); } else if (!strcmp(info, "STATUS DIALOG") && sd->groupchat_with) { -- cgit v1.2.3 From bd114221b85ae8c1ffec41f1be98570030d33e03 Mon Sep 17 00:00:00 2001 From: Jan Hruban Date: Wed, 15 Jun 2011 14:18:49 +0200 Subject: Free skype groupchats on logout --- protocols/skype/skype.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'protocols') diff --git a/protocols/skype/skype.c b/protocols/skype/skype.c index e681a2c4..6a3e6393 100644 --- a/protocols/skype/skype.c +++ b/protocols/skype/skype.c @@ -1200,6 +1200,9 @@ static void skype_logout(struct im_connection *ic) skype_printf(ic, "SET USERSTATUS OFFLINE\n"); + while( ic->groupchats ) + imcb_chat_free(ic->groupchats->data); + for (i = 0; i < g_list_length(sd->groups); i++) { struct skype_group *sg = (struct skype_group *)g_list_nth_data(sd->groups, i); skype_group_free(sg, FALSE); -- cgit v1.2.3 From 05d964c32262a8b0ce3f8a5d2087d230a461df86 Mon Sep 17 00:00:00 2001 From: Jan Hruban Date: Wed, 15 Jun 2011 14:47:16 +0200 Subject: Bind to IPv6 address when -H is in IPv6 format --- protocols/skype/skyped.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'protocols') diff --git a/protocols/skype/skyped.py b/protocols/skype/skyped.py index 023c1f81..c9bfc2ce 100644 --- a/protocols/skype/skyped.py +++ b/protocols/skype/skyped.py @@ -179,7 +179,10 @@ def bitlbee_idle_handler(skype): def server(host, port, skype = None): global options - sock = socket.socket() + if ":" in host: + sock = socket.socket(socket.AF_INET6) + else: + sock = socket.socket() sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind((host, port)) sock.listen(1) @@ -359,7 +362,7 @@ Options: -c --config path to configuration file (default: %s) -d --debug enable debug messages -h --help this help - -H --host set the tcp host (default: %s) + -H --host set the tcp host, supports IPv4 and IPv6 (default: %s) -l --log set the log file in background mode (default: none) -n --nofork don't run as daemon in the background -p --port set the tcp port (default: %s) -- cgit v1.2.3 From 2ff0f378570177fe42e4bf48b63bea52369f80e8 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 30 Jun 2011 01:25:02 +0200 Subject: skyped: user configuration should have priority --- protocols/skype/skyped.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'protocols') diff --git a/protocols/skype/skyped.py b/protocols/skype/skyped.py index c9bfc2ce..615d6835 100644 --- a/protocols/skype/skyped.py +++ b/protocols/skype/skyped.py @@ -335,9 +335,9 @@ class SkypeApi: class Options: def __init__(self): self.cfgpath = os.path.join(os.environ['HOME'], ".skyped", "skyped.conf") - # for backwards compatibility + # fall back to system-wide settings self.syscfgpath = "/usr/local/etc/skyped/skyped.conf" - if os.path.exists(self.syscfgpath): + if os.path.exists(self.syscfgpath) and not os.path.exists(self.cfgpath): self.cfgpath = self.syscfgpath self.daemon = True self.debug = False -- cgit v1.2.3 From 004f49486f537d0eac436eb9a750b22e6f9fa1f2 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 30 Jun 2011 01:30:33 +0200 Subject: skype: .gitignore -> .bzrignore --- protocols/skype/.bzrignore | 19 +++++++++++++++++++ protocols/skype/.gitignore | 19 ------------------- 2 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 protocols/skype/.bzrignore delete mode 100644 protocols/skype/.gitignore (limited to 'protocols') diff --git a/protocols/skype/.bzrignore b/protocols/skype/.bzrignore new file mode 100644 index 00000000..e90a033b --- /dev/null +++ b/protocols/skype/.bzrignore @@ -0,0 +1,19 @@ +Changelog +HEADER.html +*.gz +*.asc +.htaccess +shot +*.swp +aclocal.m4 +autom4te.cache +config.log +config.mak +config.status +configure +etc +install-sh +skype.so +skyped.conf +skyped.conf.dist +skype.dylib* diff --git a/protocols/skype/.gitignore b/protocols/skype/.gitignore deleted file mode 100644 index e90a033b..00000000 --- a/protocols/skype/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -Changelog -HEADER.html -*.gz -*.asc -.htaccess -shot -*.swp -aclocal.m4 -autom4te.cache -config.log -config.mak -config.status -configure -etc -install-sh -skype.so -skyped.conf -skyped.conf.dist -skype.dylib* -- cgit v1.2.3 From b5a5938849fe4d147cf050685589b47e7b9aedfd Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 3 Jul 2011 16:14:54 +0200 Subject: Install skyped if skype is enabled --- protocols/skype/skyped.conf.dist.in | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 protocols/skype/skyped.conf.dist.in (limited to 'protocols') diff --git a/protocols/skype/skyped.conf.dist.in b/protocols/skype/skyped.conf.dist.in deleted file mode 100644 index 21e07796..00000000 --- a/protocols/skype/skyped.conf.dist.in +++ /dev/null @@ -1,10 +0,0 @@ -[skyped] -# change to your skype username -username = john -# use `echo -n foo|sha1sum` to generate this hash for your password -password = 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33 - -# you have to change the following paths to your home directory: -cert = /home/YOUR_USER/.skyped/skyped.cert.pem -key = /home/YOUR_USER/.skyped/skyped.key.pem -port = 2727 -- cgit v1.2.3 From 51555706adf8a33b1e7f30b9d8d9c381c79b4123 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 3 Jul 2011 16:15:13 +0200 Subject: Install skyped documentation if skype is enabled --- protocols/skype/Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'protocols') diff --git a/protocols/skype/Makefile b/protocols/skype/Makefile index 4f7a036d..bebfe86c 100644 --- a/protocols/skype/Makefile +++ b/protocols/skype/Makefile @@ -1,4 +1,7 @@ --include config.mak +-include ../../Makefile.settings +ifdef SRCDIR +SRCDIR := $(SRCDIR)protocls/skype/ +endif VERSION = 0.9.0 DATE := $(shell date +%Y-%m-%d) @@ -79,7 +82,14 @@ release: gpg --comment "See http://vmiklos.hu/gpg/ for info" \ -ba bitlbee-skype-$(VERSION).tar.gz -doc: HEADER.html Changelog AUTHORS +doc: skyped.1 + +install-doc: + mkdir -p $(DESTDIR)$(MANDIR)/man1/ + install -m 0644 $(SRCDIR)skyped.1 $(DESTDIR)$(MANDIR)/man1/ + +uninstall-doc: + rm -f $(DESTDIR)$(MANDIR)/man1/skyped.1* HEADER.html: README Makefile asciidoc -a toc -a numbered -a sectids -o HEADER.html -a icons -a data-uri --attribute iconsdir=./images/icons README -- cgit v1.2.3 From b518cdc47eee56a969f157c228fa47f7a47afef9 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 3 Jul 2011 16:15:25 +0200 Subject: Drop no longer necessary autofoo from skype plugin dir --- protocols/skype/config.mak.in | 16 -------- protocols/skype/configure.ac | 96 ------------------------------------------- 2 files changed, 112 deletions(-) delete mode 100644 protocols/skype/config.mak.in delete mode 100644 protocols/skype/configure.ac (limited to 'protocols') diff --git a/protocols/skype/config.mak.in b/protocols/skype/config.mak.in deleted file mode 100644 index 06698dad..00000000 --- a/protocols/skype/config.mak.in +++ /dev/null @@ -1,16 +0,0 @@ -CFLAGS = @CFLAGS@ -LDFLAGS = @LDFLAGS@ -SHARED_FLAGS = @SHARED_FLAGS@ -SHARED_EXT = @SHARED_EXT@ -SKYPE4PY = @SKYPE4PY@ -BITLBEE = @BITLBEE@ -ASCIIDOC = @ASCIIDOC@ -INSTALL = @INSTALL@ -prefix = @prefix@ -sysconfdir = @sysconfdir@/skyped -exec_prefix = @exec_prefix@ -bindir = @bindir@ -libdir = @libdir@ -plugindir = ${libdir}/bitlbee -datarootdir = @datarootdir@ -mandir = @mandir@ diff --git a/protocols/skype/configure.ac b/protocols/skype/configure.ac deleted file mode 100644 index a616758c..00000000 --- a/protocols/skype/configure.ac +++ /dev/null @@ -1,96 +0,0 @@ -AC_INIT([Skype plugin for BitlBee], 1.0, [vmiklos@vmiklos.hu], bitlbee-skype) -AC_PROG_CC -AC_PROG_INSTALL - -AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Enable debug support (default: disabled)]), debug=yes) -AC_MSG_CHECKING(for debug mode request) -if test "x$debug" = "xyes" ; then - CFLAGS="-g -Wall -Werror" - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi - -case "`$CC -dumpmachine`" in - *linux*|*freebsd*|*netbsd*|*openbsd*) - SHARED_FLAGS="-fPIC -shared" - SHARED_EXT="so" - ;; - *apple-darwin*) - SHARED_FLAGS="-dynamiclib -undefined dynamic_lookup" - SHARED_EXT="dylib" - ;; - *) - AC_MSG_ERROR([Your machine is not yet supported]) - ;; -esac -AC_SUBST(SHARED_FLAGS) -AC_SUBST(SHARED_EXT) - -dnl Check for bitlbee -AC_MSG_CHECKING(for BitlBee) -if test -d /usr/local/lib/pkgconfig; then - PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig - export PKG_CONFIG_PATH -fi -pkg-config --exists bitlbee -if test "$?" != "0"; then - AC_MSG_RESULT(no) - BITLBEE="no" -else - AC_MSG_RESULT(yes) - BITLBEE="yes" - if test -z "$CFLAGS"; then - CFLAGS="`pkg-config --cflags bitlbee`" - else - CFLAGS="$CFLAGS `pkg-config --cflags bitlbee`" - fi - if test -z "$LDFLAGS"; then - LDFLAGS="`pkg-config --libs bitlbee`" - else - LDFLAGS="$LDFLAGS `pkg-config --libs bitlbee`" - fi - prefix=`pkg-config --variable=prefix bitlbee` -fi -AC_SUBST(BITLBEE) - -dnl Check for a2x -AC_ARG_ENABLE([asciidoc], AS_HELP_STRING([--disable-asciidoc], [Disable asciidoc support (default: test)])) -if test "$enable_asciidoc" != "no"; then - AC_CHECK_PROG(ASCIIDOC, asciidoc, yes, []) -fi - -dnl Check for Skype4Py -AC_MSG_CHECKING(for Python module Skype4Py) -python2.7 -c "import Skype4Py" 2>&AS_MESSAGE_LOG_FD -if test "$?" != "0"; then - AC_MSG_RESULT(no) - SKYPE4PY="no" -else - AC_MSG_RESULT(yes) - SKYPE4PY="yes" -fi -AC_SUBST(SKYPE4PY) - -if test "$BITLBEE" = "no" -a "$SKYPE4PY" = "no"; then - AC_ERROR([In order to use bitlbee-skype you need at least BitlBee or Skype4Py installed.]) -fi - -AC_OUTPUT(config.mak) -AC_OUTPUT(skyped.conf.dist) - -echo " - BitlBee plugin: $BITLBEE - skyped: $SKYPE4PY - prefix: $prefix - install program: $INSTALL" -if test "$BITLBEE" = "yes"; then - echo " compiler flags: $CFLAGS - linker flags: $LDFLAGS - shared object flags: $SHARED_FLAGS - shared object extension: $SHARED_EXT" -fi -if test "$SKYPE4PY" = "yes"; then - echo " sysconfig dir: $sysconfdir/skyped" -fi -echo -- cgit v1.2.3 From d6b690624885f6bc34e5dfb9a84daa34a1adb7e6 Mon Sep 17 00:00:00 2001 From: Jasper Spaans Date: Wed, 3 Aug 2011 23:45:49 +0200 Subject: Make it easier to retweet by id. Currently, typing "rt 24" would retweet the last message from @24. This patch allows one to retweet the tweet with id 24 by typing "rt #24". --- protocols/twitter/twitter.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'protocols') diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index 57a1ed80..7cf8a239 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -490,7 +490,11 @@ static void twitter_handle_command(struct im_connection *ic, char *message) bee_user_t *bu; guint64 id; - if ((bu = bee_user_by_handle(ic->bee, ic, cmd[1])) && + if (g_str_has_prefix(cmd[1], "#")) { + id = g_ascii_strtoull(cmd[1] + 1, NULL, 10); + if (id < TWITTER_LOG_LENGTH && td->log) + id = td->log[id].id; + } else if ((bu = bee_user_by_handle(ic->bee, ic, cmd[1])) && (tud = bu->data) && tud->last_id) id = tud->last_id; else { -- cgit v1.2.3 From aa2f575d34af957eaf7fac58a54055ba74a1085f Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 17 Aug 2011 23:21:47 +0100 Subject: Better cleanup of status IDs in Twitter commands. Stop using that silly g_ascii_strtoull() everywhere. This should fix some accidental Tweet incidents. --- protocols/twitter/twitter.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'protocols') diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index fcbc88d7..175b1d0d 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -464,15 +464,14 @@ static void twitter_handle_command(struct im_connection *ic, char *message) } else if (g_strcasecmp(cmd[0], "undo") == 0) { guint64 id; - if (cmd[1]) - id = g_ascii_strtoull(cmd[1], NULL, 10); - else - id = td->last_status_id; - - /* TODO: User feedback. */ - if (id) + if (cmd[1] == NULL) + twitter_status_destroy(ic, td->last_status_id); + else if (sscanf(cmd[1], "%" G_GUINT64_FORMAT, &id) == 1) { + if (id < TWITTER_LOG_LENGTH && td->log) + id = td->log[id].id; + twitter_status_destroy(ic, id); - else + } else twitter_msg(ic, "Could not undo last action"); g_free(cmds); @@ -490,15 +489,14 @@ static void twitter_handle_command(struct im_connection *ic, char *message) bee_user_t *bu; guint64 id; - if (g_str_has_prefix(cmd[1], "#")) { - id = g_ascii_strtoull(cmd[1] + 1, NULL, 10); + if (g_str_has_prefix(cmd[1], "#") && + sscanf(cmd[1] + 1, "%" G_GUINT64_FORMAT, &id) == 1) { if (id < TWITTER_LOG_LENGTH && td->log) id = td->log[id].id; } else if ((bu = bee_user_by_handle(ic->bee, ic, cmd[1])) && (tud = bu->data) && tud->last_id) id = tud->last_id; - else { - id = g_ascii_strtoull(cmd[1], NULL, 10); + else if (sscanf(cmd[1], "%" G_GUINT64_FORMAT, &id) == 1){ if (id < TWITTER_LOG_LENGTH && td->log) id = td->log[id].id; } @@ -517,7 +515,15 @@ static void twitter_handle_command(struct im_connection *ic, char *message) bee_user_t *bu = NULL; guint64 id = 0; - if ((bu = bee_user_by_handle(ic->bee, ic, cmd[1])) && + if (g_str_has_prefix(cmd[1], "#") && + sscanf(cmd[1] + 1, "%" G_GUINT64_FORMAT, &id) == 1 && + (id < TWITTER_LOG_LENGTH) && td->log) { + bu = td->log[id].bu; + if (g_slist_find(ic->bee->users, bu)) + id = td->log[id].id; + else + bu = NULL; + } else if ((bu = bee_user_by_handle(ic->bee, ic, cmd[1])) && (tud = bu->data) && tud->last_id) { id = tud->last_id; } else if (sscanf(cmd[1], "%" G_GUINT64_FORMAT, &id) == 1 && @@ -528,6 +534,7 @@ static void twitter_handle_command(struct im_connection *ic, char *message) else bu = NULL; } + if (!id || !bu) { twitter_msg(ic, "User `%s' does not exist or didn't " "post any statuses recently", cmd[1]); -- cgit v1.2.3 From 2322a9f38a2f6c9bf86eb62c2cd68fd3848b694f Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 25 Aug 2011 20:08:07 +0200 Subject: Merging Twitter-mentions patch from meh. Bug #663. --- protocols/twitter/twitter.c | 37 +++-- protocols/twitter/twitter.h | 12 +- protocols/twitter/twitter_lib.c | 302 ++++++++++++++++++++++++++++++++-------- protocols/twitter/twitter_lib.h | 2 + 4 files changed, 282 insertions(+), 71 deletions(-) (limited to 'protocols') diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index 175b1d0d..ac180250 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -29,12 +29,12 @@ #include "url.h" #define twitter_msg( ic, fmt... ) \ - do { \ - struct twitter_data *td = ic->proto_data; \ - if( td->home_timeline_gc ) \ - imcb_chat_log( td->home_timeline_gc, fmt ); \ - else \ - imcb_log( ic, fmt ); \ + do { \ + struct twitter_data *td = ic->proto_data; \ + if( td->timeline_gc ) \ + imcb_chat_log( td->timeline_gc, fmt ); \ + else \ + imcb_log( ic, fmt ); \ } while( 0 ); GSList *twitter_connections = NULL; @@ -51,7 +51,7 @@ gboolean twitter_main_loop(gpointer data, gint fd, b_input_condition cond) return 0; // Do stuff.. - twitter_get_home_timeline(ic, -1); + twitter_get_timeline(ic, -1); // If we are still logged in run this function again after timeout. return (ic->flags & OPT_LOGGED_IN) == OPT_LOGGED_IN; @@ -68,7 +68,8 @@ static void twitter_main_loop_start(struct im_connection *ic) // Queue the main_loop // Save the return value, so we can remove the timeout on logout. - td->main_loop_id = b_timeout_add(60000, twitter_main_loop, ic); + td->main_loop_id = + b_timeout_add(set_getint(&ic->acc->set, "fetch_interval") * 1000, twitter_main_loop, ic); } static void twitter_oauth_start(struct im_connection *ic); @@ -77,6 +78,8 @@ void twitter_login_finish(struct im_connection *ic) { struct twitter_data *td = ic->proto_data; + td->flags &= ~TWITTER_DOING_TIMELINE; + if (set_getbool(&ic->acc->set, "oauth") && !td->oauth_info) twitter_oauth_start(ic); else if (g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "one") != 0 && @@ -215,7 +218,6 @@ static void twitter_init(account_t * acc) def_url = TWITTER_API_URL; def_oauth = "true"; } else { /* if( strcmp( acc->prpl->name, "identica" ) == 0 ) */ - def_url = IDENTICA_API_URL; def_oauth = "false"; } @@ -227,6 +229,11 @@ static void twitter_init(account_t * acc) s = set_add(&acc->set, "commands", "true", set_eval_bool, acc); + s = set_add(&acc->set, "fetch_interval", "60", set_eval_int, acc); + s->flags |= ACC_SET_OFFLINE_ONLY; + + s = set_add(&acc->set, "fetch_mentions", "true", set_eval_bool, acc); + s = set_add(&acc->set, "message_length", "140", set_eval_int, acc); s = set_add(&acc->set, "mode", "chat", set_eval_mode, acc); @@ -235,6 +242,8 @@ static void twitter_init(account_t * acc) s = set_add(&acc->set, "show_ids", "false", set_eval_bool, acc); s->flags |= ACC_SET_OFFLINE_ONLY; + s = set_add(&acc->set, "show_old_mentions", "true", set_eval_bool, acc); + s = set_add(&acc->set, "oauth", def_oauth, set_eval_bool, acc); } @@ -316,8 +325,8 @@ static void twitter_logout(struct im_connection *ic) // Remove the main_loop function from the function queue. b_event_remove(td->main_loop_id); - if (td->home_timeline_gc) - imcb_chat_free(td->home_timeline_gc); + if (td->timeline_gc) + imcb_chat_free(td->timeline_gc); if (td) { oauth_info_free(td->oauth_info); @@ -403,13 +412,13 @@ static void twitter_chat_leave(struct groupchat *c) { struct twitter_data *td = c->ic->proto_data; - if (c != td->home_timeline_gc) + if (c != td->timeline_gc) return; /* WTF? */ /* If the user leaves the channel: Fine. Rejoin him/her once new tweets come in. */ - imcb_chat_free(td->home_timeline_gc); - td->home_timeline_gc = NULL; + imcb_chat_free(td->timeline_gc); + td->timeline_gc = NULL; } static void twitter_keepalive(struct im_connection *ic) diff --git a/protocols/twitter/twitter.h b/protocols/twitter/twitter.h index c38d9b86..14e43824 100644 --- a/protocols/twitter/twitter.h +++ b/protocols/twitter/twitter.h @@ -35,6 +35,9 @@ typedef enum { TWITTER_HAVE_FRIENDS = 1, + TWITTER_DOING_TIMELINE = 0x10000, + TWITTER_GOT_TIMELINE = 0x20000, + TWITTER_GOT_MENTIONS = 0x40000, } twitter_flags_t; struct twitter_log_data; @@ -43,12 +46,17 @@ struct twitter_data { char* user; struct oauth_info *oauth_info; + + gpointer home_timeline_obj; + gpointer mentions_obj; + + guint64 timeline_id; + GSList *follow_ids; - guint64 home_timeline_id; guint64 last_status_id; /* For undo */ gint main_loop_id; - struct groupchat *home_timeline_gc; + struct groupchat *timeline_gc; gint http_fails; twitter_flags_t flags; diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index 14e98c53..805ff5aa 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -77,17 +77,20 @@ static void txu_free(struct twitter_xml_user *txu) { if (txu == NULL) return; + g_free(txu->name); g_free(txu->screen_name); g_free(txu); } - /** * Frees a twitter_xml_status struct. */ static void txs_free(struct twitter_xml_status *txs) { + if (txs == NULL) + return; + g_free(txs->text); txu_free(txs->user); g_free(txs); @@ -102,19 +105,40 @@ static void txl_free(struct twitter_xml_list *txl) GSList *l; if (txl == NULL) return; - for (l = txl->list; l; l = g_slist_next(l)) - if (txl->type == TXL_STATUS) + + for (l = txl->list; l; l = g_slist_next(l)) { + if (txl->type == TXL_STATUS) { txs_free((struct twitter_xml_status *) l->data); - else if (txl->type == TXL_ID) + } else if (txl->type == TXL_ID) { g_free(l->data); - else if (txl->type == TXL_USER) + } else if (txl->type == TXL_USER) { txu_free(l->data); + } + } + g_slist_free(txl->list); g_free(txl); } /** - * Add a buddy if it is not allready added, set the status to logged in. + * Compare status elements + */ +static gint twitter_compare_elements(gconstpointer a, gconstpointer b) +{ + struct twitter_xml_status *a_status = (struct twitter_xml_status *) a; + struct twitter_xml_status *b_status = (struct twitter_xml_status *) b; + + if (a_status->created_at < b_status->created_at) { + return -1; + } else if (a_status->created_at > b_status->created_at) { + return 1; + } else { + return 0; + } +} + +/** + * Add a buddy if it is not already added, set the status to logged in. */ static void twitter_add_buddy(struct im_connection *ic, char *name, const char *fullname) { @@ -131,7 +155,7 @@ static void twitter_add_buddy(struct im_connection *ic, char *name, const char * /* Necessary so that nicks always get translated to the exact Twitter username. */ imcb_buddy_nick_hint(ic, name, name); - imcb_chat_add_buddy(td->home_timeline_gc, name); + imcb_chat_add_buddy(td->timeline_gc, name); } else if (g_strcasecmp(mode, "many") == 0) imcb_buddy_status(ic, name, OPT_LOGGED_IN, NULL, NULL); } @@ -259,7 +283,7 @@ static void twitter_http_get_friends_ids(struct http_request *req) } /* Create the room now that we "logged in". */ - if (!td->home_timeline_gc && g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "chat") == 0) + if (!td->timeline_gc && g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "chat") == 0) twitter_groupchat_init(ic); txl = g_new0(struct twitter_xml_list, 1); @@ -521,32 +545,6 @@ static xt_status twitter_xt_get_status_list(struct im_connection *ic, struct xt_ return XT_HANDLED; } -static void twitter_http_get_home_timeline(struct http_request *req); - -/** - * Get the timeline. - */ -void twitter_get_home_timeline(struct im_connection *ic, gint64 next_cursor) -{ - struct twitter_data *td = ic->proto_data; - - char *args[4]; - args[0] = "cursor"; - args[1] = g_strdup_printf("%lld", (long long) next_cursor); - if (td->home_timeline_id) { - args[2] = "since_id"; - args[3] = g_strdup_printf("%llu", (long long unsigned int) td->home_timeline_id); - } - - twitter_http(ic, TWITTER_HOME_TIMELINE_URL, twitter_http_get_home_timeline, ic, 0, args, - td->home_timeline_id ? 4 : 2); - - g_free(args[1]); - if (td->home_timeline_id) { - g_free(args[3]); - } -} - static char *twitter_msg_add_id(struct im_connection *ic, struct twitter_xml_status *txs, const char *prefix) { @@ -585,7 +583,7 @@ static void twitter_groupchat_init(struct im_connection *ic) struct twitter_data *td = ic->proto_data; GSList *l; - td->home_timeline_gc = gc = imcb_chat_new(ic, "home/timeline"); + td->timeline_gc = gc = imcb_chat_new(ic, "twitter/timeline"); name_hint = g_strdup_printf("%s_%s", td->prefix, ic->acc->user); imcb_chat_name_hint(gc, name_hint); @@ -594,7 +592,7 @@ static void twitter_groupchat_init(struct im_connection *ic) for (l = ic->bee->users; l; l = l->next) { bee_user_t *bu = l->data; if (bu->ic == ic) - imcb_chat_add_buddy(td->home_timeline_gc, bu->handle); + imcb_chat_add_buddy(td->timeline_gc, bu->handle); } } @@ -607,12 +605,13 @@ static void twitter_groupchat(struct im_connection *ic, GSList * list) GSList *l = NULL; struct twitter_xml_status *status; struct groupchat *gc; + guint64 last_id = 0; // Create a new groupchat if it does not exsist. - if (!td->home_timeline_gc) + if (!td->timeline_gc) twitter_groupchat_init(ic); - gc = td->home_timeline_gc; + gc = td->timeline_gc; if (!gc->joined) imcb_chat_add_buddy(gc, ic->acc->user); @@ -620,26 +619,30 @@ static void twitter_groupchat(struct im_connection *ic, GSList * list) char *msg; status = l->data; - if (status->user == NULL || status->text == NULL) + if (status->user == NULL || status->text == NULL || last_id == status->id) continue; - twitter_add_buddy(ic, status->user->screen_name, status->user->name); + last_id = status->id; strip_html(status->text); + msg = twitter_msg_add_id(ic, status, ""); // Say it! - if (g_strcasecmp(td->user, status->user->screen_name) == 0) + if (g_strcasecmp(td->user, status->user->screen_name) == 0) { imcb_chat_log(gc, "You: %s", msg ? msg : status->text); - else + } else { + twitter_add_buddy(ic, status->user->screen_name, status->user->name); + imcb_chat_msg(gc, status->user->screen_name, msg ? msg : status->text, 0, status->created_at); + } g_free(msg); - // Update the home_timeline_id to hold the highest id, so that by the next request + // 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->home_timeline_id = MAX(td->home_timeline_id, status->id); + td->timeline_id = MAX(td->timeline_id, status->id); } } @@ -653,6 +656,7 @@ static void twitter_private_message_chat(struct im_connection *ic, GSList * list struct twitter_xml_status *status; char from[MAX_STRING]; gboolean mode_one; + guint64 last_id = 0; mode_one = g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "one") == 0; @@ -665,6 +669,10 @@ static void twitter_private_message_chat(struct im_connection *ic, GSList * list char *prefix = NULL, *text = NULL; status = l->data; + if (status->user == NULL || status->text == NULL || last_id == status->id) + continue; + + last_id = status->id; strip_html(status->text); if (mode_one) @@ -679,15 +687,150 @@ static void twitter_private_message_chat(struct im_connection *ic, GSList * list mode_one ? from : status->user->screen_name, text ? text : status->text, 0, status->created_at); - // Update the home_timeline_id to hold the highest id, so that by the next request + // 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->home_timeline_id = MAX(td->home_timeline_id, status->id); + td->timeline_id = MAX(td->timeline_id, status->id); g_free(text); g_free(prefix); } } +static void twitter_http_get_home_timeline(struct http_request *req); +static void twitter_http_get_mentions(struct http_request *req); + +/** + * Get the timeline with optionally mentions + */ +void twitter_get_timeline(struct im_connection *ic, gint64 next_cursor) +{ + struct twitter_data *td = ic->proto_data; + gboolean include_mentions = set_getbool(&ic->acc->set, "fetch_mentions"); + + if (td->flags & TWITTER_DOING_TIMELINE) { + return; + } + + td->flags |= TWITTER_DOING_TIMELINE; + + twitter_get_home_timeline(ic, next_cursor); + + if (include_mentions) { + twitter_get_mentions(ic, next_cursor); + } +} + +/** + * Call this one after receiving timeline/mentions. Show to user once we have + * both. + */ +void twitter_flush_timeline(struct im_connection *ic) +{ + struct twitter_data *td = ic->proto_data; + gboolean include_mentions = set_getbool(&ic->acc->set, "fetch_mentions"); + gboolean show_old_mentions = set_getbool(&ic->acc->set, "show_old_mentions"); + struct twitter_xml_list *home_timeline = td->home_timeline_obj; + struct twitter_xml_list *mentions = td->mentions_obj; + GSList *output = NULL; + GSList *l; + + if (!(td->flags & TWITTER_GOT_TIMELINE)) { + return; + } + + if (include_mentions && !(td->flags & TWITTER_GOT_MENTIONS)) { + return; + } + + if (home_timeline && home_timeline->list) { + for (l = home_timeline->list; l; l = g_slist_next(l)) { + output = g_slist_insert_sorted(output, l->data, twitter_compare_elements); + } + } + + if (include_mentions && mentions && mentions->list) { + for (l = mentions->list; l; l = g_slist_next(l)) { + if (!show_old_mentions && output && twitter_compare_elements(l->data, output->data) < 0) { + continue; + } + + output = g_slist_insert_sorted(output, l->data, twitter_compare_elements); + } + } + + // See if the user wants to see the messages in a groupchat window or as private messages. + if (g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "chat") == 0) + twitter_groupchat(ic, output); + else + twitter_private_message_chat(ic, output); + + g_slist_free(output); + + if (home_timeline && home_timeline->list) { + txl_free(home_timeline); + } + + if (mentions && mentions->list) { + txl_free(mentions); + } + + td->flags &= ~(TWITTER_DOING_TIMELINE | TWITTER_GOT_TIMELINE | TWITTER_GOT_MENTIONS); +} + +/** + * Get the timeline. + */ +void twitter_get_home_timeline(struct im_connection *ic, gint64 next_cursor) +{ + struct twitter_data *td = ic->proto_data; + + td->home_timeline_obj = NULL; + td->flags &= ~TWITTER_GOT_TIMELINE; + + char *args[4]; + args[0] = "cursor"; + args[1] = g_strdup_printf("%lld", (long long) next_cursor); + if (td->timeline_id) { + args[2] = "since_id"; + args[3] = g_strdup_printf("%llu", (long long unsigned int) td->timeline_id); + } + + twitter_http(ic, TWITTER_HOME_TIMELINE_URL, twitter_http_get_home_timeline, ic, 0, args, + td->timeline_id ? 4 : 2); + + g_free(args[1]); + if (td->timeline_id) { + g_free(args[3]); + } +} + +/** + * Get mentions. + */ +void twitter_get_mentions(struct im_connection *ic, gint64 next_cursor) +{ + struct twitter_data *td = ic->proto_data; + + td->mentions_obj = NULL; + td->flags &= ~TWITTER_GOT_MENTIONS; + + char *args[4]; + args[0] = "cursor"; + args[1] = g_strdup_printf("%lld", (long long) next_cursor); + if (td->timeline_id) { + args[2] = "since_id"; + args[3] = g_strdup_printf("%llu", (long long unsigned int) td->timeline_id); + } + + twitter_http(ic, TWITTER_MENTIONS_URL, twitter_http_get_mentions, ic, 0, args, + td->timeline_id ? 4 : 2); + + g_free(args[1]); + if (td->timeline_id) { + g_free(args[3]); + } +} + /** * Callback for getting the home timeline. */ @@ -712,14 +855,66 @@ static void twitter_http_get_home_timeline(struct http_request *req) } else if (req->status_code == 401) { imcb_error(ic, "Authentication failure"); imc_logout(ic, FALSE); - return; + goto end; } else { // It didn't go well, output the error and return. if (++td->http_fails >= 5) imcb_error(ic, "Could not retrieve %s: %s", TWITTER_HOME_TIMELINE_URL, twitter_parse_error(req)); + goto end; + } + + txl = g_new0(struct twitter_xml_list, 1); + txl->list = NULL; + + // Parse the data. + parser = xt_new(NULL, txl); + xt_feed(parser, req->reply_body, req->body_size); + // The root node should hold the list of statuses + twitter_xt_get_status_list(ic, parser->root, txl); + xt_free(parser); + + td->home_timeline_obj = txl; + + end: + td->flags |= TWITTER_GOT_TIMELINE; + + twitter_flush_timeline(ic); +} + +/** + * Callback for getting mentions. + */ +static void twitter_http_get_mentions(struct http_request *req) +{ + struct im_connection *ic = req->data; + struct twitter_data *td; + struct xt_parser *parser; + struct twitter_xml_list *txl; + + // Check if the connection is still active. + if (!g_slist_find(twitter_connections, ic)) return; + + td = ic->proto_data; + + // Check if the HTTP request went well. + if (req->status_code == 200) { + td->http_fails = 0; + if (!(ic->flags & OPT_LOGGED_IN)) + imcb_connected(ic); + } else if (req->status_code == 401) { + imcb_error(ic, "Authentication failure"); + imc_logout(ic, FALSE); + goto end; + } else { + // It didn't go well, output the error and return. + if (++td->http_fails >= 5) + imcb_error(ic, "Could not retrieve " TWITTER_MENTIONS_URL ": %s", + twitter_parse_error(req)); + + goto end; } txl = g_new0(struct twitter_xml_list, 1); @@ -732,15 +927,12 @@ static void twitter_http_get_home_timeline(struct http_request *req) twitter_xt_get_status_list(ic, parser->root, txl); xt_free(parser); - // See if the user wants to see the messages in a groupchat window or as private messages. - if (txl->list == NULL); - else if (g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "chat") == 0) - twitter_groupchat(ic, txl->list); - else - twitter_private_message_chat(ic, txl->list); + td->mentions_obj = txl; - // Free the structure. - txl_free(txl); + end: + td->flags |= TWITTER_GOT_MENTIONS; + + twitter_flush_timeline(ic); } /** diff --git a/protocols/twitter/twitter_lib.h b/protocols/twitter/twitter_lib.h index c33b2dfc..b06f5055 100644 --- a/protocols/twitter/twitter_lib.h +++ b/protocols/twitter/twitter_lib.h @@ -75,8 +75,10 @@ #define TWITTER_BLOCKS_CREATE_URL "/blocks/create/" #define TWITTER_BLOCKS_DESTROY_URL "/blocks/destroy/" +void twitter_get_timeline(struct im_connection *ic, gint64 next_cursor); void twitter_get_friends_ids(struct im_connection *ic, gint64 next_cursor); void twitter_get_home_timeline(struct im_connection *ic, gint64 next_cursor); +void twitter_get_mentions(struct im_connection *ic, gint64 next_cursor); void twitter_get_statuses_friends(struct im_connection *ic, gint64 next_cursor); void twitter_post_status(struct im_connection *ic, char *msg, guint64 in_reply_to); -- cgit v1.2.3 From 429a9b17fb256e5fc750104f4c5ffb2dc7fba74b Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 26 Aug 2011 22:16:17 +0200 Subject: Since t.co is all over Twitter now, start parsing and showing entity information. I'm going for this way of rendering even though full URLs are also available to me because A) it puts me on the safe side wrt Twitter ToS and B) some full URLS may really be very long. Noticed some problem with truncated RT statuses not getting fixed but this seems to be unrelated. (This is a truncated RT status without the "truncated" property set.) Bug #821. --- protocols/twitter/twitter_lib.c | 45 ++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 10 deletions(-) (limited to 'protocols') diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index 805ff5aa..7f2fb811 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -498,6 +498,27 @@ static xt_status twitter_xt_get_status(struct xt_node *node, struct twitter_xml_ g_free(txs->text); txs->text = g_strdup_printf("RT @%s: %s", rtxs->user->screen_name, rtxs->text); txs_free(rtxs); + } else { + struct xt_node *urls, *url; + + urls = xt_find_path(node, "entities/urls"); + for (url = urls ? urls->children : NULL; url; url = url->next) { + /* "short" is a reserved word. :-P */ + struct xt_node *kort = xt_find_node(url->children, "url"); + struct xt_node *disp = xt_find_node(url->children, "display_url"); + char *pos, *new; + + if (!kort || !kort->text || !disp || !disp->text || + !(pos = strstr(txs->text, kort->text))) + continue; + + *pos = '\0'; + new = g_strdup_printf("%s%s <%s>%s", txs->text, kort->text, + disp->text, pos + strlen(kort->text)); + + g_free(txs->text); + txs->text = new; + } } return XT_HANDLED; @@ -787,20 +808,22 @@ void twitter_get_home_timeline(struct im_connection *ic, gint64 next_cursor) td->home_timeline_obj = NULL; td->flags &= ~TWITTER_GOT_TIMELINE; - char *args[4]; + char *args[6]; args[0] = "cursor"; args[1] = g_strdup_printf("%lld", (long long) next_cursor); + args[2] = "include_entities"; + args[3] = "true"; if (td->timeline_id) { - args[2] = "since_id"; - args[3] = g_strdup_printf("%llu", (long long unsigned int) td->timeline_id); + args[4] = "since_id"; + args[5] = g_strdup_printf("%llu", (long long unsigned int) td->timeline_id); } twitter_http(ic, TWITTER_HOME_TIMELINE_URL, twitter_http_get_home_timeline, ic, 0, args, - td->timeline_id ? 4 : 2); + td->timeline_id ? 6 : 4); g_free(args[1]); if (td->timeline_id) { - g_free(args[3]); + g_free(args[5]); } } @@ -814,20 +837,22 @@ void twitter_get_mentions(struct im_connection *ic, gint64 next_cursor) td->mentions_obj = NULL; td->flags &= ~TWITTER_GOT_MENTIONS; - char *args[4]; + char *args[6]; args[0] = "cursor"; args[1] = g_strdup_printf("%lld", (long long) next_cursor); + args[2] = "include_entities"; + args[3] = "true"; if (td->timeline_id) { - args[2] = "since_id"; - args[3] = g_strdup_printf("%llu", (long long unsigned int) td->timeline_id); + args[4] = "since_id"; + args[5] = g_strdup_printf("%llu", (long long unsigned int) td->timeline_id); } twitter_http(ic, TWITTER_MENTIONS_URL, twitter_http_get_mentions, ic, 0, args, - td->timeline_id ? 4 : 2); + td->timeline_id ? 6 : 4); g_free(args[1]); if (td->timeline_id) { - g_free(args[3]); + g_free(args[5]); } } -- cgit v1.2.3 From 0fff0b22db8860d3e6165f381028b441f26a31fe Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 27 Aug 2011 12:18:45 +0200 Subject: Just reconstruct all retweets instead of just the ones marked as truncated. --- protocols/twitter/twitter_lib.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'protocols') diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index 7f2fb811..4c680930 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -459,14 +459,11 @@ static xt_status twitter_xt_get_users(struct xt_node *node, struct twitter_xml_l static xt_status twitter_xt_get_status(struct xt_node *node, struct twitter_xml_status *txs) { struct xt_node *child, *rt = NULL; - gboolean truncated = FALSE; // Walk over the nodes children. for (child = node->children; child; child = child->next) { if (g_strcasecmp("text", child->name) == 0) { txs->text = g_memdup(child->text, child->text_len + 1); - } else if (g_strcasecmp("truncated", child->name) == 0 && child->text) { - truncated = bool2int(child->text); } else if (g_strcasecmp("retweeted_status", child->name) == 0) { rt = child; } else if (g_strcasecmp("created_at", child->name) == 0) { @@ -487,8 +484,9 @@ static xt_status twitter_xt_get_status(struct xt_node *node, struct twitter_xml_ } } - /* If it's a truncated retweet, get the original because dots suck. */ - if (truncated && rt) { + /* If it's a (truncated) retweet, get the original. Even if the API claims it + wasn't truncated because it may be lying. */ + if (rt) { struct twitter_xml_status *rtxs = g_new0(struct twitter_xml_status, 1); if (twitter_xt_get_status(rt, rtxs) != XT_HANDLED) { txs_free(rtxs); -- cgit v1.2.3 From ff18fc1612e9468a8406728e180b453ca6bd408a Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 27 Aug 2011 12:30:48 +0200 Subject: Fix #820, make Skype mod compile on NetBSD. (I haven't personally tested that the Skype module *works* after this nor have I received any reports that either confirm or deny this. This change just makes it *compile*.) --- protocols/skype/skype.c | 1 + 1 file changed, 1 insertion(+) (limited to 'protocols') diff --git a/protocols/skype/skype.c b/protocols/skype/skype.c index 6a3e6393..5b1a6c30 100644 --- a/protocols/skype/skype.c +++ b/protocols/skype/skype.c @@ -22,6 +22,7 @@ #define _XOPEN_SOURCE #define _BSD_SOURCE #include +#include #include #include -- cgit v1.2.3 From e67e513a16f3e545fd71eb176aac83d41a1dc271 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 3 Oct 2011 16:56:58 +0200 Subject: rename irc_usermsg to irc_rootmsg. add new irc_usermsg, irc_usernotice. deliver user-specific messages from libotr as notices to that user. --- protocols/nogaim.c | 4 ++-- protocols/purple/purple.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'protocols') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 8fb85ea7..a44679ce 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -215,9 +215,9 @@ static void serv_got_crap( struct im_connection *ic, char *format, ... ) /* If we found one, include the screenname in the message. */ if( a ) /* FIXME(wilmer): ui_log callback or so */ - irc_usermsg( ic->bee->ui_data, "%s(%s) - %s", ic->acc->prpl->name, ic->acc->user, text ); + irc_rootmsg( ic->bee->ui_data, "%s(%s) - %s", ic->acc->prpl->name, ic->acc->user, text ); else - irc_usermsg( ic->bee->ui_data, "%s - %s", ic->acc->prpl->name, text ); + irc_rootmsg( ic->bee->ui_data, "%s - %s", ic->acc->prpl->name, text ); g_free( text ); } diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c index 55678f92..fe0fc35f 100644 --- a/protocols/purple/purple.c +++ b/protocols/purple/purple.c @@ -180,7 +180,7 @@ static void purple_init( account_t *acc ) default: /** No way to talk to the user right now, invent one when this becomes important. - irc_usermsg( acc->irc, "Setting with unknown type: %s (%d) Expect stuff to break..\n", + irc_rootmsg( acc->irc, "Setting with unknown type: %s (%d) Expect stuff to break..\n", name, purple_account_option_get_type( o ) ); */ name = NULL; -- cgit v1.2.3 From 733f607bfaa34aa949df2602aec3b46aa2c3a46f Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 17 Oct 2011 23:58:14 -0400 Subject: Stupid work-around for bug #838. The troublesome condition is known, I just don't know exactly how BitlBee gets into it. Any more info from people who see this problem often would be useful. --- protocols/twitter/twitter.h | 1 + protocols/twitter/twitter_lib.c | 7 +++++++ 2 files changed, 8 insertions(+) (limited to 'protocols') diff --git a/protocols/twitter/twitter.h b/protocols/twitter/twitter.h index 14e43824..47dbeb29 100644 --- a/protocols/twitter/twitter.h +++ b/protocols/twitter/twitter.h @@ -38,6 +38,7 @@ typedef enum TWITTER_DOING_TIMELINE = 0x10000, TWITTER_GOT_TIMELINE = 0x20000, TWITTER_GOT_MENTIONS = 0x40000, + TWITTER_DOING_TIMELINE_SLOW = 0x80000, } twitter_flags_t; struct twitter_log_data; diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index 4c680930..dd9c3ac6 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -726,6 +726,13 @@ void twitter_get_timeline(struct im_connection *ic, gint64 next_cursor) struct twitter_data *td = ic->proto_data; gboolean include_mentions = set_getbool(&ic->acc->set, "fetch_mentions"); + if ((td->flags & 0xf0000) == (TWITTER_DOING_TIMELINE | TWITTER_DOING_TIMELINE_SLOW)) { + imcb_log(ic, "Connection seems to have stalled again.\n" + "This is a known bug, if you see this happen a lot " + "please generate some traffic dumps."); + td->flags &= ~0xf0000; + } + if (td->flags & TWITTER_DOING_TIMELINE) { return; } -- cgit v1.2.3 From 32bea82d26872395634862204f551644233454ae Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 19 Oct 2011 22:59:57 -0400 Subject: changeset:devel,814 was silly and incomplete. This should fix that. Full workaround for Twitter "hang" problem. --- protocols/twitter/twitter_lib.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'protocols') diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index dd9c3ac6..00e3a2ee 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -734,6 +734,10 @@ void twitter_get_timeline(struct im_connection *ic, gint64 next_cursor) } if (td->flags & TWITTER_DOING_TIMELINE) { + /* This shouldn't normally happen at all but I'm currently hunting a bug + where it does. Instead of having users suffer under it, have a work- + around with a warning. */ + td->flags |= TWITTER_DOING_TIMELINE_SLOW; return; } -- cgit v1.2.3 From 6a451817589df092ef5121bbe2c7156d2d01f669 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 19 Oct 2011 23:28:29 -0400 Subject: Clearer error msg when trying to add an existing OSCAR contact. Bug #828. --- protocols/oscar/oscar.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'protocols') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 0d23b7e8..27e8f210 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -2101,6 +2101,10 @@ static int gaim_ssi_parseack( aim_session_t *sess, aim_frame_t *fr, ... ) aim_ssi_auth_request( sess, fr->conn, list, "" ); aim_ssi_addbuddies( sess, fr->conn, OSCAR_GROUP, &list, 1, 1 ); } + else if( st == 0x0A ) + { + imcb_error( sess->aux_data, "Buddy %s is already in your list", list ); + } else { imcb_error( sess->aux_data, "Error while adding buddy: 0x%04x", st ); -- cgit v1.2.3 From de26f3ccb7148d83c7bb8a6d5b84bccc95d765fa Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 30 Oct 2011 12:33:49 +0100 Subject: Killed careless use of strcpy(). Luckily these are only a risk on public servers. --- protocols/jabber/s5bytestream.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'protocols') diff --git a/protocols/jabber/s5bytestream.c b/protocols/jabber/s5bytestream.c index 3304d99e..f4618cef 100644 --- a/protocols/jabber/s5bytestream.c +++ b/protocols/jabber/s5bytestream.c @@ -876,7 +876,8 @@ jabber_streamhost_t *jabber_si_parse_proxy( struct im_connection *ic, char *prox jabber_streamhost_t *sh; if( ( ( host = strchr( proxy, ',' ) ) == 0 ) || - ( ( port = strchr( host+1, ',' ) ) == 0 ) ) { + ( ( port = strchr( host+1, ',' ) ) == 0 ) ) + { imcb_log( ic, "Error parsing proxy setting: \"%s\" (ignored)", proxy ); return NULL; } @@ -888,7 +889,7 @@ jabber_streamhost_t *jabber_si_parse_proxy( struct im_connection *ic, char *prox sh = g_new0( jabber_streamhost_t, 1 ); sh->jid = g_strdup( jid ); sh->host = g_strdup( host ); - strcpy( sh->port, port ); + g_snprintf( sh->port, sizeof( sh->port ), "%s", port ); return sh; } @@ -914,7 +915,7 @@ void jabber_si_set_proxies( struct bs_transfer *bt ) sh = g_new0( jabber_streamhost_t, 1 ); sh->jid = g_strdup( tf->ini_jid ); sh->host = g_strdup( host ); - strcpy( sh->port, port ); + g_snprintf( sh->port, sizeof( sh->port ), "%s", port ); bt->streamhosts = g_slist_append( bt->streamhosts, sh ); bt->tf->watch_in = b_input_add( tf->fd, B_EV_IO_READ, jabber_bs_send_handshake, bt ); -- cgit v1.2.3 From ff1616b7f25775ead76768c2b78c2ca01aac830f Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 9 Nov 2011 08:07:22 +0800 Subject: Fixed bug in msn_soap_debug_print() failing to print HTTP headers of SOAP queries. No, this doesn't fix #850, I just found this bug while trying to get debugging info for that. --- protocols/msn/soap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'protocols') diff --git a/protocols/msn/soap.c b/protocols/msn/soap.c index dac46a75..cbc384be 100644 --- a/protocols/msn/soap.c +++ b/protocols/msn/soap.c @@ -215,7 +215,7 @@ static void msn_soap_debug_print( const char *headers, const char *payload ) return; if( ( s = strstr( headers, "\r\n\r\n" ) ) ) - st = write( 1, s, s - headers + 4 ); + st = write( 1, headers, s - headers + 4 ); else st = write( 1, headers, strlen( headers ) ); -- cgit v1.2.3 From dac74bdcfcc358cd59a318e34a54a3b17ebf3459 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 10 Nov 2011 11:38:40 +0800 Subject: Workaround/Fix for MSN login troubles, many thanks to necropresto. Bug #850. --- protocols/msn/soap.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'protocols') diff --git a/protocols/msn/soap.h b/protocols/msn/soap.h index a767e00d..69f76739 100644 --- a/protocols/msn/soap.h +++ b/protocols/msn/soap.h @@ -115,7 +115,7 @@ int msn_soapq_flush( struct im_connection *ic, gboolean resend ); "http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue" \ "" \ "" \ - "contacts.msn.com" \ + "local-bay.contacts.msn.com" \ "" \ "" \ "" \ @@ -198,7 +198,7 @@ int msn_soap_oim_send_queue( struct im_connection *ic, GSList **msgq ); "" \ "" -#define SOAP_MEMLIST_URL "http://contacts.msn.com/abservice/SharingService.asmx" +#define SOAP_MEMLIST_URL "http://local-bay.contacts.msn.com/abservice/SharingService.asmx" #define SOAP_MEMLIST_ACTION "http://www.msn.com/webservices/AddressBook/FindMembership" #define SOAP_MEMLIST_PAYLOAD \ @@ -233,7 +233,7 @@ int msn_soap_memlist_request( struct im_connection *ic ); int msn_soap_memlist_edit( struct im_connection *ic, const char *handle, gboolean add, int list ); -#define SOAP_ADDRESSBOOK_URL "http://contacts.msn.com/abservice/abservice.asmx" +#define SOAP_ADDRESSBOOK_URL "http://local-bay.contacts.msn.com/abservice/abservice.asmx" #define SOAP_ADDRESSBOOK_ACTION "http://www.msn.com/webservices/AddressBook/ABFindAll" #define SOAP_ADDRESSBOOK_PAYLOAD \ -- cgit v1.2.3 From dff732d93799db858a5728abbf31d2e6274b8425 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 12 Nov 2011 23:49:52 +0800 Subject: Undoing old workaround for MSN troubles and added more proper fix. The http_client module needs some refactoring though. Will do that later.. This should hopefully fix bug #850. --- protocols/msn/soap.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'protocols') diff --git a/protocols/msn/soap.h b/protocols/msn/soap.h index 69f76739..a767e00d 100644 --- a/protocols/msn/soap.h +++ b/protocols/msn/soap.h @@ -115,7 +115,7 @@ int msn_soapq_flush( struct im_connection *ic, gboolean resend ); "http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue" \ "" \ "" \ - "local-bay.contacts.msn.com" \ + "contacts.msn.com" \ "" \ "" \ "" \ @@ -198,7 +198,7 @@ int msn_soap_oim_send_queue( struct im_connection *ic, GSList **msgq ); "" \ "" -#define SOAP_MEMLIST_URL "http://local-bay.contacts.msn.com/abservice/SharingService.asmx" +#define SOAP_MEMLIST_URL "http://contacts.msn.com/abservice/SharingService.asmx" #define SOAP_MEMLIST_ACTION "http://www.msn.com/webservices/AddressBook/FindMembership" #define SOAP_MEMLIST_PAYLOAD \ @@ -233,7 +233,7 @@ int msn_soap_memlist_request( struct im_connection *ic ); int msn_soap_memlist_edit( struct im_connection *ic, const char *handle, gboolean add, int list ); -#define SOAP_ADDRESSBOOK_URL "http://local-bay.contacts.msn.com/abservice/abservice.asmx" +#define SOAP_ADDRESSBOOK_URL "http://contacts.msn.com/abservice/abservice.asmx" #define SOAP_ADDRESSBOOK_ACTION "http://www.msn.com/webservices/AddressBook/ABFindAll" #define SOAP_ADDRESSBOOK_PAYLOAD \ -- cgit v1.2.3 From d45b1813d7a7411585038a79d9636193aabe2d51 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 23 Nov 2011 17:27:59 +0100 Subject: Add missing 'skype/skyped.conf.dist' --- protocols/skype/skyped.conf.dist | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 protocols/skype/skyped.conf.dist (limited to 'protocols') diff --git a/protocols/skype/skyped.conf.dist b/protocols/skype/skyped.conf.dist new file mode 100644 index 00000000..21e07796 --- /dev/null +++ b/protocols/skype/skyped.conf.dist @@ -0,0 +1,10 @@ +[skyped] +# change to your skype username +username = john +# use `echo -n foo|sha1sum` to generate this hash for your password +password = 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33 + +# you have to change the following paths to your home directory: +cert = /home/YOUR_USER/.skyped/skyped.cert.pem +key = /home/YOUR_USER/.skyped/skyped.key.pem +port = 2727 -- cgit v1.2.3 From 90fc864b79ba673623ce96e3e89866e48bc32d7f Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 24 Nov 2011 08:18:04 +0000 Subject: Hopefully this fixed #838. Patch from Artem Savkov, thanks! The problem was HTTP failures caused by (most likely) DNS resolution problems. Yes, ignoring return values is still bad, kids! --- protocols/twitter/twitter.h | 1 - protocols/twitter/twitter_lib.c | 35 ++++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'protocols') diff --git a/protocols/twitter/twitter.h b/protocols/twitter/twitter.h index 47dbeb29..14e43824 100644 --- a/protocols/twitter/twitter.h +++ b/protocols/twitter/twitter.h @@ -38,7 +38,6 @@ typedef enum TWITTER_DOING_TIMELINE = 0x10000, TWITTER_GOT_TIMELINE = 0x20000, TWITTER_GOT_MENTIONS = 0x40000, - TWITTER_DOING_TIMELINE_SLOW = 0x80000, } twitter_flags_t; struct twitter_log_data; diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index 00e3a2ee..d52c29ff 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -726,18 +726,7 @@ void twitter_get_timeline(struct im_connection *ic, gint64 next_cursor) struct twitter_data *td = ic->proto_data; gboolean include_mentions = set_getbool(&ic->acc->set, "fetch_mentions"); - if ((td->flags & 0xf0000) == (TWITTER_DOING_TIMELINE | TWITTER_DOING_TIMELINE_SLOW)) { - imcb_log(ic, "Connection seems to have stalled again.\n" - "This is a known bug, if you see this happen a lot " - "please generate some traffic dumps."); - td->flags &= ~0xf0000; - } - if (td->flags & TWITTER_DOING_TIMELINE) { - /* This shouldn't normally happen at all but I'm currently hunting a bug - where it does. Instead of having users suffer under it, have a work- - around with a warning. */ - td->flags |= TWITTER_DOING_TIMELINE_SLOW; return; } @@ -827,8 +816,14 @@ void twitter_get_home_timeline(struct im_connection *ic, gint64 next_cursor) args[5] = g_strdup_printf("%llu", (long long unsigned int) td->timeline_id); } - twitter_http(ic, TWITTER_HOME_TIMELINE_URL, twitter_http_get_home_timeline, ic, 0, args, - td->timeline_id ? 6 : 4); + if (twitter_http(ic, TWITTER_HOME_TIMELINE_URL, twitter_http_get_home_timeline, ic, 0, args, + td->timeline_id ? 6 : 4) == NULL) { + if (++td->http_fails >= 5) + imcb_error(ic, "Could not retrieve %s: %s", + TWITTER_HOME_TIMELINE_URL, "connection failed"); + td->flags |= TWITTER_GOT_TIMELINE; + twitter_flush_timeline(ic); + } g_free(args[1]); if (td->timeline_id) { @@ -856,8 +851,14 @@ void twitter_get_mentions(struct im_connection *ic, gint64 next_cursor) args[5] = g_strdup_printf("%llu", (long long unsigned int) td->timeline_id); } - twitter_http(ic, TWITTER_MENTIONS_URL, twitter_http_get_mentions, ic, 0, args, - td->timeline_id ? 6 : 4); + if (twitter_http(ic, TWITTER_MENTIONS_URL, twitter_http_get_mentions, ic, 0, args, + td->timeline_id ? 6 : 4) == NULL) { + if (++td->http_fails >= 5) + imcb_error(ic, "Could not retrieve %s: %s", + TWITTER_MENTIONS_URL, "connection failed"); + td->flags |= TWITTER_GOT_MENTIONS; + twitter_flush_timeline(ic); + } g_free(args[1]); if (td->timeline_id) { @@ -945,8 +946,8 @@ static void twitter_http_get_mentions(struct http_request *req) } else { // It didn't go well, output the error and return. if (++td->http_fails >= 5) - imcb_error(ic, "Could not retrieve " TWITTER_MENTIONS_URL ": %s", - twitter_parse_error(req)); + imcb_error(ic, "Could not retrieve %s: %s", + TWITTER_MENTIONS_URL, twitter_parse_error(req)); goto end; } -- cgit v1.2.3 From 3bd2f17754009d84df1aeb60cfa1d3510182e87c Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 25 Nov 2011 12:16:05 +0000 Subject: msn_soap_debug_print may get called with NULL pointers. Pay attention. --- protocols/msn/soap.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'protocols') diff --git a/protocols/msn/soap.c b/protocols/msn/soap.c index cbc384be..467429fb 100644 --- a/protocols/msn/soap.c +++ b/protocols/msn/soap.c @@ -214,12 +214,16 @@ static void msn_soap_debug_print( const char *headers, const char *payload ) if( !getenv( "BITLBEE_DEBUG" ) ) return; - if( ( s = strstr( headers, "\r\n\r\n" ) ) ) - st = write( 1, headers, s - headers + 4 ); - else - st = write( 1, headers, strlen( headers ) ); + if( headers ) + { + if( ( s = strstr( headers, "\r\n\r\n" ) ) ) + st = write( 1, headers, s - headers + 4 ); + else + st = write( 1, headers, strlen( headers ) ); + } #ifdef DEBUG + if( payload ) { struct xt_node *xt = xt_from_string( payload ); if( xt ) -- cgit v1.2.3 From c77406ae3fd357c3d2eabd36ec524e049e265857 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 26 Nov 2011 18:41:24 +0000 Subject: MSN: No clue if the OUT command can specify other reasons, but if so, show it to the user. --- protocols/msn/ns.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'protocols') diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index 604e2f4e..e144a8d2 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -479,7 +479,8 @@ static int msn_ns_command( struct msn_handler_data *handler, char **cmd, int num } else { - imcb_error( ic, "Session terminated by remote server (reason unknown)" ); + imcb_error( ic, "Session terminated by remote server (%s)", + cmd[1] ? cmd[1] : "reason unknown)" ); } imc_logout( ic, allow_reconnect ); -- cgit v1.2.3 From bd3166176fdb7ed96211eb539316f47843e0faa7 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 2 Dec 2011 10:32:54 +0000 Subject: Somewhat improve debug logging of HTTP/SOAP stuff. --- protocols/msn/soap.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'protocols') diff --git a/protocols/msn/soap.c b/protocols/msn/soap.c index 467429fb..ea9a0699 100644 --- a/protocols/msn/soap.c +++ b/protocols/msn/soap.c @@ -222,7 +222,6 @@ static void msn_soap_debug_print( const char *headers, const char *payload ) st = write( 1, headers, strlen( headers ) ); } -#ifdef DEBUG if( payload ) { struct xt_node *xt = xt_from_string( payload ); @@ -230,7 +229,6 @@ static void msn_soap_debug_print( const char *headers, const char *payload ) xt_print( xt ); xt_free_node( xt ); } -#endif } int msn_soapq_flush( struct im_connection *ic, gboolean resend ) -- cgit v1.2.3 From ca974d7f6171a70c5484420bd6c59919383105a6 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 4 Dec 2011 19:14:29 +0000 Subject: Debug output tweaks: Try to send everything to stderr, and add ifdef to enable printing of all SSL traffic. --- protocols/msn/soap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'protocols') diff --git a/protocols/msn/soap.c b/protocols/msn/soap.c index ea9a0699..ccfc1a67 100644 --- a/protocols/msn/soap.c +++ b/protocols/msn/soap.c @@ -217,9 +217,9 @@ static void msn_soap_debug_print( const char *headers, const char *payload ) if( headers ) { if( ( s = strstr( headers, "\r\n\r\n" ) ) ) - st = write( 1, headers, s - headers + 4 ); + st = write( 2, headers, s - headers + 4 ); else - st = write( 1, headers, strlen( headers ) ); + st = write( 2, headers, strlen( headers ) ); } if( payload ) @@ -662,7 +662,7 @@ static xt_status msn_soap_memlist_member( struct xt_node *node, gpointer data ) bd->flags |= MSN_BUDDY_PL; if( getenv( "BITLBEE_DEBUG" ) ) - printf( "%p %s %d\n", bu, handle, bd->flags ); + fprintf( stderr, "%p %s %d\n", bu, handle, bd->flags ); return XT_HANDLED; } @@ -809,7 +809,7 @@ static xt_status msn_soap_addressbook_group( struct xt_node *node, gpointer data } if( getenv( "BITLBEE_DEBUG" ) ) - printf( "%s %s\n", id, name ); + fprintf( stderr, "%s %s\n", id, name ); return XT_HANDLED; } @@ -870,7 +870,7 @@ static xt_status msn_soap_addressbook_contact( struct xt_node *node, gpointer da imcb_add_buddy( ic, handle, group->name ); if( getenv( "BITLBEE_DEBUG" ) ) - printf( "%s %s %s %s\n", id, type, handle, display_name ); + fprintf( stderr, "%s %s %s %s\n", id, type, handle, display_name ); return XT_HANDLED; } -- cgit v1.2.3 From 5dc7f907bf24e52f83b9d2e7613cf4e1f7aebcdf Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 6 Dec 2011 01:53:16 +0100 Subject: msn: unused-but-set-variables --- protocols/msn/sb.c | 6 ------ protocols/msn/soap.c | 5 ++--- 2 files changed, 2 insertions(+), 9 deletions(-) (limited to 'protocols') diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c index 37ac2889..69114469 100644 --- a/protocols/msn/sb.c +++ b/protocols/msn/sb.c @@ -307,7 +307,6 @@ gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond ) { struct msn_switchboard *sb = data; struct im_connection *ic; - struct msn_data *md; char buf[1024]; /* Are we still alive? */ @@ -315,7 +314,6 @@ gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond ) return FALSE; ic = sb->ic; - md = ic->proto_data; if( source != sb->fd ) { @@ -674,16 +672,12 @@ static int msn_sb_message( struct msn_handler_data *handler, char *msg, int msgl struct msn_switchboard *sb = handler->data; struct im_connection *ic = sb->ic; char *body; - int blen = 0; if( !num_parts ) return( 1 ); if( ( body = strstr( msg, "\r\n\r\n" ) ) ) - { body += 4; - blen = msglen - ( body - msg ); - } if( strcmp( cmd[0], "MSG" ) == 0 ) { diff --git a/protocols/msn/soap.c b/protocols/msn/soap.c index ccfc1a67..7d9f3791 100644 --- a/protocols/msn/soap.c +++ b/protocols/msn/soap.c @@ -209,7 +209,6 @@ static char *msn_soap_abservice_build( const char *body_fmt, const char *scenari static void msn_soap_debug_print( const char *headers, const char *payload ) { char *s; - int st; if( !getenv( "BITLBEE_DEBUG" ) ) return; @@ -217,9 +216,9 @@ static void msn_soap_debug_print( const char *headers, const char *payload ) if( headers ) { if( ( s = strstr( headers, "\r\n\r\n" ) ) ) - st = write( 2, headers, s - headers + 4 ); + write( 2, headers, s - headers + 4 ); else - st = write( 2, headers, strlen( headers ) ); + write( 2, headers, strlen( headers ) ); } if( payload ) -- cgit v1.2.3 From d18db32f4777d0be6ccb6f46067c0532c07909d5 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 6 Dec 2011 01:53:26 +0100 Subject: oscar: unused-but-set-variables --- protocols/oscar/chat.c | 3 +- protocols/oscar/chatnav.c | 15 ++------ protocols/oscar/icq.c | 7 ++-- protocols/oscar/im.c | 7 ++-- protocols/oscar/misc.c | 3 +- protocols/oscar/oscar.c | 97 +++++++++++++++++++---------------------------- protocols/oscar/rxqueue.c | 4 +- protocols/oscar/service.c | 10 ++--- 8 files changed, 56 insertions(+), 90 deletions(-) (limited to 'protocols') diff --git a/protocols/oscar/chat.c b/protocols/oscar/chat.c index fbf45693..a5db8fba 100644 --- a/protocols/oscar/chat.c +++ b/protocols/oscar/chat.c @@ -383,7 +383,6 @@ static int infoupdate(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a guint8 detaillevel = 0; char *roomname = NULL; struct aim_chat_roominfo roominfo; - guint16 tlvcount = 0; aim_tlvlist_t *tlvlist; char *roomdesc = NULL; guint16 flags = 0; @@ -400,7 +399,7 @@ static int infoupdate(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a return 1; } - tlvcount = aimbs_get16(bs); + aimbs_get16(bs); /* tlv count */ /* * Everything else are TLVs. diff --git a/protocols/oscar/chatnav.c b/protocols/oscar/chatnav.c index 7cfc52af..e2de2ff3 100644 --- a/protocols/oscar/chatnav.c +++ b/protocols/oscar/chatnav.c @@ -138,12 +138,8 @@ static int parseinfo_perms(aim_session_t *sess, aim_module_t *mod, aim_frame_t * /* * Type 0x0002: Unknown */ - if (aim_gettlv(innerlist, 0x0002, 1)) { - guint16 classperms; - - classperms = aim_gettlv16(innerlist, 0x0002, 1); - - } + if (aim_gettlv(innerlist, 0x0002, 1)) + ; /* * Type 0x00c9: Flags @@ -203,11 +199,8 @@ static int parseinfo_perms(aim_session_t *sess, aim_module_t *mod, aim_frame_t * * 2 Exchange creation allowed * */ - if (aim_gettlv(innerlist, 0x00d5, 1)) { - guint8 createperms; - - createperms = aim_gettlv8(innerlist, 0x00d5, 1); - } + if (aim_gettlv(innerlist, 0x00d5, 1)) + ; /* * Type 0x00d6: Character Set (First Time) diff --git a/protocols/oscar/icq.c b/protocols/oscar/icq.c index f7c02e04..c2f8dda6 100644 --- a/protocols/oscar/icq.c +++ b/protocols/oscar/icq.c @@ -234,8 +234,7 @@ static int icqresponse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_tlvlist_t *tl; aim_tlv_t *datatlv; aim_bstream_t qbs; - guint32 ouruin; - guint16 cmdlen, cmd, reqid; + guint16 cmd, reqid; if (!(tl = aim_readtlvchain(bs)) || !(datatlv = aim_gettlv(tl, 0x0001, 1))) { aim_freetlvchain(&tl); @@ -245,8 +244,8 @@ static int icqresponse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_bstream_init(&qbs, datatlv->value, datatlv->length); - cmdlen = aimbs_getle16(&qbs); - ouruin = aimbs_getle32(&qbs); + aimbs_getle16(&qbs); /* cmdlen */ + aimbs_getle32(&qbs); /* ouruin */ cmd = aimbs_getle16(&qbs); reqid = aimbs_getle16(&qbs); diff --git a/protocols/oscar/im.c b/protocols/oscar/im.c index 4169ea4d..231dd959 100644 --- a/protocols/oscar/im.c +++ b/protocols/oscar/im.c @@ -918,7 +918,6 @@ static int outgoingim(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a { int i, ret = 0; aim_rxcallback_t userfunc; - guint8 cookie[8]; guint16 channel; aim_tlvlist_t *tlvlist; char *sn; @@ -930,7 +929,7 @@ static int outgoingim(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a /* ICBM Cookie. */ for (i = 0; i < 8; i++) - cookie[i] = aimbs_get8(bs); + aimbs_get8(bs); /* Channel ID */ channel = aimbs_get16(bs); @@ -1413,7 +1412,7 @@ static void incomingim_ch2_icqserverrelay_free(aim_session_t *sess, struct aim_i static void incomingim_ch2_icqserverrelay(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args, aim_bstream_t *servdata) { guint16 hdrlen, msglen, dc; - guint8 msgtype, msgflags; + guint8 msgtype; guint8 *plugin; int i = 0, tmp = 0; struct im_connection *ic = sess->aux_data; @@ -1441,7 +1440,7 @@ static void incomingim_ch2_icqserverrelay(aim_session_t *sess, aim_module_t *mod if (!tmp) { /* message follows */ msgtype = aimbs_getle8(servdata); - msgflags = aimbs_getle8(servdata); + aimbs_getle8(servdata); /* msgflags */ aim_bstream_advance(servdata, 0x04); /* status code and priority code */ diff --git a/protocols/oscar/misc.c b/protocols/oscar/misc.c index e5c5c26f..58fb6c31 100644 --- a/protocols/oscar/misc.c +++ b/protocols/oscar/misc.c @@ -309,7 +309,6 @@ int aim_setdirectoryinfo(aim_session_t *sess, aim_conn_t *conn, const char *firs int aim_setuserinterests(aim_session_t *sess, aim_conn_t *conn, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, guint16 privacy) { aim_frame_t *fr; - aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; /* ?? privacy ?? */ @@ -329,7 +328,7 @@ int aim_setuserinterests(aim_session_t *sess, aim_conn_t *conn, const char *inte if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl)))) return -ENOMEM; - snacid = aim_cachesnac(sess, 0x0002, 0x000f, 0x0000, NULL, 0); + aim_cachesnac(sess, 0x0002, 0x000f, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0002, 0x000f, 0x0000, 0); aim_writetlvchain(&fr->data, &tl); diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 27e8f210..41a194ab 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -1071,12 +1071,12 @@ static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ static void gaim_icq_authgrant(void *data_) { struct icq_auth *data = data_; - char *uin, message; + char *uin; struct oscar_data *od = (struct oscar_data *)data->ic->proto_data; uin = g_strdup_printf("%u", data->uin); - message = 0; aim_ssi_auth_reply(od->sess, od->conn, uin, 1, ""); + // char *message = 0; // aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message); imcb_ask_add(data->ic, uin, NULL); @@ -1218,11 +1218,11 @@ static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) { static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; - guint16 chan, nummissed, reason; + guint16 nummissed, reason; aim_userinfo_t *userinfo; va_start(ap, fr); - chan = (guint16)va_arg(ap, unsigned int); + va_arg(ap, unsigned int); /* chan */ userinfo = va_arg(ap, aim_userinfo_t *); nummissed = (guint16)va_arg(ap, unsigned int); reason = (guint16)va_arg(ap, unsigned int); @@ -1334,13 +1334,12 @@ static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { } static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { - char *msg; guint16 id; va_list ap; va_start(ap, fr); id = (guint16)va_arg(ap, unsigned int); - msg = va_arg(ap, char *); + va_arg(ap, char *); /* msg */ va_end(ap); if (id < 4) @@ -1360,13 +1359,9 @@ static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { switch(type) { case 0x0002: { - guint8 maxrooms; - struct aim_chat_exchangeinfo *exchanges; - int exchangecount; // i; - - maxrooms = (guint8)va_arg(ap, unsigned int); - exchangecount = va_arg(ap, int); - exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); + va_arg(ap, unsigned int); /* maxrooms */ + va_arg(ap, int); /* exchangecount */ + va_arg(ap, struct aim_chat_exchangeinfo *); /* exchanges */ va_end(ap); while (odata->create_rooms) { @@ -1379,21 +1374,19 @@ static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { } break; case 0x0008: { - char *fqcn, *name, *ck; - guint16 instance, flags, maxmsglen, maxoccupancy, unknown, exchange; - guint8 createperms; - guint32 createtime; + char *ck; + guint16 instance, exchange; - fqcn = va_arg(ap, char *); + va_arg(ap, char *); /* fqcn */ instance = (guint16)va_arg(ap, unsigned int); exchange = (guint16)va_arg(ap, unsigned int); - flags = (guint16)va_arg(ap, unsigned int); - createtime = va_arg(ap, guint32); - maxmsglen = (guint16)va_arg(ap, unsigned int); - maxoccupancy = (guint16)va_arg(ap, unsigned int); - createperms = (guint8)va_arg(ap, int); - unknown = (guint16)va_arg(ap, unsigned int); - name = va_arg(ap, char *); + va_arg(ap, unsigned int); /* flags */ + va_arg(ap, guint32); /* createtime */ + va_arg(ap, unsigned int); /* maxmsglen */ + va_arg(ap, unsigned int); /* maxoccupancy */ + va_arg(ap, int); /* createperms */ + va_arg(ap, unsigned int); /* unknown */ + va_arg(ap, char *); /* name */ ck = va_arg(ap, char *); va_end(ap); @@ -1455,27 +1448,21 @@ static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) { static int gaim_chat_info_update(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; - aim_userinfo_t *userinfo; - struct aim_chat_roominfo *roominfo; - char *roomname; - int usercount; - char *roomdesc; - guint16 unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; - guint32 creationtime; + guint16 maxmsglen, maxvisiblemsglen; struct im_connection *ic = sess->aux_data; struct chat_connection *ccon = find_oscar_chat_by_conn(ic, fr->conn); va_start(ap, fr); - roominfo = va_arg(ap, struct aim_chat_roominfo *); - roomname = va_arg(ap, char *); - usercount= va_arg(ap, int); - userinfo = va_arg(ap, aim_userinfo_t *); - roomdesc = va_arg(ap, char *); - unknown_c9 = (guint16)va_arg(ap, int); - creationtime = (guint32)va_arg(ap, unsigned long); + va_arg(ap, struct aim_chat_roominfo *); /* roominfo */ + va_arg(ap, char *); /* roomname */ + va_arg(ap, int); /* usercount */ + va_arg(ap, aim_userinfo_t *); /* userinfo */ + va_arg(ap, char *); /* roomdesc */ + va_arg(ap, int); /* unknown_c9 */ + va_arg(ap, unsigned long); /* creationtime */ maxmsglen = (guint16)va_arg(ap, int); - unknown_d2 = (guint16)va_arg(ap, int); - unknown_d5 = (guint16)va_arg(ap, int); + va_arg(ap, int); /* unknown_d2 */ + va_arg(ap, int); /* unknown_d5 */ maxvisiblemsglen = (guint16)va_arg(ap, int); va_end(ap); @@ -1516,19 +1503,19 @@ static int gaim_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...) { }; #endif va_list ap; - guint16 code, rateclass; - guint32 windowsize, clear, alert, limit, disconnect, currentavg, maxavg; + guint16 code; + guint32 windowsize, clear, currentavg; va_start(ap, fr); code = (guint16)va_arg(ap, unsigned int); - rateclass= (guint16)va_arg(ap, unsigned int); + va_arg(ap, unsigned int); /* rateclass */ windowsize = (guint32)va_arg(ap, unsigned long); clear = (guint32)va_arg(ap, unsigned long); - alert = (guint32)va_arg(ap, unsigned long); - limit = (guint32)va_arg(ap, unsigned long); - disconnect = (guint32)va_arg(ap, unsigned long); + va_arg(ap, unsigned long); /* alert */ + va_arg(ap, unsigned long); /* limit */ + va_arg(ap, unsigned long); /* disconnect */ currentavg = (guint32)va_arg(ap, unsigned long); - maxavg = (guint32)va_arg(ap, unsigned long); + va_arg(ap, unsigned long); /* maxavg */ va_end(ap); /* XXX fix these values */ @@ -2416,11 +2403,11 @@ int gaim_parsemtn(aim_session_t *sess, aim_frame_t *fr, ...) { struct im_connection * ic = sess->aux_data; va_list ap; - guint16 type1, type2; + guint16 type2; char * sn; va_start(ap, fr); - type1 = va_arg(ap, int); + va_arg(ap, int); /* type1 */ sn = va_arg(ap, char*); type2 = va_arg(ap, int); va_end(ap); @@ -2540,9 +2527,7 @@ struct groupchat *oscar_chat_join_internal(struct im_connection *ic, const char aim_conn_t * cur; if((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) { - int st; - - st = aim_chatnav_createroom(od->sess, cur, room, exchange_number); + aim_chatnav_createroom(od->sess, cur, room, exchange_number); return ret; } else { @@ -2566,10 +2551,8 @@ struct groupchat *oscar_chat_join(struct im_connection *ic, const char *room, struct groupchat *oscar_chat_with(struct im_connection * ic, char *who) { struct oscar_data * od = (struct oscar_data *)ic->proto_data; - struct groupchat *ret; static int chat_id = 0; char * chatname, *s; - struct groupchat *c; chatname = g_strdup_printf("%s%s%d", isdigit(*ic->acc->user) ? "icq" : "", ic->acc->user, chat_id++); @@ -2578,8 +2561,8 @@ struct groupchat *oscar_chat_with(struct im_connection * ic, char *who) if (!isalnum(*s)) *s = '0'; - c = imcb_chat_new(ic, chatname); - ret = oscar_chat_join_internal(ic, chatname, NULL, NULL, 4); + imcb_chat_new(ic, chatname); + oscar_chat_join_internal(ic, chatname, NULL, NULL, 4); aim_chat_invite(od->sess, od->conn, who, "", 4, chatname, 0x0); g_free(chatname); diff --git a/protocols/oscar/rxqueue.c b/protocols/oscar/rxqueue.c index 34f389af..081e967c 100644 --- a/protocols/oscar/rxqueue.c +++ b/protocols/oscar/rxqueue.c @@ -387,10 +387,8 @@ int aim_get_command(aim_session_t *sess, aim_conn_t *conn) * or we break. We must handle it just in case. */ if (aimbs_get8(&flaphdr) != 0x2a) { - guint8 start; - aim_bstream_rewind(&flaphdr); - start = aimbs_get8(&flaphdr); + aimbs_get8(&flaphdr); imcb_error(sess->aux_data, "FLAP framing disrupted"); aim_conn_close(conn); return -1; diff --git a/protocols/oscar/service.c b/protocols/oscar/service.c index acd09150..d4f516c0 100644 --- a/protocols/oscar/service.c +++ b/protocols/oscar/service.c @@ -562,9 +562,7 @@ static int migrate(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_ */ groupcount = aimbs_get16(bs); for (i = 0; i < groupcount; i++) { - guint16 group; - - group = aimbs_get16(bs); + aimbs_get16(bs); imcb_error(sess->aux_data, "bifurcated migration unsupported"); } @@ -700,11 +698,10 @@ int aim_setversions(aim_session_t *sess, aim_conn_t *conn) /* Host versions (group 1, subtype 0x18) */ static int hostversions(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { - int vercount; guint8 *versions; /* This is frivolous. (Thank you SmarterChild.) */ - vercount = aim_bstream_empty(bs)/4; + aim_bstream_empty(bs); versions = aimbs_getraw(bs, aim_bstream_empty(bs)); g_free(versions); @@ -730,7 +727,6 @@ int aim_setextstatus(aim_session_t *sess, aim_conn_t *conn, guint32 status) aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; guint32 data; - int tlvlen; struct im_connection *ic = sess ? sess->aux_data : NULL; data = AIM_ICQ_STATE_HIDEIP | status; /* yay for error checking ;^) */ @@ -738,7 +734,7 @@ int aim_setextstatus(aim_session_t *sess, aim_conn_t *conn, guint32 status) if (ic && set_getbool(&ic->acc->set, "web_aware")) data |= AIM_ICQ_STATE_WEBAWARE; - tlvlen = aim_addtlvtochain32(&tl, 0x0006, data); + aim_addtlvtochain32(&tl, 0x0006, data); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 8))) return -ENOMEM; -- cgit v1.2.3 From d7edadf94be620d226b569f5e14f45de7f08c03a Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 6 Dec 2011 01:53:34 +0100 Subject: yahoo: unused-but-set-variables --- protocols/yahoo/libyahoo2.c | 61 ++++++++++++++------------------------------- 1 file changed, 19 insertions(+), 42 deletions(-) (limited to 'protocols') diff --git a/protocols/yahoo/libyahoo2.c b/protocols/yahoo/libyahoo2.c index 07689809..ca2a161e 100644 --- a/protocols/yahoo/libyahoo2.c +++ b/protocols/yahoo/libyahoo2.c @@ -1808,7 +1808,6 @@ static void yahoo_https_auth_token_init(struct yahoo_https_auth_data *had) { struct yahoo_input_data *yid = had->yid; struct yahoo_data *yd = yid->yd; - struct http_request *req; char *login, *passwd, *chal; char *url; @@ -1822,7 +1821,7 @@ static void yahoo_https_auth_token_init(struct yahoo_https_auth_data *had) url = g_strdup_printf("https://login.yahoo.com/config/pwtoken_get?src=ymsgr&ts=%d&login=%s&passwd=%s&chal=%s", (int) time(NULL), login, passwd, chal); - req = http_dorequest_url(url, yahoo_https_auth_token_finish, had); + http_dorequest_url(url, yahoo_https_auth_token_finish, had); g_free(url); g_free(chal); @@ -1869,13 +1868,12 @@ fail: static void yahoo_https_auth_init(struct yahoo_https_auth_data *had) { - struct http_request *req; char *url; url = g_strdup_printf("https://login.yahoo.com/config/pwtoken_login?src=ymsgr&ts=%d&token=%s", (int) time(NULL), had->token); - req = http_dorequest_url(url, yahoo_https_auth_finish, had); + http_dorequest_url(url, yahoo_https_auth_finish, had); g_free(url); } @@ -1989,8 +1987,6 @@ static void yahoo_process_auth_resp(struct yahoo_input_data *yid, struct yahoo_packet *pkt) { struct yahoo_data *yd = yid->yd; - char *login_id; - char *handle; char *url = NULL; int login_status = -1; @@ -1999,9 +1995,9 @@ static void yahoo_process_auth_resp(struct yahoo_input_data *yid, for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; if (pair->key == 0) - login_id = pair->value; + ; /* login_id */ else if (pair->key == 1) - handle = pair->value; + ; /* handle */ else if (pair->key == 20) url = pair->value; else if (pair->key == 66) @@ -2088,9 +2084,7 @@ static void yahoo_process_contact(struct yahoo_input_data *yid, char *who = NULL; char *msg = NULL; char *name = NULL; - long tm = 0L; int state = YAHOO_STATUS_AVAILABLE; - int online = 0; int away = 0; int idle = 0; int mobile = 0; @@ -2110,9 +2104,9 @@ static void yahoo_process_contact(struct yahoo_input_data *yid, else if (pair->key == 10) state = strtol(pair->value, NULL, 10); else if (pair->key == 15) - tm = strtol(pair->value, NULL, 10); + ; /* tm */ else if (pair->key == 13) - online = strtol(pair->value, NULL, 10); + ; /* online */ else if (pair->key == 47) away = strtol(pair->value, NULL, 10); else if (pair->key == 137) @@ -2139,7 +2133,6 @@ static void yahoo_process_buddyadd(struct yahoo_input_data *yid, char *who = NULL; char *where = NULL; int status = 0; - char *me = NULL; struct yahoo_buddy *bud = NULL; @@ -2147,7 +2140,7 @@ static void yahoo_process_buddyadd(struct yahoo_input_data *yid, for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; if (pair->key == 1) - me = pair->value; + ; /* Me... don't care */ if (pair->key == 7) who = pair->value; if (pair->key == 65) @@ -2203,8 +2196,6 @@ static void yahoo_process_buddydel(struct yahoo_input_data *yid, struct yahoo_data *yd = yid->yd; char *who = NULL; char *where = NULL; - int unk_66 = 0; - char *me = NULL; struct yahoo_buddy *bud; YList *buddy; @@ -2213,13 +2204,13 @@ static void yahoo_process_buddydel(struct yahoo_input_data *yid, for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; if (pair->key == 1) - me = pair->value; + ; /* Me... don't care */ else if (pair->key == 7) who = pair->value; else if (pair->key == 65) where = pair->value; else if (pair->key == 66) - unk_66 = strtol(pair->value, NULL, 10); + ; /* unk_66 */ else DEBUG_MSG(("unknown key: %d = %s", pair->key, pair->value)); @@ -2255,22 +2246,17 @@ static void yahoo_process_buddydel(struct yahoo_input_data *yid, static void yahoo_process_ignore(struct yahoo_input_data *yid, struct yahoo_packet *pkt) { - char *who = NULL; - int status = 0; - char *me = NULL; - int un_ignore = 0; - YList *l; for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; if (pair->key == 0) - who = pair->value; + ; /* who */ if (pair->key == 1) - me = pair->value; + ; /* Me... don't care */ if (pair->key == 13) /* 1 == ignore, 2 == unignore */ - un_ignore = strtol(pair->value, NULL, 10); + ; if (pair->key == 66) - status = strtol(pair->value, NULL, 10); + ; /* status */ } /* @@ -2292,7 +2278,6 @@ static void yahoo_process_voicechat(struct yahoo_input_data *yid, char *who = NULL; char *me = NULL; char *room = NULL; - char *voice_room = NULL; YList *l; for (l = pkt->hash; l; l = l->next) { @@ -2302,7 +2287,7 @@ static void yahoo_process_voicechat(struct yahoo_input_data *yid, if (pair->key == 5) me = pair->value; if (pair->key == 13) - voice_room = pair->value; + ; /* voice room */ if (pair->key == 57) room = pair->value; } @@ -2437,7 +2422,6 @@ static YList *webcam_queue = NULL; static void yahoo_process_webcam_key(struct yahoo_input_data *yid, struct yahoo_packet *pkt) { - char *me = NULL; char *key = NULL; char *who = NULL; @@ -2446,7 +2430,7 @@ static void yahoo_process_webcam_key(struct yahoo_input_data *yid, for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; if (pair->key == 5) - me = pair->value; + ; /* me */ if (pair->key == 61) key = pair->value; } @@ -3368,7 +3352,6 @@ static void yahoo_webcam_connect(struct yahoo_input_data *y) { struct yahoo_webcam *wcm = y->wcm; struct yahoo_input_data *yid; - struct yahoo_server_settings *yss; if (!wcm || !wcm->server || !wcm->key) return; @@ -3381,8 +3364,6 @@ static void yahoo_webcam_connect(struct yahoo_input_data *y) yid->wcm = y->wcm; y->wcm = NULL; - yss = y->yd->server_settings; - yid->wcd = y_new0(struct yahoo_webcam_data, 1); LOG(("Connecting to: %s:%d", wcm->server, wcm->port)); @@ -4974,8 +4955,6 @@ static void yahoo_process_filetransferaccept(struct yahoo_input_data *yid, { YList *l; struct send_file_data *sfd; - char *who = NULL; - char *filename = NULL; char *id = NULL; char *token = NULL; @@ -4983,7 +4962,7 @@ static void yahoo_process_filetransferaccept(struct yahoo_input_data *yid, struct yahoo_pair *pair = l->data; switch (pair->key) { case 4: - who = pair->value; + /* who */ break; case 5: /* Me... don't care */ @@ -4997,7 +4976,7 @@ static void yahoo_process_filetransferaccept(struct yahoo_input_data *yid, token = pair->value; break; case 27: - filename = pair->value; + /* filename */ break; } } @@ -5022,8 +5001,6 @@ static void yahoo_process_filetransferinfo(struct yahoo_input_data *yid, struct yahoo_packet *pkt) { YList *l; - char *who = NULL; - char *filename = NULL; char *id = NULL; char *token = NULL; char *ip_addr = NULL; @@ -5035,7 +5012,7 @@ static void yahoo_process_filetransferinfo(struct yahoo_input_data *yid, switch (pair->key) { case 1: case 4: - who = pair->value; + /* who */ break; case 5: /* Me... don't care */ @@ -5052,7 +5029,7 @@ static void yahoo_process_filetransferinfo(struct yahoo_input_data *yid, token = pair->value; break; case 27: - filename = pair->value; + /* filename */ break; } } -- cgit v1.2.3 From 06b58933ad0f46995c2a676671f92a335dfdfe05 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 7 Dec 2011 21:47:25 +0000 Subject: Merging non-SASL authentication patch from #863. This also implements hidden-default settings, which means a setting is hidden unless it was changed from the default. This seems like appropriate behaviour for something as obscure as this. --- protocols/jabber/io.c | 4 ++-- protocols/jabber/jabber.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'protocols') diff --git a/protocols/jabber/io.c b/protocols/jabber/io.c index ef7d5c13..a28eea90 100644 --- a/protocols/jabber/io.c +++ b/protocols/jabber/io.c @@ -211,7 +211,7 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition /* If there's no version attribute, assume this is an old server that can't do SASL authentication. */ - if( !sasl_supported( ic ) ) + if( !set_getbool( &ic->acc->set, "sasl") || !sasl_supported( ic ) ) { /* If there's no version= tag, we suppose this server does NOT implement: XMPP 1.0, @@ -374,7 +374,7 @@ static xt_status jabber_pkt_features( struct xt_node *node, gpointer data ) support it after all, we should try to do authentication the other way. jabber.com doesn't seem to do SASL while it pretends to be XMPP 1.0 compliant! */ - else if( !( jd->flags & JFLAG_AUTHENTICATED ) && sasl_supported( ic ) ) + else if( !( jd->flags & JFLAG_AUTHENTICATED ) && set_getbool( &ic->acc->set, "sasl") && sasl_supported( ic ) ) { if( !jabber_init_iq_auth( ic ) ) return XT_ABORT; diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 802158c1..7d9547ab 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -81,6 +81,9 @@ static void jabber_init( account_t *acc ) s = set_add( &acc->set, "tls", "try", set_eval_tls, acc ); s->flags |= ACC_SET_OFFLINE_ONLY; + s = set_add( &acc->set, "sasl", "true", set_eval_bool, acc ); + s->flags |= ACC_SET_OFFLINE_ONLY | SET_HIDDEN_DEFAULT; + s = set_add( &acc->set, "user_agent", "BitlBee", NULL, acc ); s = set_add( &acc->set, "xmlconsole", "false", set_eval_bool, acc ); -- cgit v1.2.3 From 57da9609d3b24014813ec39af844c70c466bcd9c Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 10 Dec 2011 22:43:10 +0000 Subject: Skype module packaging. --- protocols/skype/Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'protocols') diff --git a/protocols/skype/Makefile b/protocols/skype/Makefile index bebfe86c..1a07cd80 100644 --- a/protocols/skype/Makefile +++ b/protocols/skype/Makefile @@ -1,6 +1,6 @@ -include ../../Makefile.settings ifdef SRCDIR -SRCDIR := $(SRCDIR)protocls/skype/ +SRCDIR := $(SRCDIR)protocols/skype/ endif VERSION = 0.9.0 @@ -22,9 +22,9 @@ endif all: $(LIBS) $(MANPAGES) -skype.$(SHARED_EXT): skype.c config.mak +skype.$(SHARED_EXT): $(SRCDIR)skype.c config.mak ifeq ($(BITLBEE),yes) - $(CC) $(CFLAGS) $(SHARED_FLAGS) -o skype.$(SHARED_EXT) skype.c $(LDFLAGS) + $(CC) $(CFLAGS) $(SHARED_FLAGS) -o skype.$(SHARED_EXT) $(SRCDIR)skype.c $(LDFLAGS) endif install: all @@ -46,7 +46,7 @@ ifeq ($(SKYPE4PY),yes) $(INSTALL) -m644 skyped.cnf $(DESTDIR)$(sysconfdir) endif -client: client.c +client: $(SRCDIR)client.c autogen: configure.ac cp $(shell ls /usr/share/automake-*/install-sh | tail -n1) ./ @@ -56,7 +56,7 @@ clean: rm -f $(LIBS) $(MANPAGES) distclean: clean - rm -f config.log config.mak config.status + rm -f config.log config.mak config.status skyped.1 autoclean: distclean rm -rf aclocal.m4 autom4te.cache configure install-sh @@ -102,6 +102,6 @@ Changelog: .git/refs/heads/master AUTHORS: .git/refs/heads/master git shortlog -s -n |sed 's/.*\t//'> AUTHORS -%.1: %.txt asciidoc.conf - a2x --asciidoc-opts="-f asciidoc.conf" \ +%.1: $(SRCDIR)%.txt $(SRCDIR)asciidoc.conf + a2x --asciidoc-opts="-f $(SRCDIR)asciidoc.conf" \ -a bs_version=$(VERSION) -a bs_date=$(DATE) -f manpage $< -- cgit v1.2.3 From e46db53456e89bcf9e0baf4c093c4b02e082819a Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 11 Dec 2011 12:12:24 +0000 Subject: Another packaging fix: Don't put skyped manpage in bitlbee-common. --- protocols/skype/Makefile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'protocols') diff --git a/protocols/skype/Makefile b/protocols/skype/Makefile index 1a07cd80..e048e0bc 100644 --- a/protocols/skype/Makefile +++ b/protocols/skype/Makefile @@ -7,6 +7,8 @@ VERSION = 0.9.0 DATE := $(shell date +%Y-%m-%d) # latest stable BITLBEE_VERSION = 3.0.1 +INSTALL = install +ASCIIDOC = yes ifeq ($(ASCIIDOC),yes) MANPAGES = skyped.1 @@ -27,11 +29,7 @@ ifeq ($(BITLBEE),yes) $(CC) $(CFLAGS) $(SHARED_FLAGS) -o skype.$(SHARED_EXT) $(SRCDIR)skype.c $(LDFLAGS) endif -install: all -ifeq ($(ASCIIDOC),yes) - $(INSTALL) -d $(DESTDIR)$(mandir)/man1 - $(INSTALL) -m644 $(MANPAGES) $(DESTDIR)$(mandir)/man1 -endif +install: all install-doc ifeq ($(BITLBEE),yes) $(INSTALL) -d $(DESTDIR)$(plugindir) $(INSTALL) skype.$(SHARED_EXT) $(DESTDIR)$(plugindir) @@ -56,7 +54,7 @@ clean: rm -f $(LIBS) $(MANPAGES) distclean: clean - rm -f config.log config.mak config.status skyped.1 + rm -f config.log config.mak config.status $(MANPAGES) autoclean: distclean rm -rf aclocal.m4 autom4te.cache configure install-sh @@ -82,11 +80,13 @@ release: gpg --comment "See http://vmiklos.hu/gpg/ for info" \ -ba bitlbee-skype-$(VERSION).tar.gz -doc: skyped.1 +doc: $(MANPAGES) -install-doc: - mkdir -p $(DESTDIR)$(MANDIR)/man1/ - install -m 0644 $(SRCDIR)skyped.1 $(DESTDIR)$(MANDIR)/man1/ +install-doc: doc +ifeq ($(ASCIIDOC),yes) + $(INSTALL) -d $(DESTDIR)$(MANDIR)/man1 + $(INSTALL) -m644 $(MANPAGES) $(DESTDIR)$(MANDIR)/man1 +endif uninstall-doc: rm -f $(DESTDIR)$(MANDIR)/man1/skyped.1* @@ -104,4 +104,4 @@ AUTHORS: .git/refs/heads/master %.1: $(SRCDIR)%.txt $(SRCDIR)asciidoc.conf a2x --asciidoc-opts="-f $(SRCDIR)asciidoc.conf" \ - -a bs_version=$(VERSION) -a bs_date=$(DATE) -f manpage $< + -a bs_version=$(VERSION) -a bs_date=$(DATE) -f manpage -D . $< -- cgit v1.2.3 From 877686b6ada5aaea69ac5e629c385ea60a3f1829 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 11 Dec 2011 12:54:40 +0000 Subject: Read both alias and server_alias properties for libpurple contacts. TBH I don't even know what's the difference, but this fixes Facebook nicks when using libpurple. --- protocols/purple/purple.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'protocols') diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c index fe0fc35f..3dedd20c 100644 --- a/protocols/purple/purple.c +++ b/protocols/purple/purple.c @@ -749,6 +749,8 @@ static void prplcb_blist_update( PurpleBuddyList *list, PurpleBlistNode *node ) if( bud->server_alias ) imcb_rename_buddy( ic, bud->name, bud->server_alias ); + else if( bud->alias ) + imcb_rename_buddy( ic, bud->name, bud->alias ); if( group ) imcb_add_buddy( ic, bud->name, purple_group_get_name( group ) ); -- cgit v1.2.3 From 3f808ca58e45f2a305e01471cc514957039a865d Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 11 Dec 2011 16:38:02 +0000 Subject: Support HTTP/1.1 redirect status codes and use HTTPS for OAuth setup. This is required for identi.ca and really should be done for Twitter as well. Twitter OAuth is still broken though, it seems to disagree about signatures. --- protocols/twitter/twitter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'protocols') diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index ac180250..76ccc3eb 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -92,16 +92,16 @@ void twitter_login_finish(struct im_connection *ic) } static const struct oauth_service twitter_oauth = { - "http://api.twitter.com/oauth/request_token", - "http://api.twitter.com/oauth/access_token", + "https://api.twitter.com/oauth/request_token", + "https://api.twitter.com/oauth/access_token", "https://api.twitter.com/oauth/authorize", .consumer_key = "xsDNKJuNZYkZyMcu914uEA", .consumer_secret = "FCxqcr0pXKzsF9ajmP57S3VQ8V6Drk4o2QYtqMcOszo", }; static const struct oauth_service identica_oauth = { - "http://identi.ca/api/oauth/request_token", - "http://identi.ca/api/oauth/access_token", + "https://identi.ca/api/oauth/request_token", + "https://identi.ca/api/oauth/access_token", "https://identi.ca/api/oauth/authorize", .consumer_key = "e147ff789fcbd8a5a07963afbb43f9da", .consumer_secret = "c596267f277457ec0ce1ab7bb788d828", -- cgit v1.2.3 From 6ba00ac2be7f59a730aca244d889cabba8e88bfc Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 12 Dec 2011 00:25:40 +0100 Subject: skyped: give reasonable error message when cert is missing --- protocols/skype/skyped.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'protocols') diff --git a/protocols/skype/skyped.py b/protocols/skype/skyped.py index 615d6835..3b6499c1 100644 --- a/protocols/skype/skyped.py +++ b/protocols/skype/skyped.py @@ -197,11 +197,15 @@ def listener(sock, skype): if not hasgobject: if not(wait_for_lock(options.lock, 3, 10, "listener")): return False rawsock, addr = sock.accept() - options.conn = ssl.wrap_socket(rawsock, - server_side=True, - certfile=options.config.sslcert, - keyfile=options.config.sslkey, - ssl_version=ssl.PROTOCOL_TLSv1) + try: + options.conn = ssl.wrap_socket(rawsock, + server_side=True, + certfile=options.config.sslcert, + keyfile=options.config.sslkey, + ssl_version=ssl.PROTOCOL_TLSv1) + except ssl.SSLError: + dprint("Warning, SSL init failed, did you create your certificate?") + return False if hasattr(options.conn, 'handshake'): try: options.conn.handshake() -- cgit v1.2.3 From 17f057d70b1513710e3d765969205625f0fc7b76 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Tue, 13 Dec 2011 00:34:07 +0000 Subject: As I intended for a while already, use account tags everywhere instead of "protocol(handle)". It's guaranteed to be unique and also shorter. It may suck for people who have multiple accounts and didn't change their tags, but that'll hopefully remind them to change them. --- protocols/nogaim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'protocols') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index a44679ce..a47e0e84 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -215,7 +215,7 @@ static void serv_got_crap( struct im_connection *ic, char *format, ... ) /* If we found one, include the screenname in the message. */ if( a ) /* FIXME(wilmer): ui_log callback or so */ - irc_rootmsg( ic->bee->ui_data, "%s(%s) - %s", ic->acc->prpl->name, ic->acc->user, text ); + irc_rootmsg( ic->bee->ui_data, "%s - %s", ic->acc->tag, text ); else irc_rootmsg( ic->bee->ui_data, "%s - %s", ic->acc->prpl->name, text ); -- cgit v1.2.3