From ba9edaa568088900145bbd1004c864b7d408c38d Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 10 May 2006 19:34:46 +0200 Subject: Moved everything to the BitlBee event handling API. --- protocols/oscar/oscar.c | 99 +++++++++++++++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 41 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 53da1e27..ca3210ef 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -252,8 +252,8 @@ static char *msgerrreason[] = { }; static int msgerrreasonlen = 25; -static void oscar_callback(gpointer data, gint source, - GaimInputCondition condition) { +static gboolean oscar_callback(gpointer data, gint source, + b_input_condition condition) { aim_conn_t *conn = (aim_conn_t *)data; aim_session_t *sess = aim_conn_getsess(conn); struct gaim_connection *gc = sess ? sess->aux_data : NULL; @@ -261,13 +261,13 @@ static void oscar_callback(gpointer data, gint source, if (!gc) { /* gc is null. we return, else we seg SIGSEG on next line. */ - return; + return FALSE; } if (!g_slist_find(get_connections(), gc)) { /* oh boy. this is probably bad. i guess the only thing we * can really do is return? */ - return; + return FALSE; } odata = (struct oscar_data *)gc->proto_data; @@ -287,7 +287,7 @@ static void oscar_callback(gpointer data, gint source, char buf[BUF_LONG]; c->conn = NULL; if (c->inpa > 0) - gaim_input_remove(c->inpa); + b_event_remove(c->inpa); c->inpa = 0; c->fd = -1; aim_conn_kill(odata->sess, &conn); @@ -295,7 +295,7 @@ static void oscar_callback(gpointer data, gint source, do_error_dialog(sess->aux_data, buf, _("Chat Error!")); } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { if (odata->cnpa > 0) - gaim_input_remove(odata->cnpa); + b_event_remove(odata->cnpa); odata->cnpa = 0; while (odata->create_rooms) { struct create_room *cr = odata->create_rooms->data; @@ -309,17 +309,22 @@ static void oscar_callback(gpointer data, gint source, aim_conn_kill(odata->sess, &conn); } else if (conn->type == AIM_CONN_TYPE_AUTH) { if (odata->paspa > 0) - gaim_input_remove(odata->paspa); + b_event_remove(odata->paspa); odata->paspa = 0; aim_conn_kill(odata->sess, &conn); } else { aim_conn_kill(odata->sess, &conn); } } + } else { + /* WTF??? */ + return FALSE; } + + return TRUE; } -static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) +static gboolean oscar_login_connect(gpointer data, gint source, b_input_condition cond) { struct gaim_connection *gc = data; struct oscar_data *odata; @@ -328,7 +333,7 @@ static void oscar_login_connect(gpointer data, gint source, GaimInputCondition c if (!g_slist_find(get_connections(), gc)) { closesocket(source); - return; + return FALSE; } odata = gc->proto_data; @@ -338,12 +343,14 @@ static void oscar_login_connect(gpointer data, gint source, GaimInputCondition c if (source < 0) { hide_login_progress(gc, _("Couldn't connect to host")); signoff(gc); - return; + return FALSE; } aim_conn_completeconnect(sess, conn); - gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, + gc->inpa = b_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); + + return FALSE; } static void oscar_login(struct aim_user *user) { @@ -411,7 +418,7 @@ static void oscar_close(struct gaim_connection *gc) { while (odata->oscar_chats) { struct chat_connection *n = odata->oscar_chats->data; if (n->inpa > 0) - gaim_input_remove(n->inpa); + b_event_remove(n->inpa); g_free(n->name); g_free(n->show); odata->oscar_chats = g_slist_remove(odata->oscar_chats, n); @@ -430,11 +437,11 @@ static void oscar_close(struct gaim_connection *gc) { if (odata->oldp) g_free(odata->oldp); if (gc->inpa > 0) - gaim_input_remove(gc->inpa); + b_event_remove(gc->inpa); if (odata->cnpa > 0) - gaim_input_remove(odata->cnpa); + b_event_remove(odata->cnpa); if (odata->paspa > 0) - gaim_input_remove(odata->paspa); + b_event_remove(odata->paspa); aim_session_kill(odata->sess); g_free(odata->sess); odata->sess = NULL; @@ -442,7 +449,7 @@ static void oscar_close(struct gaim_connection *gc) { gc->proto_data = NULL; } -static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { +static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) { struct gaim_connection *gc = data; struct oscar_data *odata; aim_session_t *sess; @@ -450,7 +457,7 @@ static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition con if (!g_slist_find(get_connections(), gc)) { closesocket(source); - return; + return FALSE; } odata = gc->proto_data; @@ -460,13 +467,15 @@ static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition con if (source < 0) { hide_login_progress(gc, _("Could Not Connect")); signoff(gc); - return; + return FALSE; } aim_conn_completeconnect(sess, bosconn); - gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, + gc->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); set_login_progress(gc, 4, _("Connection established, cookie sent")); + + return FALSE; } static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { @@ -569,7 +578,7 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { return 0; } aim_sendcookie(sess, bosconn, info->cookie); - gaim_input_remove(gc->inpa); + b_event_remove(gc->inpa); return 1; } @@ -584,7 +593,7 @@ struct pieceofcrap { unsigned int inpa; }; -static void damn_you(gpointer data, gint source, GaimInputCondition c) +static gboolean damn_you(gpointer data, gint source, b_input_condition c) { struct pieceofcrap *pos = data; struct oscar_data *od = pos->gc->proto_data; @@ -604,21 +613,23 @@ static void damn_you(gpointer data, gint source, GaimInputCondition c) if (in != '\n') { do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM." " You may be disconnected shortly.", "Login Error"); - gaim_input_remove(pos->inpa); + b_event_remove(pos->inpa); closesocket(pos->fd); g_free(pos); - return; + return FALSE; } /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */ read(pos->fd, m, 16); m[16] = '\0'; - gaim_input_remove(pos->inpa); + b_event_remove(pos->inpa); closesocket(pos->fd); aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); g_free(pos); + + return FALSE; } -static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { +static gboolean straight_to_hell(gpointer data, gint source, b_input_condition cond) { struct pieceofcrap *pos = data; char buf[BUF_LONG]; @@ -628,7 +639,7 @@ static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond if (pos->modname) g_free(pos->modname); g_free(pos); - return; + return FALSE; } g_snprintf(buf, sizeof(buf), "GET " AIMHASHDATA @@ -637,8 +648,8 @@ static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond write(pos->fd, buf, strlen(buf)); if (pos->modname) g_free(pos->modname); - pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); - return; + pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); + return FALSE; } /* size of icbmui.ocm, the largest module in AIM 3.5 */ @@ -760,7 +771,7 @@ static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) { return 1; } -static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { +static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) { struct gaim_connection *gc = data; struct oscar_data *odata; aim_session_t *sess; @@ -768,7 +779,7 @@ static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition if (!g_slist_find(get_connections(), gc)) { closesocket(source); - return; + return FALSE; } odata = gc->proto_data; @@ -777,15 +788,17 @@ static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition if (source < 0) { aim_conn_kill(sess, &tstconn); - return; + return FALSE; } aim_conn_completeconnect(sess, tstconn); - odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, + odata->cnpa = b_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); + + return FALSE; } -static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) +static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition cond) { struct gaim_connection *gc = data; struct oscar_data *odata; @@ -794,7 +807,7 @@ static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition co if (!g_slist_find(get_connections(), gc)) { closesocket(source); - return; + return FALSE; } odata = gc->proto_data; @@ -803,15 +816,17 @@ static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition co if (source < 0) { aim_conn_kill(sess, &tstconn); - return; + return FALSE; } aim_conn_completeconnect(sess, tstconn); - odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, + odata->paspa = b_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); + + return FALSE; } -static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) +static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition cond) { struct chat_connection *ccon = data; struct gaim_connection *gc = ccon->gc; @@ -824,7 +839,7 @@ static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition co g_free(ccon->show); g_free(ccon->name); g_free(ccon); - return; + return FALSE; } odata = gc->proto_data; @@ -836,14 +851,16 @@ static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition co g_free(ccon->show); g_free(ccon->name); g_free(ccon); - return; + return FALSE; } aim_conn_completeconnect(sess, ccon->conn); - ccon->inpa = gaim_input_add(tstconn->fd, + ccon->inpa = b_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon); + + return FALSE; } /* Hrmph. I don't know how to make this look better. --mid */ @@ -2557,7 +2574,7 @@ void oscar_chat_kill(struct gaim_connection *gc, struct chat_connection *cc) /* Destroy the chat_connection */ od->oscar_chats = g_slist_remove(od->oscar_chats, cc); if (cc->inpa > 0) - gaim_input_remove(cc->inpa); + b_event_remove(cc->inpa); aim_conn_kill(od->sess, &cc->conn); g_free(cc->name); g_free(cc->show); -- cgit v1.2.3 From 0a3c243b6659dc10efb227e507f324c2711d6dcd Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 1 Jul 2006 01:18:56 +0200 Subject: Got rid of struct aim_user (now using account_t everywhere). Needs some more testing though. --- protocols/oscar/oscar.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 7c76533a..d55ce3f2 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -355,18 +355,18 @@ static gboolean oscar_login_connect(gpointer data, gint source, b_input_conditio return FALSE; } -static void oscar_login(struct aim_user *user) { +static void oscar_login(account_t *acc) { aim_session_t *sess; aim_conn_t *conn; char buf[256]; - struct gaim_connection *gc = new_gaim_conn(user); + struct gaim_connection *gc = new_gaim_conn(acc); struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1); - if (isdigit(*user->username)) { + if (isdigit(acc->user[0])) { odata->icq = TRUE; /* This is odd but it's necessary for a proper do_import and do_export. We don't do those anymore, but let's stick with it, just in case - it accidentally fixes something else too... */ + it accidentally fixes something else too... */ gc->password[8] = 0; } else { gc->flags |= OPT_CONN_HTML; @@ -389,9 +389,9 @@ static void oscar_login(struct aim_user *user) { return; } - if (g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.icq.com") != 0 && - g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.oscar.aol.com") != 0) { - serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",user->proto_opt[USEROPT_AUTH]); + if (g_strcasecmp(acc->server, "login.icq.com") != 0 && + g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) { + serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); } g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username); @@ -401,11 +401,7 @@ static void oscar_login(struct aim_user *user) { aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); conn->status |= AIM_CONN_STATUS_INPROGRESS; - conn->fd = proxy_connect(user->proto_opt[USEROPT_AUTH][0] ? - user->proto_opt[USEROPT_AUTH] : AIM_DEFAULT_LOGIN_SERVER, - user->proto_opt[USEROPT_AUTHPORT][0] ? - atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT, - oscar_login_connect, gc); + conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, gc); if (conn->fd < 0) { hide_login_progress(gc, _("Couldn't connect to host")); signoff(gc); @@ -484,14 +480,11 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; struct aim_authresp_info *info; int i; char *host; int port; - struct aim_user *user; aim_conn_t *bosconn; struct gaim_connection *gc = sess->aux_data; struct oscar_data *od = gc->proto_data; - user = gc->user; - port = user->proto_opt[USEROPT_AUTHPORT][0] ? - atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT, + port = AIM_LOGIN_PORT; va_start(ap, fr); info = va_arg(ap, struct aim_authresp_info *); @@ -870,19 +863,16 @@ static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; struct aim_redirect_data *redir; struct gaim_connection *gc = sess->aux_data; - struct aim_user *user = gc->user; aim_conn_t *tstconn; int i; char *host; int port; - port = user->proto_opt[USEROPT_AUTHPORT][0] ? - atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT, - va_start(ap, fr); redir = va_arg(ap, struct aim_redirect_data *); va_end(ap); + port = AIM_LOGIN_PORT; for (i = 0; i < (int)strlen(redir->ip); i++) { if (redir->ip[i] == ':') { port = atoi(&(redir->ip[i+1])); @@ -1722,8 +1712,11 @@ static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen; + /* FIXME: It seems we're not really using this, and it broke now that + struct aim_user is dead. aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps); - + */ + return 1; } -- cgit v1.2.3 From 96863f65118767e968469e82ba6b02006e36b81c Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 2 Jul 2006 11:49:31 +0200 Subject: Added protocol-specific settings, made the server setting specific to only OSCAR and Jabber. --- protocols/oscar/oscar.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index d55ce3f2..28239812 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -355,6 +355,14 @@ static gboolean oscar_login_connect(gpointer data, gint source, b_input_conditio return FALSE; } +static void oscar_acc_init(account_t *acc) +{ + set_t *s; + + s = set_add( &acc->set, "server", NULL, set_eval_account, acc ); + s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY; +} + static void oscar_login(account_t *acc) { aim_session_t *sess; aim_conn_t *conn; @@ -389,6 +397,12 @@ static void oscar_login(account_t *acc) { return; } + if (acc->server == NULL) { + hide_login_progress(gc, "No servername specified"); + signoff(gc); + return; + } + if (g_strcasecmp(acc->server, "login.icq.com") != 0 && g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) { serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); @@ -2648,6 +2662,7 @@ void oscar_init() ret->name = "oscar"; ret->away_states = oscar_away_states; ret->login = oscar_login; + ret->acc_init = oscar_acc_init; ret->close = oscar_close; ret->send_im = oscar_send_im; ret->get_info = oscar_get_info; -- cgit v1.2.3 From 5b52a4895e5a59ff6509f7771f4d8665737688c3 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 3 Jul 2006 23:22:45 +0200 Subject: Implemented per-account nick lists instead of per-protocol nick lists. nick_t is dead, instead nicks are just saves in a per-account_t GLib hash table. While doing this, the import_buddies command finally died and text_save() disappeared, because the old file format can't handle most of the new features in this branch anyway. Still have to implement support for the new nick lists in text_load()! --- protocols/oscar/oscar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 28239812..f65332dc 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -2680,9 +2680,10 @@ void oscar_init() ret->rem_deny = oscar_rem_deny; ret->set_permit_deny = oscar_set_permit_deny; ret->keepalive = oscar_keepalive; - ret->cmp_buddynames = aim_sncmp; ret->get_status_string = oscar_get_status_string; ret->send_typing = oscar_send_typing; + + ret->handle_cmp = aim_sncmp; register_protocol(ret); } -- cgit v1.2.3 From 66b9e86eafc3709c491f96c917069db8b6a0c895 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 7 Jul 2006 15:33:31 +0200 Subject: Add support for checking test suite coverage using gcov. --- protocols/oscar/Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'protocols/oscar') diff --git a/protocols/oscar/Makefile b/protocols/oscar/Makefile index 97a27299..ed2d7f83 100644 --- a/protocols/oscar/Makefile +++ b/protocols/oscar/Makefile @@ -16,6 +16,9 @@ LFLAGS += -r # [SH] Phony targets all: oscar_mod.o +check: all +gcov: + gcov *.c .PHONY: all clean distclean -- cgit v1.2.3 From d3a672c0b70eb7b50dcd2908d6cd6928d4f7d874 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 4 Aug 2006 15:56:53 +0200 Subject: Added a per-account web_aware setting for ICQ connections. --- protocols/oscar/oscar.c | 5 +++++ protocols/oscar/service.c | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index f65332dc..d30ebbe8 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -361,6 +361,11 @@ static void oscar_acc_init(account_t *acc) s = set_add( &acc->set, "server", NULL, set_eval_account, acc ); s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY; + + if (isdigit(acc->user[0])) { + s = set_add( &acc->set, "web_aware", "false", set_eval_bool, acc ); + s->flags |= ACC_SET_OFFLINE_ONLY; + } } static void oscar_login(account_t *acc) { diff --git a/protocols/oscar/service.c b/protocols/oscar/service.c index 4596974f..d55e0987 100644 --- a/protocols/oscar/service.c +++ b/protocols/oscar/service.c @@ -731,8 +731,12 @@ int aim_setextstatus(aim_session_t *sess, aim_conn_t *conn, guint32 status) aim_tlvlist_t *tl = NULL; guint32 data; int tlvlen; + struct gaim_connection *gc = sess ? sess->aux_data : NULL; data = AIM_ICQ_STATE_HIDEIP | status; /* yay for error checking ;^) */ + + if (gc && set_getbool(&gc->acc->set, "web_aware")) + data |= AIM_ICQ_STATE_WEBAWARE; tlvlen = aim_addtlvtochain32(&tl, 0x0006, data); -- cgit v1.2.3 From d5ccd83c5235528df2481003502647b86b41fdc4 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 13 Aug 2006 21:15:23 +0200 Subject: Extra comments in set.h and now properly using set_getbool() instead of set_getint(). --- protocols/oscar/oscar.c | 4 ---- protocols/oscar/rxhandlers.c | 4 ---- 2 files changed, 8 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index d30ebbe8..b8cf521b 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -1251,10 +1251,6 @@ static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) { channel = va_arg(ap, int); userinfo = va_arg(ap, aim_userinfo_t *); - if (set_getint(sess->aux_data, "debug")) { - serv_got_crap(sess->aux_data, "channel %i called", channel); - } - switch (channel) { case 1: { /* standard message */ struct aim_incomingim_ch1_args *args; diff --git a/protocols/oscar/rxhandlers.c b/protocols/oscar/rxhandlers.c index be8aba44..7014e693 100644 --- a/protocols/oscar/rxhandlers.c +++ b/protocols/oscar/rxhandlers.c @@ -112,10 +112,6 @@ static int consumesnac(aim_session_t *sess, aim_frame_t *rx) /* Following SNAC will be related */ } - if (set_getint(sess->aux_data, "debug")) { - serv_got_crap(sess->aux_data, "snac %x/%x received", snac.family, snac.subtype); - } - for (cur = (aim_module_t *)sess->modlistv; cur; cur = cur->next) { if (!(cur->flags & AIM_MODFLAG_MULTIFAMILY) && -- cgit v1.2.3 From 3dc9d46cc20d287c266fed97f92d298ed721f7b3 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 15 Oct 2006 17:32:46 +0200 Subject: Fixed a very interesting memory leak in the OSCAR module. --- protocols/oscar/info.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/info.c b/protocols/oscar/info.c index ffe29d1f..0f1bcfd2 100644 --- a/protocols/oscar/info.c +++ b/protocols/oscar/info.c @@ -260,6 +260,7 @@ guint32 aim_getcap(aim_session_t *sess, aim_bstream_t *bs, int len) if (!identified) { /*FIXME*/ + /*REMOVEME :-) g_strdup_printf("unknown capability: {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n", cap[0], cap[1], cap[2], cap[3], cap[4], cap[5], @@ -267,7 +268,7 @@ guint32 aim_getcap(aim_session_t *sess, aim_bstream_t *bs, int len) cap[8], cap[9], cap[10], cap[11], cap[12], cap[13], cap[14], cap[15]); - + */ } g_free(cap); -- cgit v1.2.3 From 91bd910ec5ecf95953518246e3fd0adf1f43c1f7 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 21 Oct 2006 22:56:21 +0200 Subject: Fixed #139. (Wrong Gender description) --- 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 b8cf521b..72078b3c 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -2296,7 +2296,7 @@ static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...) } } info_string_append(str, "\n", _("Mobile Phone"), info->mobile); - info_string_append(str, "\n", _("Gender"), info->gender==1 ? _("Female") : _("Male")); + info_string_append(str, "\n", _("Gender"), info->gender==1 ? _("Female") : info->gender==2 ? _("Male") : _("Unknown")); if (info->birthyear || info->birthmonth || info->birthday) { char date[30]; struct tm tm; -- cgit v1.2.3 From 348c11b16c156979ef2c7141ca7450af693b3713 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 22 Jan 2007 10:42:55 +0100 Subject: Add lcov target --- protocols/oscar/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'protocols/oscar') diff --git a/protocols/oscar/Makefile b/protocols/oscar/Makefile index ed2d7f83..95e85ec2 100644 --- a/protocols/oscar/Makefile +++ b/protocols/oscar/Makefile @@ -17,6 +17,7 @@ LFLAGS += -r # [SH] Phony targets all: oscar_mod.o check: all +lcov: gcov: gcov *.c -- cgit v1.2.3 From fa29d09342c79b886efacee4cfc3078be5f5a722 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Tue, 27 Mar 2007 22:53:11 -0700 Subject: Preparing for Jabber conference room support. --- protocols/oscar/oscar.c | 52 ++++++++++++++----------------------------------- 1 file changed, 15 insertions(+), 37 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 72078b3c..05539442 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -157,22 +157,6 @@ static char *extract_name(const char *name) { return tmp; } -static struct chat_connection *find_oscar_chat(struct gaim_connection *gc, int id) { - GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; - struct chat_connection *c = NULL; - - while (g) { - c = (struct chat_connection *)g->data; - if (c->id == id) - break; - g = g->next; - c = NULL; - } - - return c; -} - - static struct chat_connection *find_oscar_chat_by_conn(struct gaim_connection *gc, aim_conn_t *conn) { GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; @@ -768,7 +752,8 @@ static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { chatcon = find_oscar_chat_by_conn(gc, fr->conn); chatcon->id = id; - chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show); + chatcon->cnv = serv_got_joined_chat(gc, chatcon->show); + chatcon->cnv->data = chatcon; return 1; } @@ -1579,7 +1564,7 @@ static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { tmp = g_malloc(BUF_LONG); g_snprintf(tmp, BUF_LONG, "%s", msg); - serv_got_chat_in(gc, ccon->id, info->sn, 0, tmp, time((time_t)NULL)); + serv_got_chat_in(ccon->cnv, info->sn, 0, tmp, time((time_t)NULL)); g_free(tmp); return 1; @@ -2520,8 +2505,9 @@ int oscar_send_typing(struct gaim_connection *gc, char * who, int typing) return( aim_im_sendmtn(od->sess, 1, who, typing ? 0x0002 : 0x0000) ); } -int oscar_chat_send(struct gaim_connection * gc, int id, char *message) +int oscar_chat_send(struct conversation *c, char *message) { + struct gaim_connection *gc = c->gc; struct oscar_data * od = (struct oscar_data*)gc->proto_data; struct chat_connection * ccon; int ret; @@ -2529,8 +2515,7 @@ int oscar_chat_send(struct gaim_connection * gc, int id, char *message) guint16 flags; char *s; - if(!(ccon = find_oscar_chat(gc, id))) - return -1; + ccon = c->data; for (s = message; *s; s++) if (*s & 128) @@ -2567,13 +2552,11 @@ int oscar_chat_send(struct gaim_connection * gc, int id, char *message) return (ret >= 0); } -void oscar_chat_invite(struct gaim_connection * gc, int id, char *message, char *who) +void oscar_chat_invite(struct conversation *c, char *message, char *who) { + struct gaim_connection *gc = c->gc; struct oscar_data * od = (struct oscar_data *)gc->proto_data; - struct chat_connection *ccon = find_oscar_chat(gc, id); - - if (ccon == NULL) - return; + struct chat_connection *ccon = c->data; aim_chat_invite(od->sess, od->conn, who, message ? message : "", ccon->exchange, ccon->name, 0x0); @@ -2584,7 +2567,7 @@ void oscar_chat_kill(struct gaim_connection *gc, struct chat_connection *cc) struct oscar_data *od = (struct oscar_data *)gc->proto_data; /* Notify the conversation window that we've left the chat */ - serv_got_chat_left(gc, cc->id); + serv_got_chat_left(cc->cnv); /* Destroy the chat_connection */ od->oscar_chats = g_slist_remove(od->oscar_chats, cc); @@ -2596,19 +2579,14 @@ void oscar_chat_kill(struct gaim_connection *gc, struct chat_connection *cc) g_free(cc); } -void oscar_chat_leave(struct gaim_connection * gc, int id) +void oscar_chat_leave(struct conversation *c) { - struct chat_connection * ccon = find_oscar_chat(gc, id); - - if(ccon == NULL) - return; - - oscar_chat_kill(gc, ccon); + oscar_chat_kill(c->gc, c->data); } int oscar_chat_join(struct gaim_connection * gc, char * name) { - struct oscar_data * od = (struct oscar_data *)gc->proto_data; + struct oscar_data * od = (struct oscar_data *)gc->proto_data; aim_conn_t * cur; @@ -2626,7 +2604,7 @@ int oscar_chat_join(struct gaim_connection * gc, char * name) } } -int oscar_chat_open(struct gaim_connection * gc, char *who) +struct conversation *oscar_chat_open(struct gaim_connection * gc, char *who) { struct oscar_data * od = (struct oscar_data *)gc->proto_data; int ret; @@ -2641,7 +2619,7 @@ int oscar_chat_open(struct gaim_connection * gc, char *who) g_free(chatname); - return ret; + return NULL; } void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv) -- cgit v1.2.3 From 0da65d5fb37691ed4d31f7ab4058732f1440db6b Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 30 Mar 2007 22:40:45 -0700 Subject: s/gaim_connection/im_connection/ and some other minor API changes. The rest will come tomorrow. It compiles, I'll leave the real testing up to someone else. ;-) --- protocols/oscar/aim.h | 2 +- protocols/oscar/im.c | 4 +- protocols/oscar/oscar.c | 464 +++++++++++++++++++++++----------------------- protocols/oscar/service.c | 4 +- 4 files changed, 237 insertions(+), 237 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/aim.h b/protocols/oscar/aim.h index 93887103..81ea5f9e 100644 --- a/protocols/oscar/aim.h +++ b/protocols/oscar/aim.h @@ -573,7 +573,7 @@ struct aim_chat_roominfo { }; struct aim_chat_invitation { - struct gaim_connection * gc; + struct im_connection * ic; char * name; guint8 exchange; }; diff --git a/protocols/oscar/im.c b/protocols/oscar/im.c index 7cccabc7..bc2c2abe 100644 --- a/protocols/oscar/im.c +++ b/protocols/oscar/im.c @@ -1416,7 +1416,7 @@ static void incomingim_ch2_icqserverrelay(aim_session_t *sess, aim_module_t *mod guint8 msgtype, msgflags; guint8 *plugin; int i = 0, tmp = 0; - struct gaim_connection *gc = sess->aux_data; + struct im_connection *ic = sess->aux_data; /* at the moment we just can deal with requests, not with cancel or accept */ if (args->status != 0) return; @@ -1468,7 +1468,7 @@ static void incomingim_ch2_icqserverrelay(aim_session_t *sess, aim_module_t *mod case AIM_MTYPE_AUTOFFC: case 0x9c: /* ICQ 5 seems to send this */ aim_send_im_ch2_statusmessage(sess, userinfo->sn, args->cookie, - gc->away ? gc->away : "", sess->aim_icq_state, dc); + ic->away ? ic->away : "", sess->aim_icq_state, dc); break; } diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 05539442..d2c6af1e 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -115,21 +115,21 @@ struct chat_connection { aim_conn_t *conn; int inpa; int id; - struct gaim_connection *gc; /* i hate this. */ - struct conversation *cnv; /* bah. */ + struct im_connection *ic; /* i hate this. */ + struct groupchat *cnv; /* bah. */ int maxlen; int maxvis; }; struct ask_direct { - struct gaim_connection *gc; + struct im_connection *ic; char *sn; char ip[64]; guint8 cookie[8]; }; struct icq_auth { - struct gaim_connection *gc; + struct im_connection *ic; guint32 uin; }; @@ -157,9 +157,9 @@ static char *extract_name(const char *name) { return tmp; } -static struct chat_connection *find_oscar_chat_by_conn(struct gaim_connection *gc, +static struct chat_connection *find_oscar_chat_by_conn(struct im_connection *ic, aim_conn_t *conn) { - GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; + GSList *g = ((struct oscar_data *)ic->proto_data)->oscar_chats; struct chat_connection *c = NULL; while (g) { @@ -242,34 +242,34 @@ static gboolean oscar_callback(gpointer data, gint source, b_input_condition condition) { aim_conn_t *conn = (aim_conn_t *)data; aim_session_t *sess = aim_conn_getsess(conn); - struct gaim_connection *gc = sess ? sess->aux_data : NULL; + struct im_connection *ic = sess ? sess->aux_data : NULL; struct oscar_data *odata; - if (!gc) { - /* gc is null. we return, else we seg SIGSEG on next line. */ + if (!ic) { + /* ic is null. we return, else we seg SIGSEG on next line. */ return FALSE; } - if (!g_slist_find(get_connections(), gc)) { + if (!g_slist_find(get_connections(), ic)) { /* oh boy. this is probably bad. i guess the only thing we * can really do is return? */ return FALSE; } - odata = (struct oscar_data *)gc->proto_data; + odata = (struct oscar_data *)ic->proto_data; if (condition & GAIM_INPUT_READ) { if (aim_get_command(odata->sess, conn) >= 0) { aim_rxdispatch(odata->sess); if (odata->killme) - signoff(gc); + signoff(ic); } else { if ((conn->type == AIM_CONN_TYPE_BOS) || !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) { - hide_login_progress_error(gc, _("Disconnected.")); - signoff(gc); + hide_login_progress_error(ic, _("Disconnected.")); + signoff(ic); } else if (conn->type == AIM_CONN_TYPE_CHAT) { - struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); + struct chat_connection *c = find_oscar_chat_by_conn(ic, conn); char buf[BUF_LONG]; c->conn = NULL; if (c->inpa > 0) @@ -312,34 +312,34 @@ static gboolean oscar_callback(gpointer data, gint source, static gboolean oscar_login_connect(gpointer data, gint source, b_input_condition cond) { - struct gaim_connection *gc = data; + struct im_connection *ic = data; struct oscar_data *odata; aim_session_t *sess; aim_conn_t *conn; - if (!g_slist_find(get_connections(), gc)) { + if (!g_slist_find(get_connections(), ic)) { closesocket(source); return FALSE; } - odata = gc->proto_data; + odata = ic->proto_data; sess = odata->sess; conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); if (source < 0) { - hide_login_progress(gc, _("Couldn't connect to host")); - signoff(gc); + hide_login_progress(ic, _("Couldn't connect to host")); + signoff(ic); return FALSE; } aim_conn_completeconnect(sess, conn); - gc->inpa = b_input_add(conn->fd, GAIM_INPUT_READ, + ic->inpa = b_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); return FALSE; } -static void oscar_acc_init(account_t *acc) +static void oscar_init(account_t *acc) { set_t *s; @@ -356,17 +356,17 @@ static void oscar_login(account_t *acc) { aim_session_t *sess; aim_conn_t *conn; char buf[256]; - struct gaim_connection *gc = new_gaim_conn(acc); - struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1); + struct im_connection *ic = new_gaim_conn(acc); + struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1); if (isdigit(acc->user[0])) { odata->icq = TRUE; /* This is odd but it's necessary for a proper do_import and do_export. We don't do those anymore, but let's stick with it, just in case it accidentally fixes something else too... */ - gc->password[8] = 0; + ic->password[8] = 0; } else { - gc->flags |= OPT_CONN_HTML; + ic->flags |= OPT_CONN_HTML; } sess = g_new0(aim_session_t, 1); @@ -377,44 +377,44 @@ static void oscar_login(account_t *acc) { * see if things need to be sent. */ aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL); odata->sess = sess; - sess->aux_data = gc; + sess->aux_data = ic; conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); if (conn == NULL) { - hide_login_progress(gc, _("Unable to login to AIM")); - signoff(gc); + hide_login_progress(ic, _("Unable to login to AIM")); + signoff(ic); return; } if (acc->server == NULL) { - hide_login_progress(gc, "No servername specified"); - signoff(gc); + hide_login_progress(ic, "No servername specified"); + signoff(ic); return; } if (g_strcasecmp(acc->server, "login.icq.com") != 0 && g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) { - serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); + serv_got_crap(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); } - g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username); - set_login_progress(gc, 2, buf); + g_snprintf(buf, sizeof(buf), _("Signon: %s"), ic->username); + set_login_progress(ic, 2, buf); aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); conn->status |= AIM_CONN_STATUS_INPROGRESS; - conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, gc); + conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic); if (conn->fd < 0) { - hide_login_progress(gc, _("Couldn't connect to host")); - signoff(gc); + hide_login_progress(ic, _("Couldn't connect to host")); + signoff(ic); return; } - aim_request_login(sess, conn, gc->username); + aim_request_login(sess, conn, ic->username); } -static void oscar_close(struct gaim_connection *gc) { - struct oscar_data *odata = (struct oscar_data *)gc->proto_data; +static void oscar_logout(struct im_connection *ic) { + struct oscar_data *odata = (struct oscar_data *)ic->proto_data; while (odata->oscar_chats) { struct chat_connection *n = odata->oscar_chats->data; @@ -437,8 +437,8 @@ static void oscar_close(struct gaim_connection *gc) { g_free(odata->newp); if (odata->oldp) g_free(odata->oldp); - if (gc->inpa > 0) - b_event_remove(gc->inpa); + if (ic->inpa > 0) + b_event_remove(ic->inpa); if (odata->cnpa > 0) b_event_remove(odata->cnpa); if (odata->paspa > 0) @@ -446,35 +446,35 @@ static void oscar_close(struct gaim_connection *gc) { aim_session_kill(odata->sess); g_free(odata->sess); odata->sess = NULL; - g_free(gc->proto_data); - gc->proto_data = NULL; + g_free(ic->proto_data); + ic->proto_data = NULL; } static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) { - struct gaim_connection *gc = data; + struct im_connection *ic = data; struct oscar_data *odata; aim_session_t *sess; aim_conn_t *bosconn; - if (!g_slist_find(get_connections(), gc)) { + if (!g_slist_find(get_connections(), ic)) { closesocket(source); return FALSE; } - odata = gc->proto_data; + odata = ic->proto_data; sess = odata->sess; bosconn = odata->conn; if (source < 0) { - hide_login_progress(gc, _("Could Not Connect")); - signoff(gc); + hide_login_progress(ic, _("Could Not Connect")); + signoff(ic); return FALSE; } aim_conn_completeconnect(sess, bosconn); - gc->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ, + ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); - set_login_progress(gc, 4, _("Connection established, cookie sent")); + set_login_progress(ic, 4, _("Connection established, cookie sent")); return FALSE; } @@ -485,8 +485,8 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { int i; char *host; int port; aim_conn_t *bosconn; - struct gaim_connection *gc = sess->aux_data; - struct oscar_data *od = gc->proto_data; + struct im_connection *ic = sess->aux_data; + struct oscar_data *od = ic->proto_data; port = AIM_LOGIN_PORT; va_start(ap, fr); @@ -497,23 +497,23 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { switch (info->errorcode) { case 0x05: /* Incorrect nick/password */ - hide_login_progress(gc, _("Incorrect nickname or password.")); + hide_login_progress(ic, _("Incorrect nickname or password.")); // plugin_event(event_error, (void *)980, 0, 0, 0); break; case 0x11: /* Suspended account */ - hide_login_progress(gc, _("Your account is currently suspended.")); + hide_login_progress(ic, _("Your account is currently suspended.")); break; case 0x18: /* connecting too frequently */ - hide_login_progress(gc, _("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.")); + hide_login_progress(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: /* client too old */ - hide_login_progress(gc, _("The client version you are using is too old. Please upgrade at " WEBSITE)); + hide_login_progress(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE)); break; default: - hide_login_progress(gc, _("Authentication Failed")); + hide_login_progress(ic, _("Authentication Failed")); break; } od->killme = TRUE; @@ -525,7 +525,7 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); if (bosconn == NULL) { - hide_login_progress(gc, _("Internal Error")); + hide_login_progress(ic, _("Internal Error")); od->killme = TRUE; return 0; } @@ -559,7 +559,7 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { 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); - ((struct oscar_data *)gc->proto_data)->conn = bosconn; + ((struct oscar_data *)ic->proto_data)->conn = bosconn; for (i = 0; i < (int)strlen(info->bosip); i++) { if (info->bosip[i] == ':') { port = atoi(&(info->bosip[i+1])); @@ -568,21 +568,21 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { } host = g_strndup(info->bosip, i); bosconn->status |= AIM_CONN_STATUS_INPROGRESS; - bosconn->fd = proxy_connect(host, port, oscar_bos_connect, gc); + bosconn->fd = proxy_connect(host, port, oscar_bos_connect, ic); g_free(host); if (bosconn->fd < 0) { - hide_login_progress(gc, _("Could Not Connect")); + hide_login_progress(ic, _("Could Not Connect")); od->killme = TRUE; return 0; } aim_sendcookie(sess, bosconn, info->cookie); - b_event_remove(gc->inpa); + b_event_remove(ic->inpa); return 1; } struct pieceofcrap { - struct gaim_connection *gc; + struct im_connection *ic; unsigned long offset; unsigned long len; char *modname; @@ -594,7 +594,7 @@ struct pieceofcrap { static gboolean damn_you(gpointer data, gint source, b_input_condition c) { struct pieceofcrap *pos = data; - struct oscar_data *od = pos->gc->proto_data; + struct oscar_data *od = pos->ic->proto_data; char in = '\0'; int x = 0; unsigned char m[17]; @@ -609,7 +609,7 @@ static gboolean damn_you(gpointer data, gint source, b_input_condition c) in = '\0'; } if (in != '\n') { - do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM." + do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." " You may be disconnected shortly.", "Login Error"); b_event_remove(pos->inpa); closesocket(pos->fd); @@ -632,7 +632,7 @@ static gboolean straight_to_hell(gpointer data, gint source, b_input_condition c char buf[BUF_LONG]; if (source < 0) { - do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM." + do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." " You may be disconnected shortly.", "Login Error"); if (pos->modname) g_free(pos->modname); @@ -698,7 +698,7 @@ int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) { */ pos = g_new0(struct pieceofcrap, 1); - pos->gc = sess->aux_data; + pos->ic = sess->aux_data; pos->conn = fr->conn; pos->offset = offset; @@ -726,19 +726,19 @@ static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { #endif char *key; va_list ap; - struct gaim_connection *gc = sess->aux_data; + struct im_connection *ic = sess->aux_data; va_start(ap, fr); key = va_arg(ap, char *); va_end(ap); - aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key); + aim_send_login(sess, fr->conn, ic->username, ic->password, &info, key); return 1; } static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { - struct gaim_connection *gc = sess->aux_data; + struct im_connection *ic = sess->aux_data; struct chat_connection *chatcon; static int id = 1; @@ -750,9 +750,9 @@ static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { aim_clientready(sess, fr->conn); - chatcon = find_oscar_chat_by_conn(gc, fr->conn); + chatcon = find_oscar_chat_by_conn(ic, fr->conn); chatcon->id = id; - chatcon->cnv = serv_got_joined_chat(gc, chatcon->show); + chatcon->cnv = serv_got_joined_chat(ic, chatcon->show); chatcon->cnv->data = chatcon; return 1; @@ -771,17 +771,17 @@ static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) { } static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) { - struct gaim_connection *gc = data; + struct im_connection *ic = data; struct oscar_data *odata; aim_session_t *sess; aim_conn_t *tstconn; - if (!g_slist_find(get_connections(), gc)) { + if (!g_slist_find(get_connections(), ic)) { closesocket(source); return FALSE; } - odata = gc->proto_data; + odata = ic->proto_data; sess = odata->sess; tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV); @@ -799,17 +799,17 @@ static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condit static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition cond) { - struct gaim_connection *gc = data; + struct im_connection *ic = data; struct oscar_data *odata; aim_session_t *sess; aim_conn_t *tstconn; - if (!g_slist_find(get_connections(), gc)) { + if (!g_slist_find(get_connections(), ic)) { closesocket(source); return FALSE; } - odata = gc->proto_data; + odata = ic->proto_data; sess = odata->sess; tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); @@ -828,12 +828,12 @@ static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition cond) { struct chat_connection *ccon = data; - struct gaim_connection *gc = ccon->gc; + struct im_connection *ic = ccon->ic; struct oscar_data *odata; aim_session_t *sess; aim_conn_t *tstconn; - if (!g_slist_find(get_connections(), gc)) { + if (!g_slist_find(get_connections(), ic)) { closesocket(source); g_free(ccon->show); g_free(ccon->name); @@ -841,7 +841,7 @@ static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition return FALSE; } - odata = gc->proto_data; + odata = ic->proto_data; sess = odata->sess; tstconn = ccon->conn; @@ -866,7 +866,7 @@ static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; struct aim_redirect_data *redir; - struct gaim_connection *gc = sess->aux_data; + struct im_connection *ic = sess->aux_data; aim_conn_t *tstconn; int i; char *host; @@ -898,7 +898,7 @@ static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { // aim_conn_addhandler(sess, tstconn, 0x0007, 0x0007, gaim_account_confirm, 0); tstconn->status |= AIM_CONN_STATUS_INPROGRESS; - tstconn->fd = proxy_connect(host, port, oscar_auth_connect, gc); + tstconn->fd = proxy_connect(host, port, oscar_auth_connect, ic); if (tstconn->fd < 0) { aim_conn_kill(sess, &tstconn); g_free(host); @@ -915,7 +915,7 @@ static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0); tstconn->status |= AIM_CONN_STATUS_INPROGRESS; - tstconn->fd = proxy_connect(host, port, oscar_chatnav_connect, gc); + tstconn->fd = proxy_connect(host, port, oscar_chatnav_connect, ic); if (tstconn->fd < 0) { aim_conn_kill(sess, &tstconn); g_free(host); @@ -937,7 +937,7 @@ static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { ccon = g_new0(struct chat_connection, 1); ccon->conn = tstconn; - ccon->gc = gc; + ccon->ic = ic; ccon->fd = -1; ccon->name = g_strdup(redir->chat.room); ccon->exchange = redir->chat.exchange; @@ -966,8 +966,8 @@ static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { } static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { - struct gaim_connection *gc = sess->aux_data; - struct oscar_data *od = gc->proto_data; + struct im_connection *ic = sess->aux_data; + struct oscar_data *od = ic->proto_data; aim_userinfo_t *info; time_t time_idle = 0, signon = 0; int type = 0; @@ -1017,12 +1017,12 @@ static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) signon = time(NULL) - info->sessionlen; - tmp = g_strdup(normalize(gc->username)); + tmp = g_strdup(normalize(ic->username)); if (!strcmp(tmp, normalize(info->sn))) - g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", info->sn); + g_snprintf(ic->displayname, sizeof(ic->displayname), "%s", info->sn); g_free(tmp); - serv_got_update(gc, info->sn, 1, info->warnlevel/10, signon, + serv_got_update(ic, info->sn, 1, info->warnlevel/10, signon, time_idle, type, caps); return 1; @@ -1031,20 +1031,20 @@ static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { aim_userinfo_t *info; va_list ap; - struct gaim_connection *gc = sess->aux_data; + struct im_connection *ic = sess->aux_data; va_start(ap, fr); info = va_arg(ap, aim_userinfo_t *); va_end(ap); - serv_got_update(gc, info->sn, 0, 0, 0, 0, 0, 0); + serv_got_update(ic, info->sn, 0, 0, 0, 0, 0, 0); return 1; } static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { char *tmp = g_malloc(BUF_LONG + 1); - struct gaim_connection *gc = sess->aux_data; + struct im_connection *ic = sess->aux_data; int flags = 0; if (args->icbmflags & AIM_IMFLAGS_AWAY) @@ -1082,7 +1082,7 @@ static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ g_snprintf(tmp, BUF_LONG, "%s", args->msg); strip_linefeed(tmp); - serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL), -1); + serv_got_im(ic, userinfo->sn, tmp, flags, time(NULL), -1); g_free(tmp); return 1; @@ -1092,7 +1092,7 @@ void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv); void oscar_reject_chat(gpointer w, struct aim_chat_invitation * inv); static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { - struct gaim_connection *gc = sess->aux_data; + struct im_connection *ic = sess->aux_data; if (args->status != AIM_RENDEZVOUS_PROPOSE) return 1; @@ -1110,11 +1110,11 @@ static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ g_snprintf( txt, 1024, "Got an invitation to chatroom %s from %s: %s", name, userinfo->sn, args->msg ); - inv->gc = gc; + inv->ic = ic; inv->exchange = *exch; inv->name = g_strdup(name); - do_ask_dialog( gc, txt, inv, oscar_accept_chat, oscar_reject_chat); + do_ask_dialog( ic, txt, inv, oscar_accept_chat, oscar_reject_chat); if (name) g_free(name); @@ -1125,14 +1125,14 @@ static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) { char *uin, message; - struct oscar_data *od = (struct oscar_data *)data->gc->proto_data; + 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, ""); // aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message); - if(find_buddy(data->gc, uin) == NULL) - show_got_added(data->gc, uin, NULL); + if(find_buddy(data->ic, uin) == NULL) + show_got_added(data->ic, uin, NULL); g_free(uin); g_free(data); @@ -1140,7 +1140,7 @@ static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) { static void gaim_icq_authdeny(gpointer w, struct icq_auth *data) { char *uin, *message; - struct oscar_data *od = (struct oscar_data *)data->gc->proto_data; + struct oscar_data *od = (struct oscar_data *)data->ic->proto_data; uin = g_strdup_printf("%u", data->uin); message = g_strdup_printf("No reason given."); @@ -1155,7 +1155,7 @@ static void gaim_icq_authdeny(gpointer w, struct icq_auth *data) { /* * For when other people ask you for authorization */ -static void gaim_icq_authask(struct gaim_connection *gc, guint32 uin, char *msg) { +static void gaim_icq_authask(struct im_connection *ic, guint32 uin, char *msg) { struct icq_auth *data = g_new(struct icq_auth, 1); char *reason = NULL; char *dialog_msg; @@ -1164,14 +1164,14 @@ static void gaim_icq_authask(struct gaim_connection *gc, guint32 uin, char *msg) reason = msg + 6; dialog_msg = g_strdup_printf("The user %u wants to add you to their buddy list for the following reason: %s", uin, reason ? reason : "No reason given."); - data->gc = gc; + data->ic = ic; data->uin = uin; - do_ask_dialog(gc, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny); + do_ask_dialog(ic, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny); g_free(dialog_msg); } static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args) { - struct gaim_connection *gc = sess->aux_data; + struct im_connection *ic = sess->aux_data; switch (args->type) { case 0x0001: { /* An almost-normal instant message. Mac ICQ sends this. It's peculiar. */ @@ -1179,7 +1179,7 @@ static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ uin = g_strdup_printf("%u", args->uin); message = g_strdup(args->msg); strip_linefeed(message); - serv_got_im(gc, uin, message, 0, time(NULL), -1); + serv_got_im(ic, uin, message, 0, time(NULL), -1); g_free(uin); g_free(message); } break; @@ -1198,14 +1198,14 @@ static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ } strip_linefeed(message); - serv_got_im(gc, uin, message, 0, time(NULL), -1); + serv_got_im(ic, uin, message, 0, time(NULL), -1); g_free(uin); g_free(m); g_free(message); } break; case 0x0006: { /* Someone requested authorization */ - gaim_icq_authask(gc, args->uin, args->msg); + gaim_icq_authask(ic, args->uin, args->msg); } break; case 0x0007: { /* Someone has denied you authorization */ @@ -1417,8 +1417,8 @@ static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; guint16 type; - struct gaim_connection *gc = sess->aux_data; - struct oscar_data *odata = (struct oscar_data *)gc->proto_data; + struct im_connection *ic = sess->aux_data; + struct oscar_data *odata = (struct oscar_data *)ic->proto_data; va_start(ap, fr); type = (guint16)va_arg(ap, unsigned int); @@ -1476,7 +1476,7 @@ static int gaim_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; int count, i; aim_userinfo_t *info; - struct gaim_connection *g = sess->aux_data; + struct im_connection *g = sess->aux_data; struct chat_connection *c = NULL; @@ -1499,7 +1499,7 @@ static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; int count, i; aim_userinfo_t *info; - struct gaim_connection *g = sess->aux_data; + struct im_connection *g = sess->aux_data; struct chat_connection *c = NULL; @@ -1527,8 +1527,8 @@ static int gaim_chat_info_update(aim_session_t *sess, aim_frame_t *fr, ...) { char *roomdesc; guint16 unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; guint32 creationtime; - struct gaim_connection *gc = sess->aux_data; - struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); + 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 *); @@ -1554,8 +1554,8 @@ static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; aim_userinfo_t *info; char *msg; - struct gaim_connection *gc = sess->aux_data; - struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); + struct im_connection *ic = sess->aux_data; + struct chat_connection *ccon = find_oscar_chat_by_conn(ic, fr->conn); char *tmp; va_start(ap, fr); @@ -1616,14 +1616,14 @@ static int gaim_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...) { static int gaim_selfinfo(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; aim_userinfo_t *info; - struct gaim_connection *gc = sess->aux_data; + struct im_connection *ic = sess->aux_data; va_start(ap, fr); info = va_arg(ap, aim_userinfo_t *); va_end(ap); - gc->evil = info->warnlevel/10; - /* gc->correction_time = (info->onlinesince - gc->login_time); */ + ic->evil = info->warnlevel/10; + /* ic->correction_time = (info->onlinesince - ic->login_time); */ return 1; } @@ -1645,8 +1645,8 @@ static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) { } static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) { - struct gaim_connection *gc = sess->aux_data; - struct oscar_data *od = gc->proto_data; + struct im_connection *ic = sess->aux_data; + struct oscar_data *od = ic->proto_data; aim_clientready(sess, fr->conn); @@ -1703,8 +1703,8 @@ static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; guint16 maxsiglen; - struct gaim_connection *gc = sess->aux_data; - struct oscar_data *odata = (struct oscar_data *)gc->proto_data; + struct im_connection *ic = sess->aux_data; + struct oscar_data *odata = (struct oscar_data *)ic->proto_data; va_start(ap, fr); maxsiglen = va_arg(ap, int); @@ -1714,7 +1714,7 @@ static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) /* FIXME: It seems we're not really using this, and it broke now that struct aim_user is dead. - aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps); + aim_bos_setprofile(sess, fr->conn, ic->user->user_info, NULL, gaim_caps); */ return 1; @@ -1723,8 +1723,8 @@ static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) static int gaim_parse_buddyrights(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; guint16 maxbuddies, maxwatchers; - struct gaim_connection *gc = sess->aux_data; - struct oscar_data *odata = (struct oscar_data *)gc->proto_data; + struct im_connection *ic = sess->aux_data; + struct oscar_data *odata = (struct oscar_data *)ic->proto_data; va_start(ap, fr); maxbuddies = (guint16)va_arg(ap, unsigned int); @@ -1740,8 +1740,8 @@ static int gaim_parse_buddyrights(aim_session_t *sess, aim_frame_t *fr, ...) { static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) { guint16 maxpermits, maxdenies; va_list ap; - struct gaim_connection *gc = sess->aux_data; - struct oscar_data *odata = (struct oscar_data *)gc->proto_data; + struct im_connection *ic = sess->aux_data; + struct oscar_data *odata = (struct oscar_data *)ic->proto_data; va_start(ap, fr); maxpermits = (guint16)va_arg(ap, unsigned int); @@ -1764,7 +1764,7 @@ static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) { static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; struct aim_icq_offlinemsg *msg; - struct gaim_connection *gc = sess->aux_data; + struct im_connection *ic = sess->aux_data; va_start(ap, fr); msg = va_arg(ap, struct aim_icq_offlinemsg *); @@ -1777,7 +1777,7 @@ static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) { time_t t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); g_snprintf(sender, sizeof(sender), "%u", msg->sender); strip_linefeed(dialog_msg); - serv_got_im(gc, sender, dialog_msg, 0, t, -1); + serv_got_im(ic, sender, dialog_msg, 0, t, -1); g_free(dialog_msg); } break; @@ -1798,13 +1798,13 @@ static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) { } strip_linefeed(dialog_msg); - serv_got_im(gc, sender, dialog_msg, 0, t, -1); + serv_got_im(ic, sender, dialog_msg, 0, t, -1); g_free(dialog_msg); g_free(m); } break; case 0x0006: { /* Authorization request */ - gaim_icq_authask(gc, msg->sender, msg->msg); + gaim_icq_authask(ic, msg->sender, msg->msg); } break; case 0x0007: { /* Someone has denied you authorization */ @@ -1832,14 +1832,14 @@ static int gaim_offlinemsgdone(aim_session_t *sess, aim_frame_t *fr, ...) return 1; } -static void oscar_keepalive(struct gaim_connection *gc) { - struct oscar_data *odata = (struct oscar_data *)gc->proto_data; +static void oscar_keepalive(struct im_connection *ic) { + struct oscar_data *odata = (struct oscar_data *)ic->proto_data; aim_flap_nop(odata->sess, odata->conn); } -static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int len, int imflags) { - struct oscar_data *odata = (struct oscar_data *)gc->proto_data; - int ret = 0; +static int oscar_send_im(struct im_connection *ic, char *name, char *message, int imflags) { + struct oscar_data *odata = (struct oscar_data *)ic->proto_data; + int ret = 0, len = strlen(message); if (imflags & IM_FLAG_AWAY) { ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message); } else { @@ -1891,7 +1891,7 @@ static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, return ret; } -static void oscar_get_info(struct gaim_connection *g, char *name) { +static void oscar_get_info(struct im_connection *g, char *name) { struct oscar_data *odata = (struct oscar_data *)g->proto_data; if (odata->icq) aim_icq_getallinfo(odata->sess, name); @@ -1901,7 +1901,7 @@ static void oscar_get_info(struct gaim_connection *g, char *name) { } } -static void oscar_get_away(struct gaim_connection *g, char *who) { +static void oscar_get_away(struct im_connection *g, char *who) { struct oscar_data *odata = (struct oscar_data *)g->proto_data; if (odata->icq) { struct buddy *budlight = find_buddy(g, who); @@ -1913,7 +1913,7 @@ static void oscar_get_away(struct gaim_connection *g, char *who) { aim_getinfo(odata->sess, odata->conn, who, AIM_GETINFO_AWAYMESSAGE); } -static void oscar_set_away_aim(struct gaim_connection *gc, struct oscar_data *od, const char *state, const char *message) +static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message) { if (!g_strcasecmp(state, _("Visible"))) { @@ -1925,13 +1925,13 @@ static void oscar_set_away_aim(struct gaim_connection *gc, struct oscar_data *od } /* else... */ if (od->rights.maxawaymsglen == 0) - do_error_dialog(gc, "oscar_set_away_aim called before locate rights received", "Protocol Error"); + do_error_dialog(ic, "oscar_set_away_aim called before locate rights received", "Protocol Error"); aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); - if (gc->away) - g_free(gc->away); - gc->away = NULL; + if (ic->away) + g_free(ic->away); + ic->away = NULL; if (!message) { aim_bos_setprofile(od->sess, od->conn, NULL, "", gaim_caps); @@ -1943,26 +1943,26 @@ static void oscar_set_away_aim(struct gaim_connection *gc, struct oscar_data *od errstr = g_strdup_printf("Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen); - do_error_dialog(gc, errstr, "Away Message Too Long"); + do_error_dialog(ic, errstr, "Away Message Too Long"); g_free(errstr); } - gc->away = g_strndup(message, od->rights.maxawaymsglen); - aim_bos_setprofile(od->sess, od->conn, NULL, gc->away, gaim_caps); + ic->away = g_strndup(message, od->rights.maxawaymsglen); + aim_bos_setprofile(od->sess, od->conn, NULL, ic->away, gaim_caps); return; } -static void oscar_set_away_icq(struct gaim_connection *gc, struct oscar_data *od, const char *state, const char *message) +static void oscar_set_away_icq(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message) { const char *msg = NULL; gboolean no_message = FALSE; /* clean old states */ - if (gc->away) { - g_free(gc->away); - gc->away = NULL; + if (ic->away) { + g_free(ic->away); + ic->away = NULL; } od->sess->aim_icq_state = 0; @@ -1978,33 +1978,33 @@ static void oscar_set_away_icq(struct gaim_connection *gc, struct oscar_data *od 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); - gc->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); - gc->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); - gc->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); - gc->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); - gc->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); - gc->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); - gc->away = g_strdup(msg); + ic->away = g_strdup(msg); od->sess->aim_icq_state = AIM_MTYPE_AUTOAWAY; } } @@ -2012,23 +2012,23 @@ static void oscar_set_away_icq(struct gaim_connection *gc, struct oscar_data *od return; } -static void oscar_set_away(struct gaim_connection *gc, char *state, char *message) +static void oscar_set_away(struct im_connection *ic, char *state, char *message) { - struct oscar_data *od = (struct oscar_data *)gc->proto_data; + struct oscar_data *od = (struct oscar_data *)ic->proto_data; - oscar_set_away_aim(gc, od, state, message); + oscar_set_away_aim(ic, od, state, message); if (od->icq) - oscar_set_away_icq(gc, od, state, message); + oscar_set_away_icq(ic, od, state, message); return; } -static void oscar_add_buddy(struct gaim_connection *g, char *name) { +static void oscar_add_buddy(struct im_connection *g, char *name, char *group) { struct oscar_data *odata = (struct oscar_data *)g->proto_data; aim_ssi_addbuddies(odata->sess, odata->conn, OSCAR_GROUP, &name, 1, 0); } -static void oscar_remove_buddy(struct gaim_connection *g, char *name, char *group) { +static void oscar_remove_buddy(struct im_connection *g, char *name, char *group) { struct oscar_data *odata = (struct oscar_data *)g->proto_data; struct aim_ssi_item *ssigroup; while ((ssigroup = aim_ssi_itemlist_findparent(odata->sess->ssi.items, name)) && !aim_ssi_delbuddies(odata->sess, odata->conn, ssigroup->name, &name, 1)); @@ -2039,7 +2039,7 @@ static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) { } static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { - struct gaim_connection *gc = sess->aux_data; + struct im_connection *ic = sess->aux_data; struct aim_ssi_item *curitem; int tmp; @@ -2048,13 +2048,13 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { for (curitem=sess->ssi.items; curitem; curitem=curitem->next) { switch (curitem->type) { case 0x0000: /* Buddy */ - if ((curitem->name) && (!find_buddy(gc, curitem->name))) { + if ((curitem->name) && (!find_buddy(ic, curitem->name))) { char *realname = NULL; if (curitem->data && aim_gettlv(curitem->data, 0x0131, 1)) realname = aim_gettlv_str(curitem->data, 0x0131, 1); - add_buddy(gc, NULL, curitem->name, realname); + add_buddy(ic, NULL, curitem->name, realname); if (realname) g_free(realname); @@ -2064,11 +2064,11 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { case 0x0002: /* Permit buddy */ if (curitem->name) { GSList *list; - for (list=gc->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); + for (list=ic->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); if (!list) { char *name; name = g_strdup(normalize(curitem->name)); - gc->permit = g_slist_append(gc->permit, name); + ic->permit = g_slist_append(ic->permit, name); tmp++; } } @@ -2077,11 +2077,11 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { case 0x0003: /* Deny buddy */ if (curitem->name) { GSList *list; - for (list=gc->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); + for (list=ic->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); if (!list) { char *name; name = g_strdup(normalize(curitem->name)); - gc->deny = g_slist_append(gc->deny, name); + ic->deny = g_slist_append(ic->deny, name); tmp++; } } @@ -2090,8 +2090,8 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { case 0x0004: /* Permit/deny setting */ if (curitem->data) { guint8 permdeny; - if ((permdeny = aim_ssi_getpermdeny(sess->ssi.items)) && (permdeny != gc->permdeny)) { - gc->permdeny = permdeny; + if ((permdeny = aim_ssi_getpermdeny(sess->ssi.items)) && (permdeny != ic->permdeny)) { + ic->permdeny = permdeny; tmp++; } } @@ -2109,7 +2109,7 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { aim_icq_reqofflinemsgs(sess); /* Now that we have a buddy list, we can tell BitlBee that we're online. */ - account_online(gc); + account_online(ic); return 1; } @@ -2154,22 +2154,22 @@ static int gaim_ssi_parseack( aim_session_t *sess, aim_frame_t *fr, ... ) return( 1 ); } -static void oscar_set_permit_deny(struct gaim_connection *gc) { - struct oscar_data *od = (struct oscar_data *)gc->proto_data; +static void oscar_set_permit_deny(struct im_connection *ic) { + struct oscar_data *od = (struct oscar_data *)ic->proto_data; if (od->icq) { GSList *list; char buf[MAXMSGLEN]; int at; - switch(gc->permdeny) { + switch(ic->permdeny) { case 1: - aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gc->username); + aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, ic->username); break; case 2: - aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gc->username); + aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, ic->username); break; case 3: - list = gc->permit; + list = ic->permit; at = 0; while (list) { at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); @@ -2178,7 +2178,7 @@ static void oscar_set_permit_deny(struct gaim_connection *gc) { aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); break; case 4: - list = gc->deny; + list = ic->deny; at = 0; while (list) { at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); @@ -2189,15 +2189,15 @@ static void oscar_set_permit_deny(struct gaim_connection *gc) { default: break; } - signoff_blocked(gc); + signoff_blocked(ic); } else { if (od->sess->ssi.received_data) - aim_ssi_setpermdeny(od->sess, od->conn, gc->permdeny, 0xffffffff); + aim_ssi_setpermdeny(od->sess, od->conn, ic->permdeny, 0xffffffff); } } -static void oscar_add_permit(struct gaim_connection *gc, char *who) { - struct oscar_data *od = (struct oscar_data *)gc->proto_data; +static void oscar_add_permit(struct im_connection *ic, char *who) { + struct oscar_data *od = (struct oscar_data *)ic->proto_data; if (od->icq) { aim_ssi_auth_reply(od->sess, od->conn, who, 1, ""); } else { @@ -2206,8 +2206,8 @@ static void oscar_add_permit(struct gaim_connection *gc, char *who) { } } -static void oscar_add_deny(struct gaim_connection *gc, char *who) { - struct oscar_data *od = (struct oscar_data *)gc->proto_data; +static void oscar_add_deny(struct im_connection *ic, char *who) { + struct oscar_data *od = (struct oscar_data *)ic->proto_data; if (od->icq) { aim_ssi_auth_reply(od->sess, od->conn, who, 0, ""); } else { @@ -2216,25 +2216,25 @@ static void oscar_add_deny(struct gaim_connection *gc, char *who) { } } -static void oscar_rem_permit(struct gaim_connection *gc, char *who) { - struct oscar_data *od = (struct oscar_data *)gc->proto_data; +static void oscar_rem_permit(struct im_connection *ic, char *who) { + struct oscar_data *od = (struct oscar_data *)ic->proto_data; if (!od->icq) { if (od->sess->ssi.received_data) aim_ssi_delpord(od->sess, od->conn, &who, 1, AIM_SSI_TYPE_PERMIT); } } -static void oscar_rem_deny(struct gaim_connection *gc, char *who) { - struct oscar_data *od = (struct oscar_data *)gc->proto_data; +static void oscar_rem_deny(struct im_connection *ic, char *who) { + struct oscar_data *od = (struct oscar_data *)ic->proto_data; if (!od->icq) { if (od->sess->ssi.received_data) aim_ssi_delpord(od->sess, od->conn, &who, 1, AIM_SSI_TYPE_DENY); } } -static GList *oscar_away_states(struct gaim_connection *gc) +static GList *oscar_away_states(struct im_connection *ic) { - struct oscar_data *od = gc->proto_data; + struct oscar_data *od = ic->proto_data; GList *m = NULL; if (!od->icq) @@ -2253,7 +2253,7 @@ static GList *oscar_away_states(struct gaim_connection *gc) static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...) { - struct gaim_connection *gc = sess->aux_data; + struct im_connection *ic = sess->aux_data; gchar who[16]; GString *str; va_list ap; @@ -2329,7 +2329,7 @@ static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...) g_string_sprintfa(str, "\n"); } - serv_got_crap(gc, "%s\n%s", _("User Info"), str->str); + serv_got_crap(ic, "%s\n%s", _("User Info"), str->str); g_string_free(str, TRUE); return 1; @@ -2394,7 +2394,7 @@ static char *oscar_encoding_to_utf8(char *encoding, char *text, int textlen) static int gaim_parseaiminfo(aim_session_t *sess, aim_frame_t *fr, ...) { - struct gaim_connection *gc = sess->aux_data; + struct im_connection *ic = sess->aux_data; va_list ap; aim_userinfo_t *userinfo; guint16 infotype; @@ -2423,18 +2423,18 @@ static int gaim_parseaiminfo(aim_session_t *sess, aim_frame_t *fr, ...) idletime.tm_min = userinfo->idletime % 60; idletime.tm_sec = 0; strftime(buff, 256, _("%d days %H hours %M minutes"), &idletime); - serv_got_crap(gc, "%s: %s", _("Idle Time"), buff); + serv_got_crap(ic, "%s: %s", _("Idle Time"), buff); } if(text) { utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length); - serv_got_crap(gc, "%s\n%s", _("User Info"), utf8); + serv_got_crap(ic, "%s\n%s", _("User Info"), utf8); } else { - serv_got_crap(gc, _("No user info available.")); + serv_got_crap(ic, _("No user info available.")); } } else if(infotype == AIM_GETINFO_AWAYMESSAGE && userinfo->flags & AIM_FLAG_AWAY) { utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length); - serv_got_crap(gc, "%s\n%s", _("Away Message"), utf8); + serv_got_crap(ic, "%s\n%s", _("Away Message"), utf8); } g_free(utf8); @@ -2444,7 +2444,7 @@ static int gaim_parseaiminfo(aim_session_t *sess, aim_frame_t *fr, ...) int gaim_parsemtn(aim_session_t *sess, aim_frame_t *fr, ...) { - struct gaim_connection * gc = sess->aux_data; + struct im_connection * ic = sess->aux_data; va_list ap; guint16 type1, type2; char * sn; @@ -2457,23 +2457,23 @@ int gaim_parsemtn(aim_session_t *sess, aim_frame_t *fr, ...) if(type2 == 0x0002) { /* User is typing */ - serv_got_typing(gc, sn, 0, 1); + serv_got_typing(ic, sn, 0, 1); } else if (type2 == 0x0001) { /* User has typed something, but is not actively typing (stale) */ - serv_got_typing(gc, sn, 0, 2); + serv_got_typing(ic, sn, 0, 2); } else { /* User has stopped typing */ - serv_got_typing(gc, sn, 0, 0); + serv_got_typing(ic, sn, 0, 0); } return 1; } -static char *oscar_get_status_string( struct gaim_connection *gc, int number ) +static char *oscar_get_status_string( struct im_connection *ic, int number ) { - struct oscar_data *od = gc->proto_data; + struct oscar_data *od = ic->proto_data; if( ! number & UC_UNAVAILABLE ) { @@ -2499,16 +2499,16 @@ static char *oscar_get_status_string( struct gaim_connection *gc, int number ) } } -int oscar_send_typing(struct gaim_connection *gc, char * who, int typing) +int oscar_send_typing(struct im_connection *ic, char * who, int typing) { - struct oscar_data *od = gc->proto_data; + struct oscar_data *od = ic->proto_data; return( aim_im_sendmtn(od->sess, 1, who, typing ? 0x0002 : 0x0000) ); } -int oscar_chat_send(struct conversation *c, char *message) +void oscar_chat_send(struct groupchat *c, char *message, int msgflags) { - struct gaim_connection *gc = c->gc; - struct oscar_data * od = (struct oscar_data*)gc->proto_data; + struct im_connection *ic = c->ic; + struct oscar_data * od = (struct oscar_data*)ic->proto_data; struct chat_connection * ccon; int ret; guint8 len = strlen(message); @@ -2549,22 +2549,22 @@ int oscar_chat_send(struct conversation *c, char *message) g_free(s); } - return (ret >= 0); +/* return (ret >= 0); */ } -void oscar_chat_invite(struct conversation *c, char *message, char *who) +void oscar_chat_invite(struct groupchat *c, char *message, char *who) { - struct gaim_connection *gc = c->gc; - struct oscar_data * od = (struct oscar_data *)gc->proto_data; + struct im_connection *ic = c->ic; + struct oscar_data * od = (struct oscar_data *)ic->proto_data; struct chat_connection *ccon = c->data; aim_chat_invite(od->sess, od->conn, who, message ? message : "", ccon->exchange, ccon->name, 0x0); } -void oscar_chat_kill(struct gaim_connection *gc, struct chat_connection *cc) +void oscar_chat_kill(struct im_connection *ic, struct chat_connection *cc) { - struct oscar_data *od = (struct oscar_data *)gc->proto_data; + struct oscar_data *od = (struct oscar_data *)ic->proto_data; /* Notify the conversation window that we've left the chat */ serv_got_chat_left(cc->cnv); @@ -2579,14 +2579,14 @@ void oscar_chat_kill(struct gaim_connection *gc, struct chat_connection *cc) g_free(cc); } -void oscar_chat_leave(struct conversation *c) +void oscar_chat_leave(struct groupchat *c) { - oscar_chat_kill(c->gc, c->data); + oscar_chat_kill(c->ic, c->data); } -int oscar_chat_join(struct gaim_connection * gc, char * name) +int oscar_chat_join(struct im_connection * ic, char * name) { - struct oscar_data * od = (struct oscar_data *)gc->proto_data; + struct oscar_data * od = (struct oscar_data *)ic->proto_data; aim_conn_t * cur; @@ -2604,16 +2604,16 @@ int oscar_chat_join(struct gaim_connection * gc, char * name) } } -struct conversation *oscar_chat_open(struct gaim_connection * gc, char *who) +struct groupchat *oscar_chat_with(struct im_connection * ic, char *who) { - struct oscar_data * od = (struct oscar_data *)gc->proto_data; + struct oscar_data * od = (struct oscar_data *)ic->proto_data; int ret; static int chat_id = 0; char * chatname; - chatname = g_strdup_printf("%s%d", gc->username, chat_id++); + chatname = g_strdup_printf("%s%d", ic->username, chat_id++); - ret = oscar_chat_join(gc, chatname); + ret = oscar_chat_join(ic, chatname); aim_chat_invite(od->sess, od->conn, who, "", 4, chatname, 0x0); @@ -2624,7 +2624,7 @@ struct conversation *oscar_chat_open(struct gaim_connection * gc, char *who) void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv) { - oscar_chat_join(inv->gc, inv->name); + oscar_chat_join(inv->ic, inv->name); g_free(inv->name); g_free(inv); } @@ -2635,14 +2635,15 @@ void oscar_reject_chat(gpointer w, struct aim_chat_invitation * inv) g_free(inv); } -void oscar_init() +void oscar_initmodule() { struct prpl *ret = g_new0(struct prpl, 1); ret->name = "oscar"; ret->away_states = oscar_away_states; + ret->init = oscar_init; ret->login = oscar_login; - ret->acc_init = oscar_acc_init; - ret->close = oscar_close; + ret->keepalive = oscar_keepalive; + ret->logout = oscar_logout; ret->send_im = oscar_send_im; ret->get_info = oscar_get_info; ret->set_away = oscar_set_away; @@ -2652,13 +2653,12 @@ void oscar_init() ret->chat_send = oscar_chat_send; ret->chat_invite = oscar_chat_invite; ret->chat_leave = oscar_chat_leave; - ret->chat_open = oscar_chat_open; + ret->chat_with = oscar_chat_with; ret->add_permit = oscar_add_permit; ret->add_deny = oscar_add_deny; ret->rem_permit = oscar_rem_permit; ret->rem_deny = oscar_rem_deny; ret->set_permit_deny = oscar_set_permit_deny; - ret->keepalive = oscar_keepalive; ret->get_status_string = oscar_get_status_string; ret->send_typing = oscar_send_typing; diff --git a/protocols/oscar/service.c b/protocols/oscar/service.c index d55e0987..2a3dd1fb 100644 --- a/protocols/oscar/service.c +++ b/protocols/oscar/service.c @@ -731,11 +731,11 @@ int aim_setextstatus(aim_session_t *sess, aim_conn_t *conn, guint32 status) aim_tlvlist_t *tl = NULL; guint32 data; int tlvlen; - struct gaim_connection *gc = sess ? sess->aux_data : NULL; + struct im_connection *ic = sess ? sess->aux_data : NULL; data = AIM_ICQ_STATE_HIDEIP | status; /* yay for error checking ;^) */ - if (gc && set_getbool(&gc->acc->set, "web_aware")) + if (ic && set_getbool(&ic->acc->set, "web_aware")) data |= AIM_ICQ_STATE_WEBAWARE; tlvlen = aim_addtlvtochain32(&tl, 0x0006, data); -- cgit v1.2.3 From aef4828a1dc51de10a43bb7dd5d023de9971295b Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 5 Apr 2007 22:20:31 -0700 Subject: More cleanups, mainly in the callbacks. Replaced things like do_error_dialog() and (set|hide)_login_progress(_error)?() with things that hopefully make more sense. Although it's still not really great... --- protocols/oscar/chat.c | 6 +-- protocols/oscar/chatnav.c | 10 ++-- protocols/oscar/icq.c | 2 +- protocols/oscar/im.c | 8 +-- protocols/oscar/info.c | 6 +-- protocols/oscar/oscar.c | 122 ++++++++++++++++++++-------------------------- protocols/oscar/rxqueue.c | 2 +- protocols/oscar/search.c | 2 +- protocols/oscar/service.c | 4 +- protocols/oscar/txqueue.c | 8 +-- 10 files changed, 78 insertions(+), 92 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/chat.c b/protocols/oscar/chat.c index df535c4f..82aa5421 100644 --- a/protocols/oscar/chat.c +++ b/protocols/oscar/chat.c @@ -53,7 +53,7 @@ aim_conn_t *aim_chat_getconn(aim_session_t *sess, const char *name) if (cur->type != AIM_CONN_TYPE_CHAT) continue; if (!cur->priv) { - do_error_dialog(sess->aux_data, "chat connection with no name!", "Gaim"); + imc_error(sess->aux_data, "chat connection with no name!"); continue; } @@ -396,7 +396,7 @@ static int infoupdate(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a detaillevel = aimbs_get8(bs); if (detaillevel != 0x02) { - do_error_dialog(sess->aux_data, "Only detaillevel 0x2 is support at the moment", "Gaim"); + imc_error(sess->aux_data, "Only detaillevel 0x2 is support at the moment"); return 1; } @@ -614,7 +614,7 @@ static int incomingmsg(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, channel = aimbs_get16(bs); if (channel != 0x0003) { - do_error_dialog(sess->aux_data, "unknown channel!", "Gaim"); + imc_error(sess->aux_data, "unknown channel!"); return 0; } diff --git a/protocols/oscar/chatnav.c b/protocols/oscar/chatnav.c index c7e11765..05fdf6fa 100644 --- a/protocols/oscar/chatnav.c +++ b/protocols/oscar/chatnav.c @@ -285,7 +285,7 @@ static int parseinfo_create(aim_session_t *sess, aim_module_t *mod, aim_frame_t tlvlist = aim_readtlvchain(bs); if (!(bigblock = aim_gettlv(tlvlist, 0x0004, 1))) { - do_error_dialog(sess->aux_data, "no bigblock in top tlv in create room response", "Gaim"); + imc_error(sess->aux_data, "no bigblock in top tlv in create room response"); aim_freetlvchain(&tlvlist); return 0; @@ -300,7 +300,7 @@ static int parseinfo_create(aim_session_t *sess, aim_module_t *mod, aim_frame_t detaillevel = aimbs_get8(&bbbs); if (detaillevel != 0x02) { - do_error_dialog(sess->aux_data, "unknown detaillevel in create room response", "Gaim"); + imc_error(sess->aux_data, "unknown detaillevel in create room response"); aim_freetlvchain(&tlvlist); g_free(ck); return 0; @@ -366,12 +366,12 @@ static int parseinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, ai int ret = 0; if (!(snac2 = aim_remsnac(sess, snac->id))) { - do_error_dialog(sess->aux_data, "received response to unknown request!", "Gaim"); + imc_error(sess->aux_data, "received response to unknown request!"); return 0; } if (snac2->family != 0x000d) { - do_error_dialog(sess->aux_data, "recieved response that maps to corrupt request!", "Gaim"); + imc_error(sess->aux_data, "recieved response that maps to corrupt request!"); return 0; } @@ -388,7 +388,7 @@ static int parseinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, ai else if (snac2->type == 0x0008) /* create room */ ret = parseinfo_create(sess, mod, rx, snac, bs, snac2); else - do_error_dialog(sess->aux_data, "unknown request subtype", "Gaim"); + imc_error(sess->aux_data, "unknown request subtype"); if (snac2) g_free(snac2->data); diff --git a/protocols/oscar/icq.c b/protocols/oscar/icq.c index 23959b75..d3c7c182 100644 --- a/protocols/oscar/icq.c +++ b/protocols/oscar/icq.c @@ -239,7 +239,7 @@ static int icqresponse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, if (!(tl = aim_readtlvchain(bs)) || !(datatlv = aim_gettlv(tl, 0x0001, 1))) { aim_freetlvchain(&tl); - do_error_dialog(sess->aux_data, "corrupt ICQ response\n", "Gaim"); + imc_error(sess->aux_data, "corrupt ICQ response\n"); return 0; } diff --git a/protocols/oscar/im.c b/protocols/oscar/im.c index bc2c2abe..ac3d08d4 100644 --- a/protocols/oscar/im.c +++ b/protocols/oscar/im.c @@ -936,7 +936,7 @@ static int outgoingim(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a channel = aimbs_get16(bs); if (channel != 0x01) { - do_error_dialog(sess->aux_data, "icbm: ICBM recieved on unsupported channel. Ignoring.", "Gaim"); + imc_error(sess->aux_data, "icbm: ICBM recieved on unsupported channel. Ignoring."); return 0; } @@ -1344,7 +1344,7 @@ static int incomingim_ch1(aim_session_t *sess, aim_module_t *mod, aim_frame_t *r args.extdata = aimbs_getraw(bs, args.extdatalen); } else { - // do_error_dialog(sess->aux_data, "Unknown TLV encountered", "Gaim"); + // imc_error(sess->aux_data, "Unknown TLV encountered"); } /* @@ -1516,7 +1516,7 @@ static int incomingim_ch2(aim_session_t *sess, aim_module_t *mod, aim_frame_t *r */ cookie2 = aimbs_getraw(&bbs, 8); if (memcmp(cookie, cookie2, 8) != 0) - do_error_dialog(sess->aux_data, "rend: warning cookies don't match!", "Gaim"); + imc_error(sess->aux_data, "rend: warning cookies don't match!"); memcpy(args.cookie, cookie2, 8); g_free(cookie2); @@ -1782,7 +1782,7 @@ static int incomingim(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a } else { - do_error_dialog(sess->aux_data, "ICBM received on an unsupported channel. Ignoring.", "Gaim"); + imc_error(sess->aux_data, "ICBM received on an unsupported channel. Ignoring."); return 0; } diff --git a/protocols/oscar/info.c b/protocols/oscar/info.c index 0f1bcfd2..d1ed2059 100644 --- a/protocols/oscar/info.c +++ b/protocols/oscar/info.c @@ -473,7 +473,7 @@ int aim_extractuserinfo(aim_session_t *sess, aim_bstream_t *bs, aim_userinfo_t * * */ #ifdef DEBUG - // do_error_dialog(sess->aux_data, G_STRLOC, "Unknown TLV encountered"); + // imc_error(sess->aux_data, G_STRLOC); #endif } @@ -634,7 +634,7 @@ static int userinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim origsnac = aim_remsnac(sess, snac->id); if (!origsnac || !origsnac->data) { - do_error_dialog(sess->aux_data, "major problem: no snac stored!", "Gaim"); + imc_error(sess->aux_data, "major problem: no snac stored!"); return 0; } @@ -643,7 +643,7 @@ static int userinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim if ((inforeq->infotype != AIM_GETINFO_GENERALINFO) && (inforeq->infotype != AIM_GETINFO_AWAYMESSAGE) && (inforeq->infotype != AIM_GETINFO_CAPABILITIES)) { - do_error_dialog(sess->aux_data, "unknown infotype in request!", "Gaim"); + imc_error(sess->aux_data, "unknown infotype in request!"); return 0; } diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index d2c6af1e..929b63d3 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -262,23 +262,21 @@ static gboolean oscar_callback(gpointer data, gint source, if (aim_get_command(odata->sess, conn) >= 0) { aim_rxdispatch(odata->sess); if (odata->killme) - signoff(ic); + imc_logout(ic); } else { if ((conn->type == AIM_CONN_TYPE_BOS) || !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) { - hide_login_progress_error(ic, _("Disconnected.")); - signoff(ic); + imc_error(ic, _("Disconnected.")); + imc_logout(ic); } else if (conn->type == AIM_CONN_TYPE_CHAT) { struct chat_connection *c = find_oscar_chat_by_conn(ic, conn); - char buf[BUF_LONG]; c->conn = NULL; if (c->inpa > 0) b_event_remove(c->inpa); c->inpa = 0; c->fd = -1; aim_conn_kill(odata->sess, &conn); - sprintf(buf, _("You have been disconnected from chat room %s."), c->name); - do_error_dialog(sess->aux_data, buf, _("Chat Error!")); + imc_error(sess->aux_data, _("You have been disconnected from chat room %s."), c->name); } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { if (odata->cnpa > 0) b_event_remove(odata->cnpa); @@ -289,8 +287,7 @@ static gboolean oscar_callback(gpointer data, gint source, odata->create_rooms = g_slist_remove(odata->create_rooms, cr); g_free(cr); - do_error_dialog(sess->aux_data, _("Chat is currently unavailable"), - _("Gaim - Chat")); + imc_error(sess->aux_data, _("Chat is currently unavailable")); } aim_conn_kill(odata->sess, &conn); } else if (conn->type == AIM_CONN_TYPE_AUTH) { @@ -327,8 +324,8 @@ static gboolean oscar_login_connect(gpointer data, gint source, b_input_conditio conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); if (source < 0) { - hide_login_progress(ic, _("Couldn't connect to host")); - signoff(ic); + imc_error(ic, _("Couldn't connect to host")); + imc_logout(ic); return FALSE; } @@ -355,8 +352,7 @@ static void oscar_init(account_t *acc) static void oscar_login(account_t *acc) { aim_session_t *sess; aim_conn_t *conn; - char buf[256]; - struct im_connection *ic = new_gaim_conn(acc); + struct im_connection *ic = imc_new(acc); struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1); if (isdigit(acc->user[0])) { @@ -381,24 +377,23 @@ static void oscar_login(account_t *acc) { conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); if (conn == NULL) { - hide_login_progress(ic, _("Unable to login to AIM")); - signoff(ic); + imc_error(ic, _("Unable to login to AIM")); + imc_logout(ic); return; } if (acc->server == NULL) { - hide_login_progress(ic, "No servername specified"); - signoff(ic); + imc_error(ic, "No servername specified"); + imc_logout(ic); return; } if (g_strcasecmp(acc->server, "login.icq.com") != 0 && g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) { - serv_got_crap(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); + imc_log(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); } - g_snprintf(buf, sizeof(buf), _("Signon: %s"), ic->username); - set_login_progress(ic, 2, buf); + imc_log(ic, _("Signon: %s"), ic->username); aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); @@ -406,8 +401,8 @@ static void oscar_login(account_t *acc) { conn->status |= AIM_CONN_STATUS_INPROGRESS; conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic); if (conn->fd < 0) { - hide_login_progress(ic, _("Couldn't connect to host")); - signoff(ic); + imc_error(ic, _("Couldn't connect to host")); + imc_logout(ic); return; } aim_request_login(sess, conn, ic->username); @@ -466,15 +461,15 @@ static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition bosconn = odata->conn; if (source < 0) { - hide_login_progress(ic, _("Could Not Connect")); - signoff(ic); + imc_error(ic, _("Could Not Connect")); + imc_logout(ic); return FALSE; } aim_conn_completeconnect(sess, bosconn); ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); - set_login_progress(ic, 4, _("Connection established, cookie sent")); + imc_log(ic, _("Connection established, cookie sent")); return FALSE; } @@ -497,23 +492,23 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { switch (info->errorcode) { case 0x05: /* Incorrect nick/password */ - hide_login_progress(ic, _("Incorrect nickname or password.")); + imc_error(ic, _("Incorrect nickname or password.")); // plugin_event(event_error, (void *)980, 0, 0, 0); break; case 0x11: /* Suspended account */ - hide_login_progress(ic, _("Your account is currently suspended.")); + imc_error(ic, _("Your account is currently suspended.")); break; case 0x18: /* connecting too frequently */ - hide_login_progress(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.")); + imc_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: /* client too old */ - hide_login_progress(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE)); + imc_error(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE)); break; default: - hide_login_progress(ic, _("Authentication Failed")); + imc_error(ic, _("Authentication Failed")); break; } od->killme = TRUE; @@ -525,7 +520,7 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); if (bosconn == NULL) { - hide_login_progress(ic, _("Internal Error")); + imc_error(ic, _("Internal Error")); od->killme = TRUE; return 0; } @@ -571,7 +566,7 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { bosconn->fd = proxy_connect(host, port, oscar_bos_connect, ic); g_free(host); if (bosconn->fd < 0) { - hide_login_progress(ic, _("Could Not Connect")); + imc_error(ic, _("Could Not Connect")); od->killme = TRUE; return 0; } @@ -609,8 +604,8 @@ static gboolean damn_you(gpointer data, gint source, b_input_condition c) in = '\0'; } if (in != '\n') { - do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." - " You may be disconnected shortly.", "Login Error"); + imc_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." + " You may be disconnected shortly."); b_event_remove(pos->inpa); closesocket(pos->fd); g_free(pos); @@ -632,8 +627,8 @@ static gboolean straight_to_hell(gpointer data, gint source, b_input_condition c char buf[BUF_LONG]; if (source < 0) { - do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." - " You may be disconnected shortly.", "Login Error"); + imc_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." + " You may be disconnected shortly."); if (pos->modname) g_free(pos->modname); g_free(pos); @@ -710,8 +705,8 @@ int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) { if (pos->modname) g_free(pos->modname); g_free(pos); - do_error_dialog(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM." - " You may be disconnected shortly.", "Login Error"); + imc_error(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM." + " You may be disconnected shortly."); } pos->fd = fd; @@ -1209,11 +1204,11 @@ static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ } break; case 0x0007: { /* Someone has denied you authorization */ - serv_got_crap(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") ); + imc_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") ); } break; case 0x0008: { /* Someone has granted you authorization */ - serv_got_crap(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") ); + imc_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") ); } break; case 0x0012: { @@ -1338,7 +1333,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { userinfo->sn); break; } - do_error_dialog(sess->aux_data, buf, _("Gaim - Error")); + imc_error(sess->aux_data, buf); return 1; } @@ -1346,16 +1341,13 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; guint16 reason; - char *m; va_start(ap, fr); reason = (guint16)va_arg(ap, unsigned int); va_end(ap); - m = g_strdup_printf(_("SNAC threw error: %s\n"), - reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error"); - do_error_dialog(sess->aux_data, m, _("Gaim - Oscar SNAC Error")); - g_free(m); + imc_error(sess->aux_data, _("SNAC threw error: %s"), + reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error"); return 1; } @@ -1364,16 +1356,14 @@ static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; char *destn; guint16 reason; - char buf[1024]; va_start(ap, fr); reason = (guint16)va_arg(ap, unsigned int); destn = va_arg(ap, char *); va_end(ap); - sprintf(buf, _("Your message to %s did not get sent: %s"), destn, + imc_error(sess->aux_data, _("Your message to %s did not get sent: %s"), destn, (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown")); - do_error_dialog(sess->aux_data, buf, _("Gaim - Error")); return 1; } @@ -1382,17 +1372,14 @@ static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; char *destn; guint16 reason; - char buf[1024]; va_start(ap, fr); reason = (guint16)va_arg(ap, unsigned int); destn = va_arg(ap, char *); va_end(ap); - sprintf(buf, _("User information for %s unavailable: %s"), destn, + imc_error(sess->aux_data, _("User information for %s unavailable: %s"), destn, (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown")); - do_error_dialog(sess->aux_data, buf, _("Gaim - Error")); - return 1; } @@ -1408,8 +1395,7 @@ static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { va_end(ap); if (id < 4) - do_error_dialog(sess->aux_data, _("Your connection may be lost."), - _("AOL error")); + imc_error(sess->aux_data, _("Your connection may be lost.")); return 1; } @@ -1603,8 +1589,8 @@ static int gaim_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...) { } else if (code == AIM_RATE_CODE_WARNING) { aim_conn_setlatency(fr->conn, windowsize/4); } else if (code == AIM_RATE_CODE_LIMIT) { - do_error_dialog(sess->aux_data, _("The last message was not sent because you are over the rate limit. " - "Please wait 10 seconds and try again."), _("Gaim - Error")); + imc_error(sess->aux_data, _("The last message was not sent because you are over the rate limit. " + "Please wait 10 seconds and try again.")); aim_conn_setlatency(fr->conn, windowsize/2); } else if (code == AIM_RATE_CODE_CLEARLIMIT) { aim_conn_setlatency(fr->conn, 0); @@ -1808,11 +1794,11 @@ static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) { } break; case 0x0007: { /* Someone has denied you authorization */ - serv_got_crap(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") ); + imc_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") ); } break; case 0x0008: { /* Someone has granted you authorization */ - serv_got_crap(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") ); + imc_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") ); } break; case 0x0012: { @@ -1925,7 +1911,7 @@ static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, } /* else... */ if (od->rights.maxawaymsglen == 0) - do_error_dialog(ic, "oscar_set_away_aim called before locate rights received", "Protocol Error"); + imc_error(ic, "oscar_set_away_aim called before locate rights received"); aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); @@ -1943,7 +1929,7 @@ static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, errstr = g_strdup_printf("Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen); - do_error_dialog(ic, errstr, "Away Message Too Long"); + imc_error(ic, errstr); g_free(errstr); } @@ -2109,7 +2095,7 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { aim_icq_reqofflinemsgs(sess); /* Now that we have a buddy list, we can tell BitlBee that we're online. */ - account_online(ic); + imc_connected(ic); return 1; } @@ -2131,7 +2117,7 @@ static int gaim_ssi_parseack( aim_session_t *sess, aim_frame_t *fr, ... ) if( count & 1 ) { /* Hmm, the length should be even... */ - do_error_dialog( sess->aux_data, "Received SSI ACK package with non-even length", "Gaim - Error" ); + imc_error( sess->aux_data, "Received SSI ACK package with non-even length"); return( 0 ); } count >>= 1; @@ -2142,7 +2128,7 @@ static int gaim_ssi_parseack( aim_session_t *sess, aim_frame_t *fr, ... ) st = aimbs_get16( &fr->data ); if( st == 0x0E ) { - serv_got_crap( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list ); + imc_log( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list ); aim_ssi_auth_request( sess, fr->conn, list, "" ); aim_ssi_addbuddies( sess, fr->conn, OSCAR_GROUP, &list, 1, 1 ); @@ -2329,7 +2315,7 @@ static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...) g_string_sprintfa(str, "\n"); } - serv_got_crap(ic, "%s\n%s", _("User Info"), str->str); + imc_log(ic, "%s\n%s", _("User Info"), str->str); g_string_free(str, TRUE); return 1; @@ -2423,18 +2409,18 @@ static int gaim_parseaiminfo(aim_session_t *sess, aim_frame_t *fr, ...) idletime.tm_min = userinfo->idletime % 60; idletime.tm_sec = 0; strftime(buff, 256, _("%d days %H hours %M minutes"), &idletime); - serv_got_crap(ic, "%s: %s", _("Idle Time"), buff); + imc_log(ic, "%s: %s", _("Idle Time"), buff); } if(text) { utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length); - serv_got_crap(ic, "%s\n%s", _("User Info"), utf8); + imc_log(ic, "%s\n%s", _("User Info"), utf8); } else { - serv_got_crap(ic, _("No user info available.")); + imc_log(ic, _("No user info available.")); } } else if(infotype == AIM_GETINFO_AWAYMESSAGE && userinfo->flags & AIM_FLAG_AWAY) { utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length); - serv_got_crap(ic, "%s\n%s", _("Away Message"), utf8); + imc_log(ic, "%s\n%s", _("Away Message"), utf8); } g_free(utf8); diff --git a/protocols/oscar/rxqueue.c b/protocols/oscar/rxqueue.c index 6e8dd29c..b5a83be8 100644 --- a/protocols/oscar/rxqueue.c +++ b/protocols/oscar/rxqueue.c @@ -391,7 +391,7 @@ int aim_get_command(aim_session_t *sess, aim_conn_t *conn) aim_bstream_rewind(&flaphdr); start = aimbs_get8(&flaphdr); - do_error_dialog(sess->aux_data, "FLAP framing disrupted", "Gaim"); + imc_error(sess->aux_data, "FLAP framing disrupted"); aim_conn_close(conn); return -1; } diff --git a/protocols/oscar/search.c b/protocols/oscar/search.c index 9685a3d1..c557e35f 100644 --- a/protocols/oscar/search.c +++ b/protocols/oscar/search.c @@ -38,7 +38,7 @@ static int error(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_mo /* XXX the modules interface should have already retrieved this for us */ if (!(snac2 = aim_remsnac(sess, snac->id))) { - do_error_dialog(sess->aux_data, "couldn't get snac", "Gaim"); + imc_error(sess->aux_data, "couldn't get snac"); return 0; } diff --git a/protocols/oscar/service.c b/protocols/oscar/service.c index 2a3dd1fb..69d53d00 100644 --- a/protocols/oscar/service.c +++ b/protocols/oscar/service.c @@ -566,7 +566,7 @@ static int migrate(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_ group = aimbs_get16(bs); - do_error_dialog(sess->aux_data, "bifurcated migration unsupported", "Gaim"); + imc_error(sess->aux_data, "bifurcated migration unsupported"); } tl = aim_readtlvchain(bs); @@ -893,7 +893,7 @@ int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, guint32 offset, guin aimbs_put32(&fr->data, 0xecf8427e); */ } else - do_error_dialog(sess->aux_data, "WARNING: unknown hash request", "Gaim"); + imc_error(sess->aux_data, "WARNING: unknown hash request"); } diff --git a/protocols/oscar/txqueue.c b/protocols/oscar/txqueue.c index 6b4854c5..bd8db49d 100644 --- a/protocols/oscar/txqueue.c +++ b/protocols/oscar/txqueue.c @@ -29,7 +29,7 @@ aim_frame_t *aim_tx_new(aim_session_t *sess, aim_conn_t *conn, guint8 framing, g aim_frame_t *fr; if (!conn) { - do_error_dialog(sess->aux_data, "no connection specified", "Gaim"); + imc_error(sess->aux_data, "no connection specified"); return NULL; } @@ -45,7 +45,7 @@ aim_frame_t *aim_tx_new(aim_session_t *sess, aim_conn_t *conn, guint8 framing, g fr->hdr.flap.type = chan; } else - do_error_dialog(sess->aux_data, "unknown framing", "Gaim"); + imc_error(sess->aux_data, "unknown framing"); if (datalen > 0) { guint8 *data; @@ -79,7 +79,7 @@ static int aim_tx_enqueue__queuebased(aim_session_t *sess, aim_frame_t *fr) { if (!fr->conn) { - do_error_dialog(sess->aux_data, "WARNING: enqueueing packet with no connection", "Gaim"); + imc_error(sess->aux_data, "WARNING: enqueueing packet with no connection"); fr->conn = aim_getconn_type(sess, AIM_CONN_TYPE_BOS); } @@ -119,7 +119,7 @@ static int aim_tx_enqueue__immediate(aim_session_t *sess, aim_frame_t *fr) { if (!fr->conn) { - do_error_dialog(sess->aux_data, "packet has no connection", "Gaim"); + imc_error(sess->aux_data, "packet has no connection"); aim_frame_destroy(fr); return 0; } -- cgit v1.2.3 From cd4723c257f9f7bd8d4a46c6562f93c2aefc3dbb Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 15 Apr 2007 14:59:52 -0700 Subject: More format string problems. --- protocols/oscar/oscar.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 929b63d3..abc2f4be 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -1263,7 +1263,6 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; guint16 chan, nummissed, reason; aim_userinfo_t *userinfo; - char buf[1024]; va_start(ap, fr); chan = (guint16)va_arg(ap, unsigned int); @@ -1275,8 +1274,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { switch(reason) { case 0: /* Invalid (0) */ - g_snprintf(buf, - sizeof(buf), + imc_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s because it was invalid.") : _("You missed %d messages from %s because they were invalid."), @@ -1285,8 +1283,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { break; case 1: /* Message too large */ - g_snprintf(buf, - sizeof(buf), + imc_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s because it was too large.") : _("You missed %d messages from %s because they were too large."), @@ -1295,8 +1292,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { break; case 2: /* Rate exceeded */ - g_snprintf(buf, - sizeof(buf), + imc_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s because the rate limit has been exceeded.") : _("You missed %d messages from %s because the rate limit has been exceeded."), @@ -1305,8 +1301,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { break; case 3: /* Evil Sender */ - g_snprintf(buf, - sizeof(buf), + imc_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s because it was too evil.") : _("You missed %d messages from %s because they are too evil."), @@ -1315,8 +1310,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { break; case 4: /* Evil Receiver */ - g_snprintf(buf, - sizeof(buf), + imc_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s because you are too evil.") : _("You missed %d messages from %s because you are too evil."), @@ -1324,8 +1318,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { userinfo->sn); break; default: - g_snprintf(buf, - sizeof(buf), + imc_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s for unknown reasons.") : _("You missed %d messages from %s for unknown reasons."), @@ -1333,7 +1326,6 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { userinfo->sn); break; } - imc_error(sess->aux_data, buf); return 1; } @@ -1925,13 +1917,7 @@ static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, } if (strlen(message) > od->rights.maxawaymsglen) { - gchar *errstr; - - errstr = g_strdup_printf("Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen); - - imc_error(ic, errstr); - - g_free(errstr); + imc_error(ic, "Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen); } ic->away = g_strndup(message, od->rights.maxawaymsglen); -- cgit v1.2.3 From c2fb38096ea4e75a680e57e103d4a4986aa84c75 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 15 Apr 2007 15:39:35 -0700 Subject: Cleaned up struct im_connection. No more username/password stuff since it's in acc too. wants_to_die is now an argument to imc_logout(). --- protocols/oscar/oscar.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index abc2f4be..d95c7068 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -262,12 +262,12 @@ 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); + imc_logout(ic, TRUE); } else { if ((conn->type == AIM_CONN_TYPE_BOS) || !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) { imc_error(ic, _("Disconnected.")); - imc_logout(ic); + imc_logout(ic, TRUE); } else if (conn->type == AIM_CONN_TYPE_CHAT) { struct chat_connection *c = find_oscar_chat_by_conn(ic, conn); c->conn = NULL; @@ -325,7 +325,7 @@ static gboolean oscar_login_connect(gpointer data, gint source, b_input_conditio if (source < 0) { imc_error(ic, _("Couldn't connect to host")); - imc_logout(ic); + imc_logout(ic, TRUE); return FALSE; } @@ -360,7 +360,9 @@ static void oscar_login(account_t *acc) { /* This is odd but it's necessary for a proper do_import and do_export. We don't do those anymore, but let's stick with it, just in case it accidentally fixes something else too... */ - ic->password[8] = 0; + /* ic->acc->pass[8] = 0; + Not touching this anymore now that it belongs to account_t! + Let's hope nothing will break. ;-) */ } else { ic->flags |= OPT_CONN_HTML; } @@ -378,13 +380,13 @@ static void oscar_login(account_t *acc) { conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); if (conn == NULL) { imc_error(ic, _("Unable to login to AIM")); - imc_logout(ic); + imc_logout(ic, TRUE); return; } if (acc->server == NULL) { imc_error(ic, "No servername specified"); - imc_logout(ic); + imc_logout(ic, FALSE); return; } @@ -393,7 +395,7 @@ static void oscar_login(account_t *acc) { imc_log(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); } - imc_log(ic, _("Signon: %s"), ic->username); + imc_log(ic, _("Signon: %s"), ic->acc->user); aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); @@ -402,10 +404,10 @@ static void oscar_login(account_t *acc) { conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic); if (conn->fd < 0) { imc_error(ic, _("Couldn't connect to host")); - imc_logout(ic); + imc_logout(ic, TRUE); return; } - aim_request_login(sess, conn, ic->username); + aim_request_login(sess, conn, ic->acc->user); } static void oscar_logout(struct im_connection *ic) { @@ -462,7 +464,7 @@ static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition if (source < 0) { imc_error(ic, _("Could Not Connect")); - imc_logout(ic); + imc_logout(ic, TRUE); return FALSE; } @@ -727,7 +729,7 @@ static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { key = va_arg(ap, char *); va_end(ap); - aim_send_login(sess, fr->conn, ic->username, ic->password, &info, key); + aim_send_login(sess, fr->conn, ic->acc->user, ic->acc->pass, &info, key); return 1; } @@ -1012,7 +1014,7 @@ static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) signon = time(NULL) - info->sessionlen; - tmp = g_strdup(normalize(ic->username)); + tmp = g_strdup(normalize(ic->acc->user)); if (!strcmp(tmp, normalize(info->sn))) g_snprintf(ic->displayname, sizeof(ic->displayname), "%s", info->sn); g_free(tmp); @@ -2135,10 +2137,10 @@ static void oscar_set_permit_deny(struct im_connection *ic) { switch(ic->permdeny) { case 1: - aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, ic->username); + aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, ic->acc->user); break; case 2: - aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, ic->username); + aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, ic->acc->user); break; case 3: list = ic->permit; @@ -2161,7 +2163,6 @@ static void oscar_set_permit_deny(struct im_connection *ic) { default: break; } - signoff_blocked(ic); } else { if (od->sess->ssi.received_data) aim_ssi_setpermdeny(od->sess, od->conn, ic->permdeny, 0xffffffff); @@ -2583,7 +2584,7 @@ struct groupchat *oscar_chat_with(struct im_connection * ic, char *who) static int chat_id = 0; char * chatname; - chatname = g_strdup_printf("%s%d", ic->username, chat_id++); + chatname = g_strdup_printf("%s%d", ic->acc->user, chat_id++); ret = oscar_chat_join(ic, chatname); -- cgit v1.2.3 From 84b045d409f1e8da6d8bf379c6fef7236dcd9bcd Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 15 Apr 2007 18:03:08 -0700 Subject: s/imc/imcb/ for callback functions. Moved things aroundin nogaim.h a little bit, grouping things by category instead of original Gaim 0.58 filename. --- protocols/oscar/chat.c | 6 +-- protocols/oscar/chatnav.c | 10 ++--- protocols/oscar/icq.c | 2 +- protocols/oscar/im.c | 8 ++-- protocols/oscar/info.c | 6 +-- protocols/oscar/oscar.c | 100 +++++++++++++++++++++++----------------------- protocols/oscar/rxqueue.c | 2 +- protocols/oscar/search.c | 2 +- protocols/oscar/service.c | 4 +- protocols/oscar/txqueue.c | 8 ++-- 10 files changed, 74 insertions(+), 74 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/chat.c b/protocols/oscar/chat.c index 82aa5421..fbf45693 100644 --- a/protocols/oscar/chat.c +++ b/protocols/oscar/chat.c @@ -53,7 +53,7 @@ aim_conn_t *aim_chat_getconn(aim_session_t *sess, const char *name) if (cur->type != AIM_CONN_TYPE_CHAT) continue; if (!cur->priv) { - imc_error(sess->aux_data, "chat connection with no name!"); + imcb_error(sess->aux_data, "chat connection with no name!"); continue; } @@ -396,7 +396,7 @@ static int infoupdate(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a detaillevel = aimbs_get8(bs); if (detaillevel != 0x02) { - imc_error(sess->aux_data, "Only detaillevel 0x2 is support at the moment"); + imcb_error(sess->aux_data, "Only detaillevel 0x2 is support at the moment"); return 1; } @@ -614,7 +614,7 @@ static int incomingmsg(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, channel = aimbs_get16(bs); if (channel != 0x0003) { - imc_error(sess->aux_data, "unknown channel!"); + imcb_error(sess->aux_data, "unknown channel!"); return 0; } diff --git a/protocols/oscar/chatnav.c b/protocols/oscar/chatnav.c index 05fdf6fa..d94d3c7b 100644 --- a/protocols/oscar/chatnav.c +++ b/protocols/oscar/chatnav.c @@ -285,7 +285,7 @@ static int parseinfo_create(aim_session_t *sess, aim_module_t *mod, aim_frame_t tlvlist = aim_readtlvchain(bs); if (!(bigblock = aim_gettlv(tlvlist, 0x0004, 1))) { - imc_error(sess->aux_data, "no bigblock in top tlv in create room response"); + imcb_error(sess->aux_data, "no bigblock in top tlv in create room response"); aim_freetlvchain(&tlvlist); return 0; @@ -300,7 +300,7 @@ static int parseinfo_create(aim_session_t *sess, aim_module_t *mod, aim_frame_t detaillevel = aimbs_get8(&bbbs); if (detaillevel != 0x02) { - imc_error(sess->aux_data, "unknown detaillevel in create room response"); + imcb_error(sess->aux_data, "unknown detaillevel in create room response"); aim_freetlvchain(&tlvlist); g_free(ck); return 0; @@ -366,12 +366,12 @@ static int parseinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, ai int ret = 0; if (!(snac2 = aim_remsnac(sess, snac->id))) { - imc_error(sess->aux_data, "received response to unknown request!"); + imcb_error(sess->aux_data, "received response to unknown request!"); return 0; } if (snac2->family != 0x000d) { - imc_error(sess->aux_data, "recieved response that maps to corrupt request!"); + imcb_error(sess->aux_data, "recieved response that maps to corrupt request!"); return 0; } @@ -388,7 +388,7 @@ static int parseinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, ai else if (snac2->type == 0x0008) /* create room */ ret = parseinfo_create(sess, mod, rx, snac, bs, snac2); else - imc_error(sess->aux_data, "unknown request subtype"); + imcb_error(sess->aux_data, "unknown request subtype"); if (snac2) g_free(snac2->data); diff --git a/protocols/oscar/icq.c b/protocols/oscar/icq.c index d3c7c182..f7c02e04 100644 --- a/protocols/oscar/icq.c +++ b/protocols/oscar/icq.c @@ -239,7 +239,7 @@ static int icqresponse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, if (!(tl = aim_readtlvchain(bs)) || !(datatlv = aim_gettlv(tl, 0x0001, 1))) { aim_freetlvchain(&tl); - imc_error(sess->aux_data, "corrupt ICQ response\n"); + imcb_error(sess->aux_data, "corrupt ICQ response\n"); return 0; } diff --git a/protocols/oscar/im.c b/protocols/oscar/im.c index ac3d08d4..51d8ec74 100644 --- a/protocols/oscar/im.c +++ b/protocols/oscar/im.c @@ -936,7 +936,7 @@ static int outgoingim(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a channel = aimbs_get16(bs); if (channel != 0x01) { - imc_error(sess->aux_data, "icbm: ICBM recieved on unsupported channel. Ignoring."); + imcb_error(sess->aux_data, "icbm: ICBM recieved on unsupported channel. Ignoring."); return 0; } @@ -1344,7 +1344,7 @@ static int incomingim_ch1(aim_session_t *sess, aim_module_t *mod, aim_frame_t *r args.extdata = aimbs_getraw(bs, args.extdatalen); } else { - // imc_error(sess->aux_data, "Unknown TLV encountered"); + // imcb_error(sess->aux_data, "Unknown TLV encountered"); } /* @@ -1516,7 +1516,7 @@ static int incomingim_ch2(aim_session_t *sess, aim_module_t *mod, aim_frame_t *r */ cookie2 = aimbs_getraw(&bbs, 8); if (memcmp(cookie, cookie2, 8) != 0) - imc_error(sess->aux_data, "rend: warning cookies don't match!"); + imcb_error(sess->aux_data, "rend: warning cookies don't match!"); memcpy(args.cookie, cookie2, 8); g_free(cookie2); @@ -1782,7 +1782,7 @@ static int incomingim(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a } else { - imc_error(sess->aux_data, "ICBM received on an unsupported channel. Ignoring."); + imcb_error(sess->aux_data, "ICBM received on an unsupported channel. Ignoring."); return 0; } diff --git a/protocols/oscar/info.c b/protocols/oscar/info.c index d1ed2059..7cc1dbbc 100644 --- a/protocols/oscar/info.c +++ b/protocols/oscar/info.c @@ -473,7 +473,7 @@ int aim_extractuserinfo(aim_session_t *sess, aim_bstream_t *bs, aim_userinfo_t * * */ #ifdef DEBUG - // imc_error(sess->aux_data, G_STRLOC); + // imcb_error(sess->aux_data, G_STRLOC); #endif } @@ -634,7 +634,7 @@ static int userinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim origsnac = aim_remsnac(sess, snac->id); if (!origsnac || !origsnac->data) { - imc_error(sess->aux_data, "major problem: no snac stored!"); + imcb_error(sess->aux_data, "major problem: no snac stored!"); return 0; } @@ -643,7 +643,7 @@ static int userinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim if ((inforeq->infotype != AIM_GETINFO_GENERALINFO) && (inforeq->infotype != AIM_GETINFO_AWAYMESSAGE) && (inforeq->infotype != AIM_GETINFO_CAPABILITIES)) { - imc_error(sess->aux_data, "unknown infotype in request!"); + imcb_error(sess->aux_data, "unknown infotype in request!"); return 0; } diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index d95c7068..99f839e4 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -266,7 +266,7 @@ static gboolean oscar_callback(gpointer data, gint source, } else { if ((conn->type == AIM_CONN_TYPE_BOS) || !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) { - imc_error(ic, _("Disconnected.")); + imcb_error(ic, _("Disconnected.")); imc_logout(ic, TRUE); } else if (conn->type == AIM_CONN_TYPE_CHAT) { struct chat_connection *c = find_oscar_chat_by_conn(ic, conn); @@ -276,7 +276,7 @@ static gboolean oscar_callback(gpointer data, gint source, c->inpa = 0; c->fd = -1; aim_conn_kill(odata->sess, &conn); - imc_error(sess->aux_data, _("You have been disconnected from chat room %s."), c->name); + imcb_error(sess->aux_data, _("You have been disconnected from chat room %s."), c->name); } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { if (odata->cnpa > 0) b_event_remove(odata->cnpa); @@ -287,7 +287,7 @@ static gboolean oscar_callback(gpointer data, gint source, odata->create_rooms = g_slist_remove(odata->create_rooms, cr); g_free(cr); - imc_error(sess->aux_data, _("Chat is currently unavailable")); + imcb_error(sess->aux_data, _("Chat is currently unavailable")); } aim_conn_kill(odata->sess, &conn); } else if (conn->type == AIM_CONN_TYPE_AUTH) { @@ -324,7 +324,7 @@ static gboolean oscar_login_connect(gpointer data, gint source, b_input_conditio conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); if (source < 0) { - imc_error(ic, _("Couldn't connect to host")); + imcb_error(ic, _("Couldn't connect to host")); imc_logout(ic, TRUE); return FALSE; } @@ -352,7 +352,7 @@ static void oscar_init(account_t *acc) static void oscar_login(account_t *acc) { aim_session_t *sess; aim_conn_t *conn; - struct im_connection *ic = imc_new(acc); + struct im_connection *ic = imcb_new(acc); struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1); if (isdigit(acc->user[0])) { @@ -379,23 +379,23 @@ static void oscar_login(account_t *acc) { conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); if (conn == NULL) { - imc_error(ic, _("Unable to login to AIM")); + imcb_error(ic, _("Unable to login to AIM")); imc_logout(ic, TRUE); return; } if (acc->server == NULL) { - imc_error(ic, "No servername specified"); + imcb_error(ic, "No servername specified"); imc_logout(ic, FALSE); return; } if (g_strcasecmp(acc->server, "login.icq.com") != 0 && g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) { - imc_log(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); + imcb_log(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); } - imc_log(ic, _("Signon: %s"), ic->acc->user); + imcb_log(ic, _("Signon: %s"), ic->acc->user); aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); @@ -403,7 +403,7 @@ static void oscar_login(account_t *acc) { conn->status |= AIM_CONN_STATUS_INPROGRESS; conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic); if (conn->fd < 0) { - imc_error(ic, _("Couldn't connect to host")); + imcb_error(ic, _("Couldn't connect to host")); imc_logout(ic, TRUE); return; } @@ -463,7 +463,7 @@ static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition bosconn = odata->conn; if (source < 0) { - imc_error(ic, _("Could Not Connect")); + imcb_error(ic, _("Could Not Connect")); imc_logout(ic, TRUE); return FALSE; } @@ -471,7 +471,7 @@ static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition aim_conn_completeconnect(sess, bosconn); ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); - imc_log(ic, _("Connection established, cookie sent")); + imcb_log(ic, _("Connection established, cookie sent")); return FALSE; } @@ -494,23 +494,23 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { switch (info->errorcode) { case 0x05: /* Incorrect nick/password */ - imc_error(ic, _("Incorrect nickname or password.")); + imcb_error(ic, _("Incorrect nickname or password.")); // plugin_event(event_error, (void *)980, 0, 0, 0); break; case 0x11: /* Suspended account */ - imc_error(ic, _("Your account is currently suspended.")); + imcb_error(ic, _("Your account is currently suspended.")); break; case 0x18: /* connecting too frequently */ - imc_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.")); + 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: /* client too old */ - imc_error(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE)); + imcb_error(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE)); break; default: - imc_error(ic, _("Authentication Failed")); + imcb_error(ic, _("Authentication Failed")); break; } od->killme = TRUE; @@ -522,7 +522,7 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); if (bosconn == NULL) { - imc_error(ic, _("Internal Error")); + imcb_error(ic, _("Internal Error")); od->killme = TRUE; return 0; } @@ -568,7 +568,7 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { bosconn->fd = proxy_connect(host, port, oscar_bos_connect, ic); g_free(host); if (bosconn->fd < 0) { - imc_error(ic, _("Could Not Connect")); + imcb_error(ic, _("Could Not Connect")); od->killme = TRUE; return 0; } @@ -606,7 +606,7 @@ static gboolean damn_you(gpointer data, gint source, b_input_condition c) in = '\0'; } if (in != '\n') { - imc_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." + imcb_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." " You may be disconnected shortly."); b_event_remove(pos->inpa); closesocket(pos->fd); @@ -629,7 +629,7 @@ static gboolean straight_to_hell(gpointer data, gint source, b_input_condition c char buf[BUF_LONG]; if (source < 0) { - imc_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." + imcb_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." " You may be disconnected shortly."); if (pos->modname) g_free(pos->modname); @@ -707,7 +707,7 @@ int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) { if (pos->modname) g_free(pos->modname); g_free(pos); - imc_error(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM." + imcb_error(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM." " You may be disconnected shortly."); } pos->fd = fd; @@ -1111,7 +1111,7 @@ static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ inv->exchange = *exch; inv->name = g_strdup(name); - do_ask_dialog( ic, txt, inv, oscar_accept_chat, oscar_reject_chat); + imcb_ask( ic, txt, inv, oscar_accept_chat, oscar_reject_chat); if (name) g_free(name); @@ -1129,7 +1129,7 @@ static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) { aim_ssi_auth_reply(od->sess, od->conn, uin, 1, ""); // aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message); if(find_buddy(data->ic, uin) == NULL) - show_got_added(data->ic, uin, NULL); + imcb_ask_add(data->ic, uin, NULL); g_free(uin); g_free(data); @@ -1163,7 +1163,7 @@ static void gaim_icq_authask(struct im_connection *ic, guint32 uin, char *msg) { dialog_msg = g_strdup_printf("The user %u wants to add you to their buddy list for the following reason: %s", uin, reason ? reason : "No reason given."); data->ic = ic; data->uin = uin; - do_ask_dialog(ic, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny); + imcb_ask(ic, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny); g_free(dialog_msg); } @@ -1206,11 +1206,11 @@ static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ } break; case 0x0007: { /* Someone has denied you authorization */ - imc_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") ); + imcb_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") ); } break; case 0x0008: { /* Someone has granted you authorization */ - imc_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") ); + imcb_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") ); } break; case 0x0012: { @@ -1276,7 +1276,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { switch(reason) { case 0: /* Invalid (0) */ - imc_error(sess->aux_data, + imcb_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s because it was invalid.") : _("You missed %d messages from %s because they were invalid."), @@ -1285,7 +1285,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { break; case 1: /* Message too large */ - imc_error(sess->aux_data, + imcb_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s because it was too large.") : _("You missed %d messages from %s because they were too large."), @@ -1294,7 +1294,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { break; case 2: /* Rate exceeded */ - imc_error(sess->aux_data, + imcb_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s because the rate limit has been exceeded.") : _("You missed %d messages from %s because the rate limit has been exceeded."), @@ -1303,7 +1303,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { break; case 3: /* Evil Sender */ - imc_error(sess->aux_data, + imcb_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s because it was too evil.") : _("You missed %d messages from %s because they are too evil."), @@ -1312,7 +1312,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { break; case 4: /* Evil Receiver */ - imc_error(sess->aux_data, + imcb_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s because you are too evil.") : _("You missed %d messages from %s because you are too evil."), @@ -1320,7 +1320,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { userinfo->sn); break; default: - imc_error(sess->aux_data, + imcb_error(sess->aux_data, nummissed == 1 ? _("You missed %d message from %s for unknown reasons.") : _("You missed %d messages from %s for unknown reasons."), @@ -1340,7 +1340,7 @@ static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) { reason = (guint16)va_arg(ap, unsigned int); va_end(ap); - imc_error(sess->aux_data, _("SNAC threw error: %s"), + imcb_error(sess->aux_data, _("SNAC threw error: %s"), reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error"); return 1; @@ -1356,7 +1356,7 @@ static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { destn = va_arg(ap, char *); va_end(ap); - imc_error(sess->aux_data, _("Your message to %s did not get sent: %s"), destn, + imcb_error(sess->aux_data, _("Your message to %s did not get sent: %s"), destn, (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown")); return 1; @@ -1372,7 +1372,7 @@ static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { destn = va_arg(ap, char *); va_end(ap); - imc_error(sess->aux_data, _("User information for %s unavailable: %s"), destn, + imcb_error(sess->aux_data, _("User information for %s unavailable: %s"), destn, (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown")); return 1; @@ -1389,7 +1389,7 @@ static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { va_end(ap); if (id < 4) - imc_error(sess->aux_data, _("Your connection may be lost.")); + imcb_error(sess->aux_data, _("Your connection may be lost.")); return 1; } @@ -1583,7 +1583,7 @@ static int gaim_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...) { } else if (code == AIM_RATE_CODE_WARNING) { aim_conn_setlatency(fr->conn, windowsize/4); } else if (code == AIM_RATE_CODE_LIMIT) { - imc_error(sess->aux_data, _("The last message was not sent because you are over the rate limit. " + imcb_error(sess->aux_data, _("The last message was not sent because you are over the rate limit. " "Please wait 10 seconds and try again.")); aim_conn_setlatency(fr->conn, windowsize/2); } else if (code == AIM_RATE_CODE_CLEARLIMIT) { @@ -1788,11 +1788,11 @@ static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) { } break; case 0x0007: { /* Someone has denied you authorization */ - imc_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") ); + imcb_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") ); } break; case 0x0008: { /* Someone has granted you authorization */ - imc_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") ); + imcb_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") ); } break; case 0x0012: { @@ -1905,7 +1905,7 @@ static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, } /* else... */ if (od->rights.maxawaymsglen == 0) - imc_error(ic, "oscar_set_away_aim called before locate rights received"); + imcb_error(ic, "oscar_set_away_aim called before locate rights received"); aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); @@ -1919,7 +1919,7 @@ static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, } if (strlen(message) > od->rights.maxawaymsglen) { - imc_error(ic, "Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen); + imcb_error(ic, "Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen); } ic->away = g_strndup(message, od->rights.maxawaymsglen); @@ -2083,7 +2083,7 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { aim_icq_reqofflinemsgs(sess); /* Now that we have a buddy list, we can tell BitlBee that we're online. */ - imc_connected(ic); + imcb_connected(ic); return 1; } @@ -2105,7 +2105,7 @@ static int gaim_ssi_parseack( aim_session_t *sess, aim_frame_t *fr, ... ) if( count & 1 ) { /* Hmm, the length should be even... */ - imc_error( sess->aux_data, "Received SSI ACK package with non-even length"); + imcb_error( sess->aux_data, "Received SSI ACK package with non-even length"); return( 0 ); } count >>= 1; @@ -2116,7 +2116,7 @@ static int gaim_ssi_parseack( aim_session_t *sess, aim_frame_t *fr, ... ) st = aimbs_get16( &fr->data ); if( st == 0x0E ) { - imc_log( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list ); + imcb_log( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list ); aim_ssi_auth_request( sess, fr->conn, list, "" ); aim_ssi_addbuddies( sess, fr->conn, OSCAR_GROUP, &list, 1, 1 ); @@ -2302,7 +2302,7 @@ static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...) g_string_sprintfa(str, "\n"); } - imc_log(ic, "%s\n%s", _("User Info"), str->str); + imcb_log(ic, "%s\n%s", _("User Info"), str->str); g_string_free(str, TRUE); return 1; @@ -2396,18 +2396,18 @@ static int gaim_parseaiminfo(aim_session_t *sess, aim_frame_t *fr, ...) idletime.tm_min = userinfo->idletime % 60; idletime.tm_sec = 0; strftime(buff, 256, _("%d days %H hours %M minutes"), &idletime); - imc_log(ic, "%s: %s", _("Idle Time"), buff); + imcb_log(ic, "%s: %s", _("Idle Time"), buff); } if(text) { utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length); - imc_log(ic, "%s\n%s", _("User Info"), utf8); + imcb_log(ic, "%s\n%s", _("User Info"), utf8); } else { - imc_log(ic, _("No user info available.")); + imcb_log(ic, _("No user info available.")); } } else if(infotype == AIM_GETINFO_AWAYMESSAGE && userinfo->flags & AIM_FLAG_AWAY) { utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length); - imc_log(ic, "%s\n%s", _("Away Message"), utf8); + imcb_log(ic, "%s\n%s", _("Away Message"), utf8); } g_free(utf8); diff --git a/protocols/oscar/rxqueue.c b/protocols/oscar/rxqueue.c index b5a83be8..34f389af 100644 --- a/protocols/oscar/rxqueue.c +++ b/protocols/oscar/rxqueue.c @@ -391,7 +391,7 @@ int aim_get_command(aim_session_t *sess, aim_conn_t *conn) aim_bstream_rewind(&flaphdr); start = aimbs_get8(&flaphdr); - imc_error(sess->aux_data, "FLAP framing disrupted"); + imcb_error(sess->aux_data, "FLAP framing disrupted"); aim_conn_close(conn); return -1; } diff --git a/protocols/oscar/search.c b/protocols/oscar/search.c index c557e35f..3570e4df 100644 --- a/protocols/oscar/search.c +++ b/protocols/oscar/search.c @@ -38,7 +38,7 @@ static int error(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_mo /* XXX the modules interface should have already retrieved this for us */ if (!(snac2 = aim_remsnac(sess, snac->id))) { - imc_error(sess->aux_data, "couldn't get snac"); + imcb_error(sess->aux_data, "couldn't get snac"); return 0; } diff --git a/protocols/oscar/service.c b/protocols/oscar/service.c index 69d53d00..3a180780 100644 --- a/protocols/oscar/service.c +++ b/protocols/oscar/service.c @@ -566,7 +566,7 @@ static int migrate(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_ group = aimbs_get16(bs); - imc_error(sess->aux_data, "bifurcated migration unsupported"); + imcb_error(sess->aux_data, "bifurcated migration unsupported"); } tl = aim_readtlvchain(bs); @@ -893,7 +893,7 @@ int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, guint32 offset, guin aimbs_put32(&fr->data, 0xecf8427e); */ } else - imc_error(sess->aux_data, "WARNING: unknown hash request"); + imcb_error(sess->aux_data, "WARNING: unknown hash request"); } diff --git a/protocols/oscar/txqueue.c b/protocols/oscar/txqueue.c index bd8db49d..4416025a 100644 --- a/protocols/oscar/txqueue.c +++ b/protocols/oscar/txqueue.c @@ -29,7 +29,7 @@ aim_frame_t *aim_tx_new(aim_session_t *sess, aim_conn_t *conn, guint8 framing, g aim_frame_t *fr; if (!conn) { - imc_error(sess->aux_data, "no connection specified"); + imcb_error(sess->aux_data, "no connection specified"); return NULL; } @@ -45,7 +45,7 @@ aim_frame_t *aim_tx_new(aim_session_t *sess, aim_conn_t *conn, guint8 framing, g fr->hdr.flap.type = chan; } else - imc_error(sess->aux_data, "unknown framing"); + imcb_error(sess->aux_data, "unknown framing"); if (datalen > 0) { guint8 *data; @@ -79,7 +79,7 @@ static int aim_tx_enqueue__queuebased(aim_session_t *sess, aim_frame_t *fr) { if (!fr->conn) { - imc_error(sess->aux_data, "WARNING: enqueueing packet with no connection"); + imcb_error(sess->aux_data, "WARNING: enqueueing packet with no connection"); fr->conn = aim_getconn_type(sess, AIM_CONN_TYPE_BOS); } @@ -119,7 +119,7 @@ static int aim_tx_enqueue__immediate(aim_session_t *sess, aim_frame_t *fr) { if (!fr->conn) { - imc_error(sess->aux_data, "packet has no connection"); + imcb_error(sess->aux_data, "packet has no connection"); aim_frame_destroy(fr); return 0; } -- cgit v1.2.3 From 6bbb939e953bbe1ca9ed3101a1569abe4521f543 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 15 Apr 2007 21:01:13 -0700 Subject: Split serv_got_update() into imcb_buddy_(status|times). (Well, the second one isn't implemented yet, but I'll do that later.) At last I got rid of the hack called get_status_string(). And now Yahoo seems to mess up away messages... --- protocols/oscar/oscar.c | 79 +++++++++++++------------------------------------ 1 file changed, 20 insertions(+), 59 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 99f839e4..d05868b0 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -364,7 +364,7 @@ static void oscar_login(account_t *acc) { Not touching this anymore now that it belongs to account_t! Let's hope nothing will break. ;-) */ } else { - ic->flags |= OPT_CONN_HTML; + ic->flags |= OPT_DOES_HTML; } sess = g_new0(aim_session_t, 1); @@ -967,45 +967,35 @@ static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { struct oscar_data *od = ic->proto_data; aim_userinfo_t *info; time_t time_idle = 0, signon = 0; - int type = 0; - int caps = 0; - char *tmp; + int flags = OPT_LOGGED_IN; + char *tmp, *state_string = NULL; va_list ap; va_start(ap, fr); info = va_arg(ap, aim_userinfo_t *); va_end(ap); - if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) - caps = info->capabilities; - if (info->flags & AIM_FLAG_ACTIVEBUDDY) - type |= UC_AB; - if ((!od->icq) && (info->present & AIM_USERINFO_PRESENT_FLAGS)) { - if (info->flags & AIM_FLAG_UNCONFIRMED) - type |= UC_UNCONFIRMED; - if (info->flags & AIM_FLAG_ADMINISTRATOR) - type |= UC_ADMIN; - if (info->flags & AIM_FLAG_AOL) - type |= UC_AOL; - if (info->flags & AIM_FLAG_FREE) - type |= UC_NORMAL; if (info->flags & AIM_FLAG_AWAY) - type |= UC_UNAVAILABLE; - if (info->flags & AIM_FLAG_WIRELESS) - type |= UC_WIRELESS; + flags |= OPT_AWAY; } + if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) { - type = (info->icqinfo.status << 7); if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) && (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) { - type |= UC_UNAVAILABLE; + flags |= OPT_AWAY; } + + if( info->icqinfo.status & AIM_ICQ_STATE_DND ) + state_string = "Do Not Disturb"; + else if( info->icqinfo.status & AIM_ICQ_STATE_OUT ) + state_string = "Not Available"; + else if( info->icqinfo.status & AIM_ICQ_STATE_BUSY ) + state_string = "Occupied"; + else if( info->icqinfo.status & AIM_ICQ_STATE_INVISIBLE ) + state_string = "Invisible"; } - if (caps & AIM_CAPS_ICQ) - caps ^= AIM_CAPS_ICQ; - if (info->present & AIM_USERINFO_PRESENT_IDLE) { time(&time_idle); time_idle -= info->idletime*60; @@ -1019,8 +1009,8 @@ static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { g_snprintf(ic->displayname, sizeof(ic->displayname), "%s", info->sn); g_free(tmp); - serv_got_update(ic, info->sn, 1, info->warnlevel/10, signon, - time_idle, type, caps); + imcb_buddy_status(ic, info->sn, flags, state_string, NULL); + /* imcb_buddy_times(ic, info->sn, signon, time_idle); */ return 1; } @@ -1034,7 +1024,7 @@ static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { info = va_arg(ap, aim_userinfo_t *); va_end(ap); - serv_got_update(ic, info->sn, 0, 0, 0, 0, 0, 0); + imcb_buddy_status(ic, info->sn, 0, NULL, NULL ); return 1; } @@ -1045,7 +1035,7 @@ static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ int flags = 0; if (args->icbmflags & AIM_IMFLAGS_AWAY) - flags |= IM_FLAG_AWAY; + flags |= OPT_AWAY; if ((args->icbmflags & AIM_IMFLAGS_UNICODE) || (args->icbmflags & AIM_IMFLAGS_ISO_8859_1)) { char *src; @@ -1820,7 +1810,7 @@ static void oscar_keepalive(struct im_connection *ic) { static int oscar_send_im(struct im_connection *ic, char *name, char *message, int imflags) { struct oscar_data *odata = (struct oscar_data *)ic->proto_data; int ret = 0, len = strlen(message); - if (imflags & IM_FLAG_AWAY) { + if (imflags & OPT_AWAY) { ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message); } else { struct aim_sendimext_args args; @@ -2444,34 +2434,6 @@ int gaim_parsemtn(aim_session_t *sess, aim_frame_t *fr, ...) return 1; } -static char *oscar_get_status_string( struct im_connection *ic, int number ) -{ - struct oscar_data *od = ic->proto_data; - - if( ! number & UC_UNAVAILABLE ) - { - return( NULL ); - } - else if( od->icq ) - { - number >>= 7; - if( number & AIM_ICQ_STATE_DND ) - return( "Do Not Disturb" ); - else if( number & AIM_ICQ_STATE_OUT ) - return( "Not Available" ); - else if( number & AIM_ICQ_STATE_BUSY ) - return( "Occupied" ); - else if( number & AIM_ICQ_STATE_INVISIBLE ) - return( "Invisible" ); - else - return( "Away" ); - } - else - { - return( "Away" ); - } -} - int oscar_send_typing(struct im_connection *ic, char * who, int typing) { struct oscar_data *od = ic->proto_data; @@ -2632,7 +2594,6 @@ void oscar_initmodule() ret->rem_permit = oscar_rem_permit; ret->rem_deny = oscar_rem_deny; ret->set_permit_deny = oscar_set_permit_deny; - ret->get_status_string = oscar_get_status_string; ret->send_typing = oscar_send_typing; ret->handle_cmp = aim_sncmp; -- cgit v1.2.3 From 9624fdf0d6f170d8caa7948fb1b3a138b05e1d8c Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 16 Apr 2007 21:49:17 -0700 Subject: API cleanup pretty much complete. Fixed pretty much everything except the buddy/groupchat related functions. --- protocols/oscar/oscar.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index d05868b0..407aba7f 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -1069,7 +1069,7 @@ static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ g_snprintf(tmp, BUF_LONG, "%s", args->msg); strip_linefeed(tmp); - serv_got_im(ic, userinfo->sn, tmp, flags, time(NULL), -1); + imcb_buddy_msg(ic, userinfo->sn, tmp, flags, 0); g_free(tmp); return 1; @@ -1166,7 +1166,7 @@ static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ uin = g_strdup_printf("%u", args->uin); message = g_strdup(args->msg); strip_linefeed(message); - serv_got_im(ic, uin, message, 0, time(NULL), -1); + imcb_buddy_msg(ic, uin, message, 0, 0); g_free(uin); g_free(message); } break; @@ -1185,7 +1185,7 @@ static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ } strip_linefeed(message); - serv_got_im(ic, uin, message, 0, time(NULL), -1); + imcb_buddy_msg(ic, uin, message, 0, 0); g_free(uin); g_free(m); g_free(message); @@ -1747,7 +1747,7 @@ static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) { time_t t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); g_snprintf(sender, sizeof(sender), "%u", msg->sender); strip_linefeed(dialog_msg); - serv_got_im(ic, sender, dialog_msg, 0, t, -1); + imcb_buddy_msg(ic, sender, dialog_msg, 0, t); g_free(dialog_msg); } break; @@ -1768,7 +1768,7 @@ static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) { } strip_linefeed(dialog_msg); - serv_got_im(ic, sender, dialog_msg, 0, t, -1); + imcb_buddy_msg(ic, sender, dialog_msg, 0, t); g_free(dialog_msg); g_free(m); } break; @@ -2420,15 +2420,15 @@ int gaim_parsemtn(aim_session_t *sess, aim_frame_t *fr, ...) if(type2 == 0x0002) { /* User is typing */ - serv_got_typing(ic, sn, 0, 1); + imcb_buddy_typing(ic, sn, OPT_TYPING); } else if (type2 == 0x0001) { /* User has typed something, but is not actively typing (stale) */ - serv_got_typing(ic, sn, 0, 2); + imcb_buddy_typing(ic, sn, OPT_THINKING); } else { /* User has stopped typing */ - serv_got_typing(ic, sn, 0, 0); + imcb_buddy_typing(ic, sn, 0); } return 1; -- cgit v1.2.3 From f0cb961652cbd639e89dcd88a86f20a2414146c4 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 18 Apr 2007 23:03:43 -0700 Subject: More API changes: buddy list management. imcb_add_buddy() is now a *real* callback, it's only called from inside IM-modules. This makes sure a buddy only gets added to the BitlBee structures if the add was successful. This gets rid of the weirdness described in #55. Unfortunately for now this change breaks A) automatic renaming of ICQ contacts (if there are names stored in the contact list) B) add -tmp. --- protocols/oscar/oscar.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 407aba7f..7e5dbee0 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -1118,7 +1118,7 @@ static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) { message = 0; aim_ssi_auth_reply(od->sess, od->conn, uin, 1, ""); // aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message); - if(find_buddy(data->ic, uin) == NULL) + if(imcb_find_buddy(data->ic, uin) == NULL) imcb_ask_add(data->ic, uin, NULL); g_free(uin); @@ -1874,7 +1874,7 @@ static void oscar_get_info(struct im_connection *g, char *name) { static void oscar_get_away(struct im_connection *g, char *who) { struct oscar_data *odata = (struct oscar_data *)g->proto_data; if (odata->icq) { - struct buddy *budlight = find_buddy(g, who); + struct buddy *budlight = imcb_find_buddy(g, who); if (budlight) if ((budlight->uc & 0xff80) >> 7) if (budlight->caps & AIM_CAPS_ICQSERVERRELAY) @@ -2012,16 +2012,18 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { for (curitem=sess->ssi.items; curitem; curitem=curitem->next) { switch (curitem->type) { case 0x0000: /* Buddy */ - if ((curitem->name) && (!find_buddy(ic, curitem->name))) { + if ((curitem->name) && (!imcb_find_buddy(ic, curitem->name))) { char *realname = NULL; if (curitem->data && aim_gettlv(curitem->data, 0x0131, 1)) realname = aim_gettlv_str(curitem->data, 0x0131, 1); - add_buddy(ic, NULL, curitem->name, realname); + imcb_add_buddy(ic, curitem->name, NULL); - if (realname) - g_free(realname); + if (realname) { + imcb_rename_buddy(ic, curitem->name, realname); + g_free(realname); + } } break; @@ -2104,13 +2106,21 @@ static int gaim_ssi_parseack( aim_session_t *sess, aim_frame_t *fr, ... ) for( i = 0; i < count; i ++ ) { st = aimbs_get16( &fr->data ); - if( st == 0x0E ) + if( st == 0x00 ) + { + imcb_add_buddy( sess->aux_data, list, NULL ); + } + else if( st == 0x0E ) { imcb_log( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list ); aim_ssi_auth_request( sess, fr->conn, list, "" ); aim_ssi_addbuddies( sess, fr->conn, OSCAR_GROUP, &list, 1, 1 ); } + else + { + imcb_error( sess->aux_data, "Error while adding buddy: 0x%04x", st ); + } list += strlen( list ) + 1; } } -- cgit v1.2.3 From 61ae52c5fbe8fbaf75adb148cd05c357590e8807 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 19 Apr 2007 22:19:06 -0700 Subject: Renamed/slightly changed syntax of groupchat callback functions. --- protocols/oscar/oscar.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 7e5dbee0..a23e8a5a 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -749,7 +749,7 @@ static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { chatcon = find_oscar_chat_by_conn(ic, fr->conn); chatcon->id = id; - chatcon->cnv = serv_got_joined_chat(ic, chatcon->show); + chatcon->cnv = imcb_chat_new(ic, chatcon->show); chatcon->cnv->data = chatcon; return 1; @@ -1460,7 +1460,7 @@ static int gaim_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) { return 1; for (i = 0; i < count; i++) - add_chat_buddy(c->cnv, info[i].sn); + imcb_chat_add_buddy(c->cnv, info[i].sn); return 1; } @@ -1483,7 +1483,7 @@ static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) { return 1; for (i = 0; i < count; i++) - remove_chat_buddy(c->cnv, info[i].sn, NULL); + imcb_chat_remove_buddy(c->cnv, info[i].sn, NULL); return 1; } @@ -1534,7 +1534,7 @@ static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { tmp = g_malloc(BUF_LONG); g_snprintf(tmp, BUF_LONG, "%s", msg); - serv_got_chat_in(ccon->cnv, info->sn, 0, tmp, time((time_t)NULL)); + imcb_chat_msg(ccon->cnv, info->sn, tmp, 0, 0); g_free(tmp); return 1; @@ -2512,7 +2512,7 @@ void oscar_chat_kill(struct im_connection *ic, struct chat_connection *cc) struct oscar_data *od = (struct oscar_data *)ic->proto_data; /* Notify the conversation window that we've left the chat */ - serv_got_chat_left(cc->cnv); + imcb_chat_removed(cc->cnv); /* Destroy the chat_connection */ od->oscar_chats = g_slist_remove(od->oscar_chats, cc); -- cgit v1.2.3 From f6c963b97d3f686ca5410f1896cf8e266b455c22 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 20 Apr 2007 21:13:21 -0700 Subject: Renamed some more prpl functions. --- protocols/oscar/oscar.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index a23e8a5a..a088624a 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -1807,7 +1807,7 @@ static void oscar_keepalive(struct im_connection *ic) { aim_flap_nop(odata->sess, odata->conn); } -static int oscar_send_im(struct im_connection *ic, char *name, char *message, int imflags) { +static int oscar_buddy_msg(struct im_connection *ic, char *name, char *message, int imflags) { struct oscar_data *odata = (struct oscar_data *)ic->proto_data; int ret = 0, len = strlen(message); if (imflags & OPT_AWAY) { @@ -2450,7 +2450,7 @@ int oscar_send_typing(struct im_connection *ic, char * who, int typing) return( aim_im_sendmtn(od->sess, 1, who, typing ? 0x0002 : 0x0000) ); } -void oscar_chat_send(struct groupchat *c, char *message, int msgflags) +void oscar_chat_msg(struct groupchat *c, char *message, int msgflags) { struct im_connection *ic = c->ic; struct oscar_data * od = (struct oscar_data*)ic->proto_data; @@ -2589,13 +2589,13 @@ void oscar_initmodule() ret->login = oscar_login; ret->keepalive = oscar_keepalive; ret->logout = oscar_logout; - ret->send_im = oscar_send_im; + ret->buddy_msg = oscar_buddy_msg; ret->get_info = oscar_get_info; ret->set_away = oscar_set_away; ret->get_away = oscar_get_away; ret->add_buddy = oscar_add_buddy; ret->remove_buddy = oscar_remove_buddy; - ret->chat_send = oscar_chat_send; + ret->chat_msg = oscar_chat_msg; ret->chat_invite = oscar_chat_invite; ret->chat_leave = oscar_chat_leave; ret->chat_with = oscar_chat_with; -- cgit v1.2.3 From df1fb67d1dbf52d138f63e0d917dda2412d4fc0b Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 20 Apr 2007 22:18:40 -0700 Subject: Consistency; Using OPT_T(YP|HINK)ING for outgoing typing notfication crap too. --- 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 a088624a..1ca932f3 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -2447,7 +2447,7 @@ int gaim_parsemtn(aim_session_t *sess, aim_frame_t *fr, ...) int oscar_send_typing(struct im_connection *ic, char * who, int typing) { struct oscar_data *od = ic->proto_data; - return( aim_im_sendmtn(od->sess, 1, who, typing ? 0x0002 : 0x0000) ); + return( aim_im_sendmtn(od->sess, 1, who, (typing & OPT_TYPING) ? 0x0002 : 0x0000) ); } void oscar_chat_msg(struct groupchat *c, char *message, int msgflags) -- cgit v1.2.3 From c737ba70c7b3510ffb6bed8f9373e63b1a150c1b Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 21 Apr 2007 19:15:36 -0700 Subject: join_chat root command works for AIM chats now. (Was trivial to add and useful for testing.) --- protocols/oscar/oscar.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 1ca932f3..0c175df6 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -2529,36 +2529,39 @@ void oscar_chat_leave(struct groupchat *c) oscar_chat_kill(c->ic, c->data); } -int oscar_chat_join(struct im_connection * ic, char * name) +struct groupchat *oscar_chat_join(struct im_connection * ic, char * room, char * nick, char * password ) { struct oscar_data * od = (struct oscar_data *)ic->proto_data; - aim_conn_t * cur; if((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) { - - return (aim_chatnav_createroom(od->sess, cur, name, 4) == 0); - + int st; + + st = aim_chatnav_createroom(od->sess, cur, room, 4); + + return NULL; } else { struct create_room * cr = g_new0(struct create_room, 1); + cr->exchange = 4; - cr->name = g_strdup(name); + cr->name = g_strdup(room); od->create_rooms = g_slist_append(od->create_rooms, cr); aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); - return 1; + + return NULL; } } struct groupchat *oscar_chat_with(struct im_connection * ic, char *who) { struct oscar_data * od = (struct oscar_data *)ic->proto_data; - int ret; + struct groupchat *ret; static int chat_id = 0; char * chatname; chatname = g_strdup_printf("%s%d", ic->acc->user, chat_id++); - ret = oscar_chat_join(ic, chatname); + ret = oscar_chat_join(ic, chatname, NULL, NULL); aim_chat_invite(od->sess, od->conn, who, "", 4, chatname, 0x0); @@ -2569,7 +2572,7 @@ struct groupchat *oscar_chat_with(struct im_connection * ic, char *who) void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv) { - oscar_chat_join(inv->ic, inv->name); + oscar_chat_join(inv->ic, inv->name, NULL, NULL); g_free(inv->name); g_free(inv); } @@ -2599,6 +2602,7 @@ void oscar_initmodule() ret->chat_invite = oscar_chat_invite; ret->chat_leave = oscar_chat_leave; ret->chat_with = oscar_chat_with; + ret->chat_join = oscar_chat_join; ret->add_permit = oscar_add_permit; ret->add_deny = oscar_add_deny; ret->rem_permit = oscar_rem_permit; -- cgit v1.2.3 From e35d1a121d5fb2da3698fbe4a365fe38d0097665 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 22 Apr 2007 13:44:27 -0700 Subject: Read-only support for Jabber conferences (non-anonymous rooms only). Just don't use this, you're really not going to like it. :-) --- 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 0c175df6..b72c683a 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -2512,7 +2512,7 @@ void oscar_chat_kill(struct im_connection *ic, struct chat_connection *cc) struct oscar_data *od = (struct oscar_data *)ic->proto_data; /* Notify the conversation window that we've left the chat */ - imcb_chat_removed(cc->cnv); + imcb_chat_free(cc->cnv); /* Destroy the chat_connection */ od->oscar_chats = g_slist_remove(od->oscar_chats, cc); -- cgit v1.2.3 From 05bcd20ba58357673225984d8f308baa6d34b726 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 27 Apr 2007 22:20:56 -0700 Subject: s/Gender: Unknown// in OSCAR profile info. If we don't know, just don't mention it, like the other vars. --- protocols/oscar/oscar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 0c175df6..426dd4a2 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -2254,7 +2254,8 @@ static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...) } } info_string_append(str, "\n", _("Mobile Phone"), info->mobile); - info_string_append(str, "\n", _("Gender"), info->gender==1 ? _("Female") : info->gender==2 ? _("Male") : _("Unknown")); + if (info->gender != 0) + info_string_append(str, "\n", _("Gender"), info->gender==1 ? _("Female") : _("Male")); if (info->birthyear || info->birthmonth || info->birthday) { char date[30]; struct tm tm; -- cgit v1.2.3 From d06eabf19ec3f849d8bab22c13d43e4eba9a48ee Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 4 Jun 2007 14:22:05 +0100 Subject: Added imcb_buddy_nick_hint so the Jabber conference module can suggest sane nicknames for chatroom participants. There'll probably be a lot of underscores now, but this is by far the cleanest way to implement this, I think. At least now whispers will work properly. Also using this function call to set names for ICQ contacts in a slightly saner way. --- protocols/oscar/oscar.c | 1 + 1 file changed, 1 insertion(+) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index b72c683a..39d14811 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -2021,6 +2021,7 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { imcb_add_buddy(ic, curitem->name, NULL); if (realname) { + imcb_buddy_nick_hint(ic, curitem->name, realname); imcb_rename_buddy(ic, curitem->name, realname); g_free(realname); } -- cgit v1.2.3 From be68d99a58721768033c83d2f0a8f26e1af9bd73 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 10 Nov 2007 09:25:50 +0000 Subject: Handing of multipart messages in OSCAR (usually from mobiles), this fixes bug #88, at last. --- protocols/oscar/oscar.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 426dd4a2..2b8b4853 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -1065,8 +1065,17 @@ static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ } else { g_snprintf(tmp, BUF_LONG, "%s", args->msg); } - } else + } else if (args->mpmsg.numparts == 0) { g_snprintf(tmp, BUF_LONG, "%s", args->msg); + } else { + int i; + + *tmp = 0; + for (i = 0; i < args->mpmsg.numparts; i ++) { + g_strlcat(tmp, (char*) args->mpmsg.parts[i].data, BUF_LONG); + g_strlcat(tmp, "\n", BUF_LONG); + } + } strip_linefeed(tmp); imcb_buddy_msg(ic, userinfo->sn, tmp, flags, 0); -- cgit v1.2.3 From 9ff5737ec53cca2ba295b58fb74a8b97f496cd19 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 29 Nov 2007 21:55:14 +0000 Subject: printf() in daemons considered harmful. --- protocols/oscar/msgcookie.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/msgcookie.c b/protocols/oscar/msgcookie.c index d3c91a94..efeb8cbf 100644 --- a/protocols/oscar/msgcookie.c +++ b/protocols/oscar/msgcookie.c @@ -130,21 +130,6 @@ aim_msgcookie_t *aim_checkcookie(aim_session_t *sess, const guint8 *cookie, int return NULL; } -#if 0 /* debugging feature */ -int aim_dumpcookie(aim_msgcookie_t *cookie) -{ - - if (!cookie) - return -EINVAL; - - printf("\tCookie at %p: %d/%s with %p, next %p\n", - cookie, cookie->type, cookie->cookie, - cookie->data, cookie->next); - - return 0; -} -#endif - /** * aim_cookie_free - free an aim_msgcookie_t struct * @sess: session to remove the cookie from -- cgit v1.2.3 From c058ff976bbbbf43ef11c262f21440e61244f73e Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 9 Dec 2007 23:19:35 +0000 Subject: Added /invite support for Jabber chatrooms (and fixed the argument order to chat_invite). --- 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 96983738..8d45acf0 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -2508,7 +2508,7 @@ void oscar_chat_msg(struct groupchat *c, char *message, int msgflags) /* return (ret >= 0); */ } -void oscar_chat_invite(struct groupchat *c, char *message, char *who) +void oscar_chat_invite(struct groupchat *c, char *who, char *message) { struct im_connection *ic = c->ic; struct oscar_data * od = (struct oscar_data *)ic->proto_data; -- cgit v1.2.3 From 30ce1ced040c44c528d0a6e6e9c6b10a1caf1052 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 12 Dec 2007 23:30:51 +0000 Subject: Killed the parameter to "account add" and changed the default server for OSCAR to what both login.icq.com and login.oscar.aol.com resolve to these days. There's no need to specify a server anymore so why bother. And cleaned up the docs (removed all references to those OSCAR servers). --- protocols/oscar/aim.h | 2 +- protocols/oscar/oscar.c | 26 ++++---------------------- 2 files changed, 5 insertions(+), 23 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/aim.h b/protocols/oscar/aim.h index 81ea5f9e..9516996c 100644 --- a/protocols/oscar/aim.h +++ b/protocols/oscar/aim.h @@ -93,7 +93,7 @@ typedef guint16 flap_seqnum_t; * the client to connect to it. * */ -#define AIM_DEFAULT_LOGIN_SERVER "login.oscar.aol.com" +#define AIM_DEFAULT_LOGIN_SERVER "login.messaging.aol.com" #define AIM_LOGIN_PORT 5190 /* diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 8d45acf0..c4683046 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -340,7 +340,7 @@ static void oscar_init(account_t *acc) { set_t *s; - s = set_add( &acc->set, "server", NULL, set_eval_account, acc ); + s = set_add( &acc->set, "server", AIM_DEFAULT_LOGIN_SERVER, set_eval_account, acc ); s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY; if (isdigit(acc->user[0])) { @@ -355,15 +355,7 @@ static void oscar_login(account_t *acc) { struct im_connection *ic = imcb_new(acc); struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1); - if (isdigit(acc->user[0])) { - odata->icq = TRUE; - /* This is odd but it's necessary for a proper do_import and do_export. - We don't do those anymore, but let's stick with it, just in case - it accidentally fixes something else too... */ - /* ic->acc->pass[8] = 0; - Not touching this anymore now that it belongs to account_t! - Let's hope nothing will break. ;-) */ - } else { + if (!isdigit(acc->user[0])) { ic->flags |= OPT_DOES_HTML; } @@ -384,24 +376,14 @@ static void oscar_login(account_t *acc) { return; } - if (acc->server == NULL) { - imcb_error(ic, "No servername specified"); - imc_logout(ic, FALSE); - return; - } - - if (g_strcasecmp(acc->server, "login.icq.com") != 0 && - g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) { - imcb_log(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); - } - imcb_log(ic, _("Signon: %s"), ic->acc->user); aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); conn->status |= AIM_CONN_STATUS_INPROGRESS; - conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic); + conn->fd = proxy_connect(set_getstr(&acc->set, "server"), + AIM_LOGIN_PORT, oscar_login_connect, ic); if (conn->fd < 0) { imcb_error(ic, _("Couldn't connect to host")); imc_logout(ic, TRUE); -- cgit v1.2.3 From 434627083613f016d432462fce73f728dd77172e Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 6 Jan 2008 12:37:55 +0000 Subject: More consistency in error/warning errors. Until now "WARNING:" was usually in upper case while "Error:" wasn't .... that doesn't really make sense. --- protocols/oscar/service.c | 2 +- protocols/oscar/txqueue.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/service.c b/protocols/oscar/service.c index 3a180780..acd09150 100644 --- a/protocols/oscar/service.c +++ b/protocols/oscar/service.c @@ -893,7 +893,7 @@ int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, guint32 offset, guin aimbs_put32(&fr->data, 0xecf8427e); */ } else - imcb_error(sess->aux_data, "WARNING: unknown hash request"); + imcb_error(sess->aux_data, "Warning: unknown hash request"); } diff --git a/protocols/oscar/txqueue.c b/protocols/oscar/txqueue.c index 4416025a..d38986d0 100644 --- a/protocols/oscar/txqueue.c +++ b/protocols/oscar/txqueue.c @@ -79,7 +79,7 @@ static int aim_tx_enqueue__queuebased(aim_session_t *sess, aim_frame_t *fr) { if (!fr->conn) { - imcb_error(sess->aux_data, "WARNING: enqueueing packet with no connection"); + imcb_error(sess->aux_data, "Warning: enqueueing packet with no connection"); fr->conn = aim_getconn_type(sess, AIM_CONN_TYPE_BOS); } -- cgit v1.2.3 From 181e47a9693d56e4bc0cec65ec05fce6086aebe8 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 10 Jan 2008 00:31:38 +0000 Subject: Now setting odata->icq properly again, this got lost some time ago, which broke the info command and probably more things. --- protocols/oscar/oscar.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index c4683046..980beaca 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -355,9 +355,10 @@ static void oscar_login(account_t *acc) { struct im_connection *ic = imcb_new(acc); struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1); - if (!isdigit(acc->user[0])) { + if (isdigit(acc->user[0])) + odata->icq = TRUE; + else ic->flags |= OPT_DOES_HTML; - } sess = g_new0(aim_session_t, 1); -- cgit v1.2.3 From e64de00bf2d99962182243983e8c09decaa36eb4 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 12 Jan 2008 00:24:46 +0000 Subject: Killed info_string_append() and now showing the IP address of ICQ users in the "info" command response. --- protocols/oscar/oscar.c | 184 +++++++++++++++++++++++++++--------------------- 1 file changed, 102 insertions(+), 82 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 980beaca..c96e342e 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -90,6 +90,8 @@ struct oscar_data { gboolean killme; gboolean icq; GSList *evilhack; + + GHashTable *ips; struct { guint maxbuddies; /* max users you can watch */ @@ -411,6 +413,8 @@ static void oscar_logout(struct im_connection *ic) { odata->create_rooms = g_slist_remove(odata->create_rooms, cr); g_free(cr); } + if (odata->ips) + g_hash_table_destroy(odata->ips); if (odata->email) g_free(odata->email); if (odata->newp) @@ -987,6 +991,16 @@ static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) signon = time(NULL) - info->sessionlen; + if (info->present & AIM_USERINFO_PRESENT_ICQIPADDR) { + uint32_t *uin = g_new0(uint32_t, 1); + + if (od->ips == NULL) + od->ips = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, NULL); + + if (sscanf(info->sn, "%d", uin) == 1) + g_hash_table_insert(od->ips, uin, (gpointer) (long) info->icqinfo.ipaddr); + } + tmp = g_strdup(normalize(ic->acc->user)); if (!strcmp(tmp, normalize(info->sn))) g_snprintf(ic->displayname, sizeof(ic->displayname), "%s", info->sn); @@ -2219,87 +2233,93 @@ static GList *oscar_away_states(struct im_connection *ic) static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...) { - struct im_connection *ic = sess->aux_data; - gchar who[16]; - GString *str; - va_list ap; - struct aim_icq_info *info; - - va_start(ap, fr); - info = va_arg(ap, struct aim_icq_info *); - va_end(ap); - - if (!info->uin) - return 0; - - str = g_string_sized_new(100); - g_snprintf(who, sizeof(who), "%u", info->uin); - - g_string_sprintfa(str, "%s: %s - %s: %s", _("UIN"), who, _("Nick"), - info->nick ? info->nick : "-"); - info_string_append(str, "\n", _("First Name"), info->first); - info_string_append(str, "\n", _("Last Name"), info->last); - info_string_append(str, "\n", _("Email Address"), info->email); - if (info->numaddresses && info->email2) { - int i; - for (i = 0; i < info->numaddresses; i++) { - info_string_append(str, "\n", _("Email Address"), info->email2[i]); - } - } - info_string_append(str, "\n", _("Mobile Phone"), info->mobile); - if (info->gender != 0) - info_string_append(str, "\n", _("Gender"), info->gender==1 ? _("Female") : _("Male")); - if (info->birthyear || info->birthmonth || info->birthday) { - char date[30]; - struct tm tm; - tm.tm_mday = (int)info->birthday; - tm.tm_mon = (int)info->birthmonth-1; - tm.tm_year = (int)info->birthyear%100; - strftime(date, sizeof(date), "%Y-%m-%d", &tm); - info_string_append(str, "\n", _("Birthday"), date); - } - if (info->age) { - char age[5]; - g_snprintf(age, sizeof(age), "%hhd", info->age); - info_string_append(str, "\n", _("Age"), age); - } - info_string_append(str, "\n", _("Personal Web Page"), info->personalwebpage); - if (info->info && info->info[0]) { - g_string_sprintfa(str, "\n%s:\n%s\n%s", _("Additional Information"), - info->info, _("End of Additional Information")); - } - g_string_sprintfa(str, "\n"); - if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { - g_string_sprintfa(str, "%s:", _("Home Address")); - info_string_append(str, "\n", _("Address"), info->homeaddr); - info_string_append(str, "\n", _("City"), info->homecity); - info_string_append(str, "\n", _("State"), info->homestate); - info_string_append(str, "\n", _("Zip Code"), info->homezip); - g_string_sprintfa(str, "\n"); - } - if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { - g_string_sprintfa(str, "%s:", _("Work Address")); - info_string_append(str, "\n", _("Address"), info->workaddr); - info_string_append(str, "\n", _("City"), info->workcity); - info_string_append(str, "\n", _("State"), info->workstate); - info_string_append(str, "\n", _("Zip Code"), info->workzip); - g_string_sprintfa(str, "\n"); - } - if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { - g_string_sprintfa(str, "%s:", _("Work Information")); - info_string_append(str, "\n", _("Company"), info->workcompany); - info_string_append(str, "\n", _("Division"), info->workdivision); - info_string_append(str, "\n", _("Position"), info->workposition); - if (info->workwebpage && info->workwebpage[0]) { - info_string_append(str, "\n", _("Web Page"), info->workwebpage); - } - g_string_sprintfa(str, "\n"); - } - - imcb_log(ic, "%s\n%s", _("User Info"), str->str); - g_string_free(str, TRUE); - - return 1; + struct im_connection *ic = sess->aux_data; + struct oscar_data *od = ic->proto_data; + gchar who[16]; + GString *str; + va_list ap; + struct aim_icq_info *info; + uint32_t ip; + + va_start(ap, fr); + info = va_arg(ap, struct aim_icq_info *); + va_end(ap); + + if (!info->uin) + return 0; + + str = g_string_sized_new(512); + g_snprintf(who, sizeof(who), "%u", info->uin); + + g_string_printf(str, "%s: %s - %s: %s", _("UIN"), who, _("Nick"), + info->nick ? info->nick : "-"); + g_string_append_printf(str, "\n%s: %s", _("First Name"), info->first); + g_string_append_printf(str, "\n%s: %s", _("Last Name"), info->last); + g_string_append_printf(str, "\n%s: %s", _("Email Address"), info->email); + if (info->numaddresses && info->email2) { + int i; + for (i = 0; i < info->numaddresses; i++) { + g_string_append_printf(str, "\n%s: %s", _("Email Address"), info->email2[i]); + } + } + if ((ip = (long) g_hash_table_lookup(od->ips, &info->uin)) != 0) { + g_string_append_printf(str, "\n%s: %d.%d.%d.%d", _("Last used IP address"), + (ip >> 24), (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff); + } + g_string_append_printf(str, "\n%s: %s", _("Mobile Phone"), info->mobile); + if (info->gender != 0) + g_string_append_printf(str, "\n%s: %s", _("Gender"), info->gender==1 ? _("Female") : _("Male")); + if (info->birthyear || info->birthmonth || info->birthday) { + char date[30]; + struct tm tm; + tm.tm_mday = (int)info->birthday; + tm.tm_mon = (int)info->birthmonth-1; + tm.tm_year = (int)info->birthyear%100; + strftime(date, sizeof(date), "%Y-%m-%d", &tm); + g_string_append_printf(str, "\n%s: %s", _("Birthday"), date); + } + if (info->age) { + char age[5]; + g_snprintf(age, sizeof(age), "%hhd", info->age); + g_string_append_printf(str, "\n%s: %s", _("Age"), age); + } + g_string_append_printf(str, "\n%s: %s", _("Personal Web Page"), info->personalwebpage); + if (info->info && info->info[0]) { + g_string_sprintfa(str, "\n%s:\n%s\n%s", _("Additional Information"), + info->info, _("End of Additional Information")); + } + g_string_append_c(str, '\n'); + if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { + g_string_append_printf(str, "%s:", _("Home Address")); + g_string_append_printf(str, "\n%s: %s", _("Address"), info->homeaddr); + g_string_append_printf(str, "\n%s: %s", _("City"), info->homecity); + g_string_append_printf(str, "\n%s: %s", _("State"), info->homestate); + g_string_append_printf(str, "\n%s: %s", _("Zip Code"), info->homezip); + g_string_append_c(str, '\n'); + } + if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { + g_string_append_printf(str, "%s:", _("Work Address")); + g_string_append_printf(str, "\n%s: %s", _("Address"), info->workaddr); + g_string_append_printf(str, "\n%s: %s", _("City"), info->workcity); + g_string_append_printf(str, "\n%s: %s", _("State"), info->workstate); + g_string_append_printf(str, "\n%s: %s", _("Zip Code"), info->workzip); + g_string_append_c(str, '\n'); + } + if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { + g_string_append_printf(str, "%s:", _("Work Information")); + g_string_append_printf(str, "\n%s: %s", _("Company"), info->workcompany); + g_string_append_printf(str, "\n%s: %s", _("Division"), info->workdivision); + g_string_append_printf(str, "\n%s: %s", _("Position"), info->workposition); + if (info->workwebpage && info->workwebpage[0]) { + g_string_append_printf(str, "\n%s: %s", _("Web Page"), info->workwebpage); + } + g_string_append_c(str, '\n'); + } + + imcb_log(ic, "%s\n%s", _("User Info"), str->str); + g_string_free(str, TRUE); + + return 1; } @@ -2433,7 +2453,7 @@ int gaim_parsemtn(aim_session_t *sess, aim_frame_t *fr, ...) else { /* User has stopped typing */ imcb_buddy_typing(ic, sn, 0); - } + } return 1; } -- cgit v1.2.3 From 613cc5583465b2fa35288a2f28d0e408904c4fd9 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 24 Jan 2008 22:22:46 +0000 Subject: Fixed two valgrind warnings (partially uninitialized "struct tm" vars.) --- protocols/oscar/oscar.c | 1 + 1 file changed, 1 insertion(+) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index c96e342e..30ad4b68 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -2272,6 +2272,7 @@ static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...) if (info->birthyear || info->birthmonth || info->birthday) { char date[30]; struct tm tm; + memset(&tm, 0, sizeof(struct tm)); tm.tm_mday = (int)info->birthday; tm.tm_mon = (int)info->birthmonth-1; tm.tm_year = (int)info->birthyear%100; -- cgit v1.2.3 From f774e01cdb34e339455671f51413ecdc6de3208d Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 30 Jan 2008 23:05:52 +0000 Subject: Fixed handling of OSCAR multi-part messages... They're not arrays, they're linked lists! --- protocols/oscar/oscar.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 30ad4b68..9e5de70a 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -1065,12 +1065,14 @@ static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ } else if (args->mpmsg.numparts == 0) { g_snprintf(tmp, BUF_LONG, "%s", args->msg); } else { - int i; + aim_mpmsg_section_t *part; *tmp = 0; - for (i = 0; i < args->mpmsg.numparts; i ++) { - g_strlcat(tmp, (char*) args->mpmsg.parts[i].data, BUF_LONG); - g_strlcat(tmp, "\n", BUF_LONG); + for (part = args->mpmsg.parts; part; part = part->next) { + if (part->data) { + g_strlcat(tmp, (char*) part->data, BUF_LONG); + g_strlcat(tmp, "\n", BUF_LONG); + } } } -- cgit v1.2.3 From fc5cf88448d4337d1a5fde418df1c6206a9b0ea2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 16 Feb 2008 16:45:12 +0100 Subject: Fix lcov dependencies. --- protocols/oscar/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'protocols/oscar') diff --git a/protocols/oscar/Makefile b/protocols/oscar/Makefile index 95e85ec2..2792f22a 100644 --- a/protocols/oscar/Makefile +++ b/protocols/oscar/Makefile @@ -17,7 +17,7 @@ LFLAGS += -r # [SH] Phony targets all: oscar_mod.o check: all -lcov: +lcov: check gcov: gcov *.c -- cgit v1.2.3