aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/oscar
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/oscar')
-rw-r--r--protocols/oscar/aim.h2
-rw-r--r--protocols/oscar/chat.c6
-rw-r--r--protocols/oscar/chatnav.c10
-rw-r--r--protocols/oscar/icq.c2
-rw-r--r--protocols/oscar/im.c12
-rw-r--r--protocols/oscar/info.c6
-rw-r--r--protocols/oscar/oscar.c693
-rw-r--r--protocols/oscar/rxqueue.c2
-rw-r--r--protocols/oscar/search.c2
-rw-r--r--protocols/oscar/service.c8
-rw-r--r--protocols/oscar/txqueue.c8
11 files changed, 339 insertions, 412 deletions
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/chat.c b/protocols/oscar/chat.c
index df535c4f..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) {
- do_error_dialog(sess->aux_data, "chat connection with no name!", "Gaim");
+ 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) {
- do_error_dialog(sess->aux_data, "Only detaillevel 0x2 is support at the moment", "Gaim");
+ 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) {
- do_error_dialog(sess->aux_data, "unknown channel!", "Gaim");
+ imcb_error(sess->aux_data, "unknown channel!");
return 0;
}
diff --git a/protocols/oscar/chatnav.c b/protocols/oscar/chatnav.c
index c7e11765..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))) {
- do_error_dialog(sess->aux_data, "no bigblock in top tlv in create room response", "Gaim");
+ 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) {
- do_error_dialog(sess->aux_data, "unknown detaillevel in create room response", "Gaim");
+ 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))) {
- do_error_dialog(sess->aux_data, "received response to unknown request!", "Gaim");
+ imcb_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");
+ 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
- do_error_dialog(sess->aux_data, "unknown request subtype", "Gaim");
+ 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 23959b75..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);
- do_error_dialog(sess->aux_data, "corrupt ICQ response\n", "Gaim");
+ imcb_error(sess->aux_data, "corrupt ICQ response\n");
return 0;
}
diff --git a/protocols/oscar/im.c b/protocols/oscar/im.c
index 7cccabc7..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) {
- do_error_dialog(sess->aux_data, "icbm: ICBM recieved on unsupported channel. Ignoring.", "Gaim");
+ 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 {
- // do_error_dialog(sess->aux_data, "Unknown TLV encountered", "Gaim");
+ // imcb_error(sess->aux_data, "Unknown TLV encountered");
}
/*
@@ -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;
}
@@ -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");
+ 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 {
- do_error_dialog(sess->aux_data, "ICBM received on an unsupported channel. Ignoring.", "Gaim");
+ 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 0f1bcfd2..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
- // do_error_dialog(sess->aux_data, G_STRLOC, "Unknown TLV encountered");
+ // 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) {
- do_error_dialog(sess->aux_data, "major problem: no snac stored!", "Gaim");
+ 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)) {
- do_error_dialog(sess->aux_data, "unknown infotype in request!", "Gaim");
+ imcb_error(sess->aux_data, "unknown infotype in request!");
return 0;
}
diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c
index 72078b3c..426dd4a2 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,25 +157,9 @@ 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,
+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) {
@@ -258,43 +242,41 @@ 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);
+ imc_logout(ic, TRUE);
} 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);
+ 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(gc, conn);
- char buf[BUF_LONG];
+ struct chat_connection *c = find_oscar_chat_by_conn(ic, conn);
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!"));
+ 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);
@@ -305,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"));
+ imcb_error(sess->aux_data, _("Chat is currently unavailable"));
}
aim_conn_kill(odata->sess, &conn);
} else if (conn->type == AIM_CONN_TYPE_AUTH) {
@@ -328,34 +309,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);
+ imcb_error(ic, _("Couldn't connect to host"));
+ imc_logout(ic, TRUE);
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;
@@ -371,18 +352,19 @@ static void oscar_acc_init(account_t *acc)
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 = 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... </bitlbee> */
- gc->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 {
- gc->flags |= OPT_CONN_HTML;
+ ic->flags |= OPT_DOES_HTML;
}
sess = g_new0(aim_session_t, 1);
@@ -393,44 +375,43 @@ 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);
+ imcb_error(ic, _("Unable to login to AIM"));
+ imc_logout(ic, TRUE);
return;
}
if (acc->server == NULL) {
- hide_login_progress(gc, "No servername specified");
- signoff(gc);
+ 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) {
- serv_got_crap(gc, "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);
}
- g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username);
- set_login_progress(gc, 2, buf);
+ 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, 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);
+ imcb_error(ic, _("Couldn't connect to host"));
+ imc_logout(ic, TRUE);
return;
}
- aim_request_login(sess, conn, gc->username);
+ aim_request_login(sess, conn, ic->acc->user);
}
-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;
@@ -453,8 +434,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)
@@ -462,35 +443,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);
+ imcb_error(ic, _("Could Not Connect"));
+ imc_logout(ic, TRUE);
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"));
+ imcb_log(ic, _("Connection established, cookie sent"));
return FALSE;
}
@@ -501,8 +482,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);
@@ -513,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 */
- hide_login_progress(gc, _("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 */
- hide_login_progress(gc, _("Your account is currently suspended."));
+ imcb_error(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."));
+ 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 */
- hide_login_progress(gc, _("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:
- hide_login_progress(gc, _("Authentication Failed"));
+ imcb_error(ic, _("Authentication Failed"));
break;
}
od->killme = TRUE;
@@ -541,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) {
- hide_login_progress(gc, _("Internal Error"));
+ imcb_error(ic, _("Internal Error"));
od->killme = TRUE;
return 0;
}
@@ -575,7 +556,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]));
@@ -584,21 +565,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"));
+ imcb_error(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;
@@ -610,7 +591,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];
@@ -625,8 +606,8 @@ 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."
- " You may be disconnected shortly.", "Login Error");
+ 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);
g_free(pos);
@@ -648,8 +629,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->gc, "Gaim was unable to get a valid hash for logging into AIM."
- " You may be disconnected shortly.", "Login Error");
+ 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);
g_free(pos);
@@ -714,7 +695,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,8 +707,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");
+ 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;
@@ -742,19 +723,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->acc->user, ic->acc->pass, &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;
@@ -766,9 +747,10 @@ 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, id++, chatcon->show);
+ chatcon->cnv = imcb_chat_new(ic, chatcon->show);
+ chatcon->cnv->data = chatcon;
return 1;
}
@@ -786,17 +768,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);
@@ -814,17 +796,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);
@@ -843,12 +825,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);
@@ -856,7 +838,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;
@@ -881,7 +863,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;
@@ -913,7 +895,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);
@@ -930,7 +912,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);
@@ -952,7 +934,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;
@@ -981,49 +963,39 @@ 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;
- 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;
@@ -1032,13 +1004,13 @@ 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->acc->user));
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,
- 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;
}
@@ -1046,24 +1018,24 @@ 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);
+ imcb_buddy_status(ic, info->sn, 0, NULL, NULL );
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)
- flags |= IM_FLAG_AWAY;
+ flags |= OPT_AWAY;
if ((args->icbmflags & AIM_IMFLAGS_UNICODE) || (args->icbmflags & AIM_IMFLAGS_ISO_8859_1)) {
char *src;
@@ -1097,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(gc, userinfo->sn, tmp, flags, time(NULL), -1);
+ imcb_buddy_msg(ic, userinfo->sn, tmp, flags, 0);
g_free(tmp);
return 1;
@@ -1107,7 +1079,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;
@@ -1125,11 +1097,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);
+ imcb_ask( ic, txt, inv, oscar_accept_chat, oscar_reject_chat);
if (name)
g_free(name);
@@ -1140,14 +1112,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(imcb_find_buddy(data->ic, uin) == NULL)
+ imcb_ask_add(data->ic, uin, NULL);
g_free(uin);
g_free(data);
@@ -1155,7 +1127,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.");
@@ -1170,7 +1142,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;
@@ -1179,14 +1151,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);
+ imcb_ask(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. */
@@ -1194,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(gc, uin, message, 0, time(NULL), -1);
+ imcb_buddy_msg(ic, uin, message, 0, 0);
g_free(uin);
g_free(message);
} break;
@@ -1213,22 +1185,22 @@ 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);
+ imcb_buddy_msg(ic, uin, message, 0, 0);
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 */
- 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.") );
+ 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 */
- 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.") );
+ 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: {
@@ -1283,7 +1255,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);
@@ -1295,8 +1266,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),
+ 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."),
@@ -1305,8 +1275,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),
+ 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."),
@@ -1315,8 +1284,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) {
break;
case 2:
/* Rate exceeded */
- g_snprintf(buf,
- sizeof(buf),
+ 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."),
@@ -1325,8 +1293,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) {
break;
case 3:
/* Evil Sender */
- g_snprintf(buf,
- sizeof(buf),
+ 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."),
@@ -1335,8 +1302,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) {
break;
case 4:
/* Evil Receiver */
- g_snprintf(buf,
- sizeof(buf),
+ 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."),
@@ -1344,8 +1310,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) {
userinfo->sn);
break;
default:
- g_snprintf(buf,
- sizeof(buf),
+ 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."),
@@ -1353,7 +1318,6 @@ 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"));
return 1;
}
@@ -1361,16 +1325,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);
+ imcb_error(sess->aux_data, _("SNAC threw error: %s"),
+ reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error");
return 1;
}
@@ -1379,16 +1340,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,
+ imcb_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;
}
@@ -1397,17 +1356,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,
+ imcb_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;
}
@@ -1423,8 +1379,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"));
+ imcb_error(sess->aux_data, _("Your connection may be lost."));
return 1;
}
@@ -1432,8 +1387,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);
@@ -1491,7 +1446,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;
@@ -1505,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;
}
@@ -1514,7 +1469,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;
@@ -1528,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;
}
@@ -1542,8 +1497,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 *);
@@ -1569,8 +1524,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);
@@ -1579,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(gc, ccon->id, info->sn, 0, tmp, time((time_t)NULL));
+ imcb_chat_msg(ccon->cnv, info->sn, tmp, 0, 0);
g_free(tmp);
return 1;
@@ -1618,8 +1573,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"));
+ 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) {
aim_conn_setlatency(fr->conn, 0);
@@ -1631,14 +1586,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;
}
@@ -1660,8 +1615,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);
@@ -1718,8 +1673,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);
@@ -1729,7 +1684,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;
@@ -1738,8 +1693,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);
@@ -1755,8 +1710,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);
@@ -1779,7 +1734,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 *);
@@ -1792,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(gc, sender, dialog_msg, 0, t, -1);
+ imcb_buddy_msg(ic, sender, dialog_msg, 0, t);
g_free(dialog_msg);
} break;
@@ -1813,21 +1768,21 @@ 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);
+ imcb_buddy_msg(ic, sender, dialog_msg, 0, t);
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 */
- 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.") );
+ 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 */
- 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.") );
+ 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: {
@@ -1847,15 +1802,15 @@ 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;
- if (imflags & IM_FLAG_AWAY) {
+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) {
ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message);
} else {
struct aim_sendimext_args args;
@@ -1906,7 +1861,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);
@@ -1916,10 +1871,10 @@ 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);
+ struct buddy *budlight = imcb_find_buddy(g, who);
if (budlight)
if ((budlight->uc & 0xff80) >> 7)
if (budlight->caps & AIM_CAPS_ICQSERVERRELAY)
@@ -1928,7 +1883,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"))) {
@@ -1940,13 +1895,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");
+ imcb_error(ic, "oscar_set_away_aim called before locate rights received");
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);
@@ -1954,30 +1909,24 @@ static void oscar_set_away_aim(struct gaim_connection *gc, 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);
-
- do_error_dialog(gc, errstr, "Away Message Too Long");
-
- g_free(errstr);
+ imcb_error(ic, "Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen);
}
- 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;
@@ -1993,33 +1942,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;
}
}
@@ -2027,23 +1976,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));
@@ -2054,7 +2003,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;
@@ -2063,27 +2012,29 @@ 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) && (!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(gc, 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;
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++;
}
}
@@ -2092,11 +2043,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++;
}
}
@@ -2105,8 +2056,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++;
}
}
@@ -2124,7 +2075,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);
+ imcb_connected(ic);
return 1;
}
@@ -2146,7 +2097,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" );
+ imcb_error( sess->aux_data, "Received SSI ACK package with non-even length");
return( 0 );
}
count >>= 1;
@@ -2155,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 )
{
- serv_got_crap( 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 );
}
+ else
+ {
+ imcb_error( sess->aux_data, "Error while adding buddy: 0x%04x", st );
+ }
list += strlen( list ) + 1;
}
}
@@ -2169,22 +2128,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->acc->user);
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->acc->user);
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);
@@ -2193,7 +2152,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);
@@ -2204,15 +2163,14 @@ static void oscar_set_permit_deny(struct gaim_connection *gc) {
default:
break;
}
- signoff_blocked(gc);
} 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 {
@@ -2221,8 +2179,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 {
@@ -2231,25 +2189,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)
@@ -2268,7 +2226,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;
@@ -2296,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;
@@ -2344,7 +2303,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);
+ imcb_log(ic, "%s\n%s", _("User Info"), str->str);
g_string_free(str, TRUE);
return 1;
@@ -2409,7 +2368,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;
@@ -2438,18 +2397,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);
+ imcb_log(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);
+ imcb_log(ic, "%s\n%s", _("User Info"), utf8);
} else {
- serv_got_crap(gc, _("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);
- serv_got_crap(gc, "%s\n%s", _("Away Message"), utf8);
+ imcb_log(ic, "%s\n%s", _("Away Message"), utf8);
}
g_free(utf8);
@@ -2459,7 +2418,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;
@@ -2472,65 +2431,37 @@ int gaim_parsemtn(aim_session_t *sess, aim_frame_t *fr, ...)
if(type2 == 0x0002) {
/* User is typing */
- serv_got_typing(gc, 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(gc, sn, 0, 2);
+ imcb_buddy_typing(ic, sn, OPT_THINKING);
}
else {
/* User has stopped typing */
- serv_got_typing(gc, sn, 0, 0);
+ imcb_buddy_typing(ic, sn, 0);
}
return 1;
}
-static char *oscar_get_status_string( struct gaim_connection *gc, int number )
+int oscar_send_typing(struct im_connection *ic, char * who, int typing)
{
- struct oscar_data *od = gc->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 gaim_connection *gc, char * who, int typing)
-{
- struct oscar_data *od = gc->proto_data;
- return( aim_im_sendmtn(od->sess, 1, who, typing ? 0x0002 : 0x0000) );
+ struct oscar_data *od = ic->proto_data;
+ return( aim_im_sendmtn(od->sess, 1, who, (typing & OPT_TYPING) ? 0x0002 : 0x0000) );
}
-int oscar_chat_send(struct gaim_connection * gc, int id, char *message)
+void oscar_chat_msg(struct groupchat *c, char *message, int msgflags)
{
- 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);
guint16 flags;
char *s;
- if(!(ccon = find_oscar_chat(gc, id)))
- return -1;
+ ccon = c->data;
for (s = message; *s; s++)
if (*s & 128)
@@ -2564,27 +2495,25 @@ int oscar_chat_send(struct gaim_connection * gc, int id, char *message)
g_free(s);
}
- return (ret >= 0);
+/* return (ret >= 0); */
}
-void oscar_chat_invite(struct gaim_connection * gc, int id, char *message, char *who)
+void oscar_chat_invite(struct groupchat *c, char *message, char *who)
{
- struct oscar_data * od = (struct oscar_data *)gc->proto_data;
- struct chat_connection *ccon = find_oscar_chat(gc, id);
-
- if (ccon == NULL)
- return;
+ 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(gc, cc->id);
+ imcb_chat_removed(cc->cnv);
/* Destroy the chat_connection */
od->oscar_chats = g_slist_remove(od->oscar_chats, cc);
@@ -2596,57 +2525,55 @@ 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 groupchat *c)
{
- struct chat_connection * ccon = find_oscar_chat(gc, id);
-
- if(ccon == NULL)
- return;
-
- oscar_chat_kill(gc, ccon);
+ oscar_chat_kill(c->ic, c->data);
}
-int oscar_chat_join(struct gaim_connection * gc, char * name)
+struct groupchat *oscar_chat_join(struct im_connection * ic, char * room, char * nick, char * password )
{
- struct oscar_data * od = (struct oscar_data *)gc->proto_data;
-
+ 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;
}
}
-int 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;
- int ret;
+ struct oscar_data * od = (struct oscar_data *)ic->proto_data;
+ struct groupchat *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->acc->user, chat_id++);
- ret = oscar_chat_join(gc, chatname);
+ ret = oscar_chat_join(ic, chatname, NULL, NULL);
aim_chat_invite(od->sess, od->conn, who, "", 4, chatname, 0x0);
g_free(chatname);
- return ret;
+ return NULL;
}
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, NULL, NULL);
g_free(inv->name);
g_free(inv);
}
@@ -2657,31 +2584,31 @@ 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->send_im = oscar_send_im;
+ ret->keepalive = oscar_keepalive;
+ ret->logout = oscar_logout;
+ 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_open = oscar_chat_open;
+ 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;
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;
ret->handle_cmp = aim_sncmp;
diff --git a/protocols/oscar/rxqueue.c b/protocols/oscar/rxqueue.c
index 6e8dd29c..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);
- do_error_dialog(sess->aux_data, "FLAP framing disrupted", "Gaim");
+ 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 9685a3d1..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))) {
- do_error_dialog(sess->aux_data, "couldn't get snac", "Gaim");
+ imcb_error(sess->aux_data, "couldn't get snac");
return 0;
}
diff --git a/protocols/oscar/service.c b/protocols/oscar/service.c
index d55e0987..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);
- do_error_dialog(sess->aux_data, "bifurcated migration unsupported", "Gaim");
+ imcb_error(sess->aux_data, "bifurcated migration unsupported");
}
tl = aim_readtlvchain(bs);
@@ -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);
@@ -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");
+ imcb_error(sess->aux_data, "WARNING: unknown hash request");
}
diff --git a/protocols/oscar/txqueue.c b/protocols/oscar/txqueue.c
index 6b4854c5..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) {
- do_error_dialog(sess->aux_data, "no connection specified", "Gaim");
+ 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
- do_error_dialog(sess->aux_data, "unknown framing", "Gaim");
+ 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) {
- do_error_dialog(sess->aux_data, "WARNING: enqueueing packet with no connection", "Gaim");
+ 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) {
- do_error_dialog(sess->aux_data, "packet has no connection", "Gaim");
+ imcb_error(sess->aux_data, "packet has no connection");
aim_frame_destroy(fr);
return 0;
}