diff options
Diffstat (limited to 'protocols/oscar/oscar.c')
-rw-r--r-- | protocols/oscar/oscar.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 7086657a..f5b5c114 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -253,8 +253,6 @@ static char *normalize(const char *s) g_return_val_if_fail((s != NULL), NULL); u = t = g_strdup(s); - - strcpy(t, s); g_strdown(t); while (*t && (x < BUF_LEN - 1)) { @@ -651,6 +649,7 @@ static int gaim_parse_logout(aim_session_t *sess, aim_frame_t *fr, ...) { static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { struct im_connection *ic = sess->aux_data; struct chat_connection *chatcon; + struct groupchat *c = NULL; static int id = 1; aim_conn_addhandler(sess, fr->conn, 0x000e, 0x0001, gaim_parse_genericerr, 0); @@ -663,7 +662,12 @@ 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 = imcb_chat_new(ic, chatcon->show); + + c = bee_chat_by_title(ic->bee, ic, chatcon->show); + if (c && !c->data) + chatcon->cnv = c; + else + chatcon->cnv = imcb_chat_new(ic, chatcon->show); chatcon->cnv->data = chatcon; return 1; @@ -1059,8 +1063,7 @@ static void gaim_icq_authgrant(void *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(imcb_find_buddy(data->ic, uin) == NULL) - imcb_ask_add(data->ic, uin, NULL); + imcb_ask_add(data->ic, uin, NULL); g_free(uin); g_free(data); @@ -1821,11 +1824,13 @@ 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) { + /** FIXME(wilmer): Hmm, lost the ability to get away msgs here, do we care to get that back? struct buddy *budlight = imcb_find_buddy(g, who); if (budlight) if ((budlight->uc & 0xff80) >> 7) if (budlight->caps & AIM_CAPS_ICQSERVERRELAY) aim_send_im_ch2_geticqmessage(odata->sess, who, (budlight->uc & 0xff80) >> 7); + */ } else aim_getinfo(odata->sess, odata->conn, who, AIM_GETINFO_AWAYMESSAGE); } @@ -1952,7 +1957,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 im_connection *ic = sess->aux_data; - struct aim_ssi_item *curitem; + struct aim_ssi_item *curitem, *curgroup; int tmp; char *nrm; @@ -1963,13 +1968,13 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { switch (curitem->type) { case 0x0000: /* Buddy */ - if ((curitem->name) && (!imcb_find_buddy(ic, nrm))) { + if ((curitem->name) && (!imcb_buddy_by_handle(ic, nrm))) { char *realname = NULL; if (curitem->data && aim_gettlv(curitem->data, 0x0131, 1)) realname = aim_gettlv_str(curitem->data, 0x0131, 1); - - imcb_add_buddy(ic, nrm, NULL); + + imcb_add_buddy(ic, nrm, curgroup->gid == curitem->gid ? curgroup->name : NULL); if (realname) { imcb_buddy_nick_hint(ic, nrm, realname); @@ -1979,6 +1984,10 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { } break; + case 0x0001: /* Group */ + curgroup = curitem; + break; + case 0x0002: /* Permit buddy */ if (curitem->name) { GSList *list; @@ -2519,12 +2528,13 @@ struct groupchat *oscar_chat_with(struct im_connection * ic, char *who) struct groupchat *ret; static int chat_id = 0; char * chatname; + struct groupchat *c; chatname = g_strdup_printf("%s%s_%d", isdigit(*ic->acc->user) ? "icq_" : "", ic->acc->user, chat_id++); - + + c = imcb_chat_new(ic, chatname); ret = oscar_chat_join(ic, chatname, NULL, NULL); - aim_chat_invite(od->sess, od->conn, who, "", 4, chatname, 0x0); g_free(chatname); |