From 94acdd0d7beaa659a5f6b26673c5dea5dbcc4496 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 28 Sep 2008 12:18:19 +0100 Subject: Restored support for password-protected chatrooms (for now only by accepting a password in the IRC JOIN command). --- protocols/oscar/oscar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 36e03166..8be04259 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -2580,7 +2580,7 @@ void oscar_chat_leave(struct groupchat *c) oscar_chat_kill(c->ic, c->data); } -struct groupchat *oscar_chat_join(struct im_connection * ic, char * room, char * nick, char * password ) +struct groupchat *oscar_chat_join(struct im_connection * ic, const char * room, const char * nick, const char * password ) { struct oscar_data * od = (struct oscar_data *)ic->proto_data; aim_conn_t * cur; -- cgit v1.2.3 From c0c43fba49da3d14097f2c7cf3569a829b84125a Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 14 Dec 2008 10:31:49 +0000 Subject: Fixed ic->away leaking memory. This var is only used by OSCAR and should maybe be killed. Also fixed some completely broken indentation in those functions. --- protocols/oscar/oscar.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 8be04259..4142c046 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -1938,8 +1938,7 @@ static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); - if (ic->away) - g_free(ic->away); + g_free(ic->away); ic->away = NULL; if (!message) { @@ -1959,55 +1958,53 @@ static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, static void oscar_set_away_icq(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message) { - const char *msg = NULL; + const char *msg = NULL; gboolean no_message = FALSE; /* clean old states */ - if (ic->away) { - g_free(ic->away); - ic->away = NULL; - } + g_free(ic->away); + ic->away = NULL; od->sess->aim_icq_state = 0; /* if no message, then use an empty message */ - if (message) { - msg = message; - } else { - msg = ""; + if (message) { + msg = message; + } else { + msg = ""; no_message = TRUE; - } + } if (!g_strcasecmp(state, "Online")) { aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); } else if (!g_strcasecmp(state, "Away")) { aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY); - ic->away = g_strdup(msg); + ic->away = g_strdup(msg); od->sess->aim_icq_state = AIM_MTYPE_AUTOAWAY; } else if (!g_strcasecmp(state, "Do Not Disturb")) { aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY); - ic->away = g_strdup(msg); + ic->away = g_strdup(msg); od->sess->aim_icq_state = AIM_MTYPE_AUTODND; } else if (!g_strcasecmp(state, "Not Available")) { aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY); - ic->away = g_strdup(msg); + ic->away = g_strdup(msg); od->sess->aim_icq_state = AIM_MTYPE_AUTONA; } else if (!g_strcasecmp(state, "Occupied")) { aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY); - ic->away = g_strdup(msg); + ic->away = g_strdup(msg); od->sess->aim_icq_state = AIM_MTYPE_AUTOBUSY; } else if (!g_strcasecmp(state, "Free For Chat")) { aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_CHAT); - ic->away = g_strdup(msg); + ic->away = g_strdup(msg); od->sess->aim_icq_state = AIM_MTYPE_AUTOFFC; } else if (!g_strcasecmp(state, "Invisible")) { aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE); - ic->away = g_strdup(msg); + ic->away = g_strdup(msg); } else if (!g_strcasecmp(state, GAIM_AWAY_CUSTOM)) { if (no_message) { aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); } else { aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY); - ic->away = g_strdup(msg); + ic->away = g_strdup(msg); od->sess->aim_icq_state = AIM_MTYPE_AUTOAWAY; } } @@ -2019,7 +2016,7 @@ static void oscar_set_away(struct im_connection *ic, char *state, char *message) { struct oscar_data *od = (struct oscar_data *)ic->proto_data; - oscar_set_away_aim(ic, od, state, message); + oscar_set_away_aim(ic, od, state, message); if (od->icq) oscar_set_away_icq(ic, od, state, message); -- cgit v1.2.3 From 54699524eda49bb287d5998e443deefd81fce8fc Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 14 Dec 2008 15:04:48 +0000 Subject: Detect disconnects caused by concurrent logins or rate limiting, and disable auto-reconnect in those cases to prevent loops. --- protocols/oscar/oscar.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 4142c046..1118c26d 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -90,7 +90,7 @@ struct oscar_data { GSList *oscar_chats; - gboolean killme; + gboolean killme, no_reconnect; gboolean icq; GSList *evilhack; @@ -180,6 +180,7 @@ static struct chat_connection *find_oscar_chat_by_conn(struct im_connection *ic, static int gaim_parse_auth_resp (aim_session_t *, aim_frame_t *, ...); static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...); +static int gaim_parse_logout (aim_session_t *, aim_frame_t *, ...); static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...); static int gaim_parse_oncoming (aim_session_t *, aim_frame_t *, ...); static int gaim_parse_offgoing (aim_session_t *, aim_frame_t *, ...); @@ -293,7 +294,7 @@ static gboolean oscar_callback(gpointer data, gint source, if (aim_get_command(odata->sess, conn) >= 0) { aim_rxdispatch(odata->sess); if (odata->killme) - imc_logout(ic, TRUE); + imc_logout(ic, !odata->no_reconnect); } else { if ((conn->type == AIM_CONN_TYPE_BOS) || !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) { @@ -519,6 +520,7 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { break; case 0x18: /* connecting too frequently */ + od->no_reconnect = TRUE; imcb_error(ic, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); break; case 0x1c: @@ -571,6 +573,7 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_SRVACK, gaim_ssi_parseack, 0); aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parseaiminfo, 0); aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parsemtn, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_parse_logout, 0); ((struct oscar_data *)ic->proto_data)->conn = bosconn; for (i = 0; i < (int)strlen(info->bosip); i++) { @@ -750,6 +753,30 @@ static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { return 1; } +static int gaim_parse_logout(aim_session_t *sess, aim_frame_t *fr, ...) { + struct im_connection *ic = sess->aux_data; + struct oscar_data *odata = ic->proto_data; + int code; + va_list ap; + + va_start(ap, fr); + code = va_arg(ap, int); + va_end(ap); + + imcb_error( ic, "Connection aborted by server: %s", code == 1 ? + "someone else logged in with your account" : + "unknown reason" ); + + /* Tell BitlBee to disable auto_reconnect if code == 1, since that + means a concurrent login somewhere else. */ + odata->no_reconnect = code == 1; + + /* DO NOT log out here! Just tell the callback to do it. */ + odata->killme = TRUE; + + return 1; +} + static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { struct im_connection *ic = sess->aux_data; struct chat_connection *chatcon; -- cgit v1.2.3 From b9369b55c99246a8feaee0ad24367044d92fa55d Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 18 Jun 2009 00:17:15 +0100 Subject: Fixed compatibility with AIM mobile messages. Should work according to reports in bug #88 (where this patch comes from) and #bitlbee. Not sure about side effects, one way to find out... --- protocols/oscar/aim.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/aim.h b/protocols/oscar/aim.h index 9516996c..d1fc602a 100644 --- a/protocols/oscar/aim.h +++ b/protocols/oscar/aim.h @@ -143,6 +143,17 @@ struct client_info_s { "en", \ } +#define AIM_CLIENTINFO_KNOWNGOOD_5_1_3036 { \ + "AOL Instant Messenger, version 5.1.3036/WIN32", \ + 0x0109, \ + 0x0005, \ + 0x0001, \ + 0x0000, \ + 0x0bdc, \ + "us", \ + "en", \ +} + /* * I would make 4.1.2010 the default, but they seem to have found * an alternate way of breaking that one. @@ -151,7 +162,7 @@ struct client_info_s { * memory test, which may require you to have a WinAIM binary laying * around. (see login.c::memrequest()) */ -#define AIM_CLIENTINFO_KNOWNGOOD AIM_CLIENTINFO_KNOWNGOOD_3_5_1670 +#define AIM_CLIENTINFO_KNOWNGOOD AIM_CLIENTINFO_KNOWNGOOD_5_1_3036 #ifndef TRUE #define TRUE 1 -- cgit v1.2.3