Changes in protocols/oscar/oscar.c [fab3d2d:68198e9]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/oscar/oscar.c
rfab3d2d r68198e9 91 91 GSList *oscar_chats; 92 92 93 gboolean killme ;93 gboolean killme, no_reconnect; 94 94 gboolean icq; 95 95 GSList *evilhack; … … 181 181 static int gaim_parse_auth_resp (aim_session_t *, aim_frame_t *, ...); 182 182 static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...); 183 static int gaim_parse_logout (aim_session_t *, aim_frame_t *, ...); 183 184 static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...); 184 185 static int gaim_parse_oncoming (aim_session_t *, aim_frame_t *, ...); … … 294 295 aim_rxdispatch(odata->sess); 295 296 if (odata->killme) 296 imc_logout(ic, TRUE);297 imc_logout(ic, !odata->no_reconnect); 297 298 } else { 298 299 if ((conn->type == AIM_CONN_TYPE_BOS) || … … 379 380 s->flags |= ACC_SET_OFFLINE_ONLY; 380 381 } 382 383 acc->flags |= ACC_FLAG_AWAY_MESSAGE; 381 384 } 382 385 … … 520 523 case 0x18: 521 524 /* connecting too frequently */ 525 od->no_reconnect = TRUE; 522 526 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.")); 523 527 break; … … 572 576 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parseaiminfo, 0); 573 577 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parsemtn, 0); 578 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_parse_logout, 0); 574 579 575 580 ((struct oscar_data *)ic->proto_data)->conn = bosconn; … … 747 752 748 753 aim_send_login(sess, fr->conn, ic->acc->user, ic->acc->pass, &info, key); 754 755 return 1; 756 } 757 758 static int gaim_parse_logout(aim_session_t *sess, aim_frame_t *fr, ...) { 759 struct im_connection *ic = sess->aux_data; 760 struct oscar_data *odata = ic->proto_data; 761 int code; 762 va_list ap; 763 764 va_start(ap, fr); 765 code = va_arg(ap, int); 766 va_end(ap); 767 768 imcb_error( ic, "Connection aborted by server: %s", code == 1 ? 769 "someone else logged in with your account" : 770 "unknown reason" ); 771 772 /* Tell BitlBee to disable auto_reconnect if code == 1, since that 773 means a concurrent login somewhere else. */ 774 odata->no_reconnect = code == 1; 775 776 /* DO NOT log out here! Just tell the callback to do it. */ 777 odata->killme = TRUE; 749 778 750 779 return 1; … … 1925 1954 static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message) 1926 1955 { 1956 if (state == NULL) 1957 state = ""; 1927 1958 1928 1959 if (!g_strcasecmp(state, _("Visible"))) { … … 1932 1963 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE); 1933 1964 return; 1934 } /* else... */ 1965 } else if (message == NULL) { 1966 message = state; 1967 } 1935 1968 1936 1969 if (od->rights.maxawaymsglen == 0) … … 1939 1972 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); 1940 1973 1941 if (ic->away) 1942 g_free(ic->away); 1974 g_free(ic->away); 1943 1975 ic->away = NULL; 1944 1976 … … 1960 1992 static void oscar_set_away_icq(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message) 1961 1993 { 1962 1994 const char *msg = NULL; 1963 1995 gboolean no_message = FALSE; 1964 1996 1965 1997 /* clean old states */ 1966 if (ic->away) { 1967 g_free(ic->away); 1968 ic->away = NULL; 1969 } 1998 g_free(ic->away); 1999 ic->away = NULL; 1970 2000 od->sess->aim_icq_state = 0; 1971 2001 1972 2002 /* if no message, then use an empty message */ 1973 1974 1975 1976 2003 if (message) { 2004 msg = message; 2005 } else { 2006 msg = ""; 1977 2007 no_message = TRUE; 1978 1979 1980 if ( !g_strcasecmp(state, "Online")) {2008 } 2009 2010 if (state == NULL) { 1981 2011 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); 1982 2012 } else if (!g_strcasecmp(state, "Away")) { 1983 2013 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY); 1984 2014 ic->away = g_strdup(msg); 1985 2015 od->sess->aim_icq_state = AIM_MTYPE_AUTOAWAY; 1986 2016 } else if (!g_strcasecmp(state, "Do Not Disturb")) { 1987 2017 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY); 1988 2018 ic->away = g_strdup(msg); 1989 2019 od->sess->aim_icq_state = AIM_MTYPE_AUTODND; 1990 2020 } else if (!g_strcasecmp(state, "Not Available")) { 1991 2021 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY); 1992 2022 ic->away = g_strdup(msg); 1993 2023 od->sess->aim_icq_state = AIM_MTYPE_AUTONA; 1994 2024 } else if (!g_strcasecmp(state, "Occupied")) { 1995 2025 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY); 1996 2026 ic->away = g_strdup(msg); 1997 2027 od->sess->aim_icq_state = AIM_MTYPE_AUTOBUSY; 1998 2028 } else if (!g_strcasecmp(state, "Free For Chat")) { 1999 2029 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_CHAT); 2000 2030 ic->away = g_strdup(msg); 2001 2031 od->sess->aim_icq_state = AIM_MTYPE_AUTOFFC; 2002 2032 } else if (!g_strcasecmp(state, "Invisible")) { 2003 2033 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE); 2004 2005 } else if (!g_strcasecmp(state, GAIM_AWAY_CUSTOM)){2034 ic->away = g_strdup(msg); 2035 } else { 2006 2036 if (no_message) { 2007 2037 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); 2008 2038 } else { 2009 2039 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY); 2010 2040 ic->away = g_strdup(msg); 2011 2041 od->sess->aim_icq_state = AIM_MTYPE_AUTOAWAY; 2012 2042 } … … 2020 2050 struct oscar_data *od = (struct oscar_data *)ic->proto_data; 2021 2051 2022 2052 oscar_set_away_aim(ic, od, state, message); 2023 2053 if (od->icq) 2024 2054 oscar_set_away_icq(ic, od, state, message); … … 2252 2282 { 2253 2283 struct oscar_data *od = ic->proto_data; 2254 GList *m = NULL; 2255 2256 if (!od->icq) 2257 return g_list_append(m, GAIM_AWAY_CUSTOM); 2258 2259 m = g_list_append(m, "Online"); 2260 m = g_list_append(m, "Away"); 2261 m = g_list_append(m, "Do Not Disturb"); 2262 m = g_list_append(m, "Not Available"); 2263 m = g_list_append(m, "Occupied"); 2264 m = g_list_append(m, "Free For Chat"); 2265 m = g_list_append(m, "Invisible"); 2266 2267 return m; 2284 2285 if (od->icq) { 2286 static GList *m = NULL; 2287 m = g_list_append(m, "Away"); 2288 m = g_list_append(m, "Do Not Disturb"); 2289 m = g_list_append(m, "Not Available"); 2290 m = g_list_append(m, "Occupied"); 2291 m = g_list_append(m, "Free For Chat"); 2292 m = g_list_append(m, "Invisible"); 2293 return m; 2294 } else { 2295 static GList *m = NULL; 2296 m = g_list_append(m, "Away"); 2297 return m; 2298 } 2268 2299 } 2269 2300 … … 2581 2612 } 2582 2613 2583 struct groupchat *oscar_chat_join(struct im_connection * ic, c har * room, char * nick,char * password )2614 struct groupchat *oscar_chat_join(struct im_connection * ic, const char * room, const char * nick, const char * password ) 2584 2615 { 2585 2616 struct oscar_data * od = (struct oscar_data *)ic->proto_data;
Note: See TracChangeset
for help on using the changeset viewer.