aboutsummaryrefslogtreecommitdiffstats
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/jabber/jabber.c2
-rw-r--r--protocols/msn/gw.c15
-rw-r--r--protocols/msn/ns.c7
-rw-r--r--protocols/oscar/ssi.c2
-rw-r--r--protocols/twitter/twitter.c15
-rw-r--r--protocols/yahoo/yahoo2.h2
6 files changed, 24 insertions, 19 deletions
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c
index 2db026cd..04db365e 100644
--- a/protocols/jabber/jabber.c
+++ b/protocols/jabber/jabber.c
@@ -427,7 +427,7 @@ static void jabber_get_info(struct im_connection *ic, char *who)
bud = bud->next;
}
- jabber_get_vcard(ic, bud ? bud->full_jid : who);
+ jabber_get_vcard(ic, who);
}
static void jabber_set_away(struct im_connection *ic, char *state_txt, char *message)
diff --git a/protocols/msn/gw.c b/protocols/msn/gw.c
index 60514139..5f285f8d 100644
--- a/protocols/msn/gw.c
+++ b/protocols/msn/gw.c
@@ -86,16 +86,16 @@ void msn_gw_callback(struct http_request *req)
gw->waiting = FALSE;
gw->polling = FALSE;
+ if (req->status_code != 200 || !req->reply_body) {
+ gw->callback(gw->md, -1, B_EV_IO_READ);
+ return;
+ }
+
if (getenv("BITLBEE_DEBUG")) {
fprintf(stderr, "\n\x1b[90mHTTP:%s\n", req->reply_body);
fprintf(stderr, "\n\x1b[97m\n");
}
- if (req->status_code != 200) {
- gw->callback(gw->md, -1, B_EV_IO_READ);
- return;
- }
-
if ((value = get_rfc822_header(req->reply_headers, "X-MSN-Messenger", 0))) {
if (!msn_gw_parse_session_header(gw, value)) {
gw->callback(gw->md, -1, B_EV_IO_READ);
@@ -112,7 +112,10 @@ void msn_gw_callback(struct http_request *req)
if (req->body_size) {
g_byte_array_append(gw->in, (const guint8 *) req->reply_body, req->body_size);
- gw->callback(gw->md, -1, B_EV_IO_READ);
+
+ if (!gw->callback(gw->md, -1, B_EV_IO_READ)) {
+ return;
+ }
}
if (gw->poll_timeout != -1) {
diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c
index 0011d7e7..0aab149d 100644
--- a/protocols/msn/ns.c
+++ b/protocols/msn/ns.c
@@ -180,6 +180,7 @@ static gboolean msn_ns_callback(gpointer data, gint source, b_input_condition co
if (st <= 0) {
imcb_error(ic, "Error while reading from server");
imc_logout(ic, TRUE);
+ g_free(bytes);
return FALSE;
}
@@ -187,11 +188,7 @@ static gboolean msn_ns_callback(gpointer data, gint source, b_input_condition co
g_free(bytes);
- /* Ignore ret == 0, it's already disconnected then. */
- msn_handler(md);
-
- return TRUE;
-
+ return msn_handler(md);
}
int msn_ns_command(struct msn_data *md, char **cmd, int num_parts)
diff --git a/protocols/oscar/ssi.c b/protocols/oscar/ssi.c
index 7583114f..d055185e 100644
--- a/protocols/oscar/ssi.c
+++ b/protocols/oscar/ssi.c
@@ -65,7 +65,7 @@ static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_item **list, str
do {
newitem->gid += 0x0001;
for (cur = *list, i = 0; ((cur) && (!i)); cur = cur->next) {
- if ((cur->gid == newitem->gid) && (cur->gid == newitem->gid)) {
+ if ((cur->bid == newitem->bid) && (cur->gid == newitem->gid)) {
i = 1;
}
}
diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c
index 421a0552..4debc08a 100644
--- a/protocols/twitter/twitter.c
+++ b/protocols/twitter/twitter.c
@@ -482,17 +482,24 @@ int twitter_url_len_diff(gchar *msg, unsigned int target_len)
return url_len_diff;
}
-static gboolean twitter_length_check(struct im_connection *ic, gchar * msg)
+int twitter_message_len(gchar *msg, int target_len)
{
- int max = set_getint(&ic->acc->set, "message_length"), len;
- int target_len = set_getint(&ic->acc->set, "target_url_length");
int url_len_diff = 0;
if (target_len > 0) {
url_len_diff = twitter_url_len_diff(msg, target_len);
}
- if (max == 0 || (len = g_utf8_strlen(msg, -1) + url_len_diff) <= max) {
+ return g_utf8_strlen(msg, -1) + url_len_diff;
+}
+
+static gboolean twitter_length_check(struct im_connection *ic, gchar * msg)
+{
+ int max = set_getint(&ic->acc->set, "message_length");
+ int target_len = set_getint(&ic->acc->set, "target_url_length");
+ int len = twitter_message_len(msg, target_len);
+
+ if (max == 0 || len <= max) {
return TRUE;
}
diff --git a/protocols/yahoo/yahoo2.h b/protocols/yahoo/yahoo2.h
index 464672a1..b9d0e176 100644
--- a/protocols/yahoo/yahoo2.h
+++ b/protocols/yahoo/yahoo2.h
@@ -32,8 +32,6 @@ extern "C" {
#define free(x) g_free(x)
#undef malloc
#define malloc(x) g_malloc(x)
-#undef calloc
-#define calloc(x, y) g_calloc(x, y)
#undef realloc
#define realloc(x, y) g_realloc(x, y)
#undef strdup