comparison src/protocols/oscar/oscar.c @ 4491:3196d9044a45

[gaim-migrate @ 4766] aim_user is dead. long live gaim_account. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 31 Jan 2003 13:03:47 +0000
parents 53723b58fe15
children 4c40fccbd7c9
comparison
equal deleted inserted replaced
4490:70b892694e0b 4491:3196d9044a45
635 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, 635 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ,
636 oscar_callback, conn); 636 oscar_callback, conn);
637 debug_printf("Password sent, waiting for response\n"); 637 debug_printf("Password sent, waiting for response\n");
638 } 638 }
639 639
640 static void oscar_login(struct aim_user *user) { 640 static void oscar_login(struct gaim_account *account) {
641 aim_session_t *sess; 641 aim_session_t *sess;
642 aim_conn_t *conn; 642 aim_conn_t *conn;
643 char buf[256]; 643 char buf[256];
644 struct gaim_connection *gc = new_gaim_conn(user); 644 struct gaim_connection *gc = new_gaim_conn(account);
645 struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1); 645 struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1);
646 646
647 if (isdigit(*user->username)) { 647 if (isdigit(*account->username)) {
648 odata->icq = TRUE; 648 odata->icq = TRUE;
649 gc->password[8] = 0; 649 gc->password[8] = 0;
650 } else { 650 } else {
651 gc->flags |= OPT_CONN_HTML; 651 gc->flags |= OPT_CONN_HTML;
652 gc->flags |= OPT_CONN_AUTO_RESP; 652 gc->flags |= OPT_CONN_AUTO_RESP;
677 677
678 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); 678 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
679 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); 679 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0);
680 680
681 conn->status |= AIM_CONN_STATUS_INPROGRESS; 681 conn->status |= AIM_CONN_STATUS_INPROGRESS;
682 if (proxy_connect(user->proto_opt[USEROPT_AUTH][0] ? 682 if (proxy_connect(account->proto_opt[USEROPT_AUTH][0] ?
683 user->proto_opt[USEROPT_AUTH] : FAIM_LOGIN_SERVER, 683 account->proto_opt[USEROPT_AUTH] : FAIM_LOGIN_SERVER,
684 user->proto_opt[USEROPT_AUTHPORT][0] ? 684 account->proto_opt[USEROPT_AUTHPORT][0] ?
685 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, 685 atoi(account->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT,
686 oscar_login_connect, gc) < 0) { 686 oscar_login_connect, gc) < 0) {
687 hide_login_progress(gc, _("Couldn't connect to host")); 687 hide_login_progress(gc, _("Couldn't connect to host"));
688 signoff(gc); 688 signoff(gc);
689 return; 689 return;
690 } 690 }
691 aim_request_login(sess, conn, gc->username); 691 aim_request_login(sess, conn, gc->username);
801 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { 801 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) {
802 va_list ap; 802 va_list ap;
803 struct aim_authresp_info *info; 803 struct aim_authresp_info *info;
804 int i, rc; 804 int i, rc;
805 char *host; int port; 805 char *host; int port;
806 struct aim_user *user; 806 struct gaim_account *account;
807 aim_conn_t *bosconn; 807 aim_conn_t *bosconn;
808 808
809 struct gaim_connection *gc = sess->aux_data; 809 struct gaim_connection *gc = sess->aux_data;
810 struct oscar_data *od = gc->proto_data; 810 struct oscar_data *od = gc->proto_data;
811 user = gc->user; 811 account = gc->account;
812 port = user->proto_opt[USEROPT_AUTHPORT][0] ? 812 port = account->proto_opt[USEROPT_AUTHPORT][0] ?
813 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, 813 atoi(account->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT,
814 814
815 va_start(ap, fr); 815 va_start(ap, fr);
816 info = va_arg(ap, struct aim_authresp_info *); 816 info = va_arg(ap, struct aim_authresp_info *);
817 va_end(ap); 817 va_end(ap);
818 818
1279 /* Hrmph. I don't know how to make this look better. --mid */ 1279 /* Hrmph. I don't know how to make this look better. --mid */
1280 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { 1280 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) {
1281 va_list ap; 1281 va_list ap;
1282 struct aim_redirect_data *redir; 1282 struct aim_redirect_data *redir;
1283 struct gaim_connection *gc = sess->aux_data; 1283 struct gaim_connection *gc = sess->aux_data;
1284 struct aim_user *user = gc->user; 1284 struct gaim_account *account = gc->account;
1285 aim_conn_t *tstconn; 1285 aim_conn_t *tstconn;
1286 int i; 1286 int i;
1287 char *host; 1287 char *host;
1288 int port; 1288 int port;
1289 1289
1290 port = user->proto_opt[USEROPT_AUTHPORT][0] ? 1290 port = account->proto_opt[USEROPT_AUTHPORT][0] ?
1291 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, 1291 atoi(account->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT,
1292 1292
1293 va_start(ap, fr); 1293 va_start(ap, fr);
1294 redir = va_arg(ap, struct aim_redirect_data *); 1294 redir = va_arg(ap, struct aim_redirect_data *);
1295 va_end(ap); 1295 va_end(ap);
1296 1296
1507 return; 1507 return;
1508 } 1508 }
1509 1509
1510 dim->conn->fd = source; 1510 dim->conn->fd = source;
1511 aim_conn_completeconnect(od->sess, dim->conn); 1511 aim_conn_completeconnect(od->sess, dim->conn);
1512 if (!(cnv = gaim_find_conversation(dim->name))) 1512 if (!(cnv = gaim_find_conversation(dim->name)))
1513 cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->user, dim->name); 1513 cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, dim->name);
1514 1514
1515 /* This is the best way to see if we're connected or not */ 1515 /* This is the best way to see if we're connected or not */
1516 if (getpeername(source, &name, &name_len) == 0) { 1516 if (getpeername(source, &name, &name_len) == 0) {
1517 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name); 1517 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name);
1518 dim->connected = TRUE; 1518 dim->connected = TRUE;
1811 ir->length = args->iconlen; 1811 ir->length = args->iconlen;
1812 ir->checksum = args->iconsum; 1812 ir->checksum = args->iconsum;
1813 ir->timestamp = args->iconstamp; 1813 ir->timestamp = args->iconstamp;
1814 } 1814 }
1815 1815
1816 if (gc->user->iconfile[0] && (args->icbmflags & AIM_IMFLAGS_BUDDYREQ)) { 1816 if (gc->account->iconfile[0] && (args->icbmflags & AIM_IMFLAGS_BUDDYREQ)) {
1817 FILE *file; 1817 FILE *file;
1818 struct stat st; 1818 struct stat st;
1819 1819
1820 if (!stat(gc->user->iconfile, &st)) { 1820 if (!stat(gc->account->iconfile, &st)) {
1821 char *buf = g_malloc(st.st_size); 1821 char *buf = g_malloc(st.st_size);
1822 file = fopen(gc->user->iconfile, "rb"); 1822 file = fopen(gc->account->iconfile, "rb");
1823 if (file) { 1823 if (file) {
1824 int len = fread(buf, 1, st.st_size, file); 1824 int len = fread(buf, 1, st.st_size, file);
1825 debug_printf("Sending buddy icon to %s (%d bytes, %lu reported)\n", 1825 debug_printf("Sending buddy icon to %s (%d bytes, %lu reported)\n",
1826 userinfo->sn, len, st.st_size); 1826 userinfo->sn, len, st.st_size);
1827 aim_send_icon(sess, userinfo->sn, buf, st.st_size, 1827 aim_send_icon(sess, userinfo->sn, buf, st.st_size,
2068 static void gaim_auth_request(struct name_data *data, char *msg) { 2068 static void gaim_auth_request(struct name_data *data, char *msg) {
2069 struct gaim_connection *gc = data->gc; 2069 struct gaim_connection *gc = data->gc;
2070 2070
2071 if (g_slist_find(connections, gc)) { 2071 if (g_slist_find(connections, gc)) {
2072 struct oscar_data *od = gc->proto_data; 2072 struct oscar_data *od = gc->proto_data;
2073 struct buddy *buddy = find_buddy(gc->user, data->name); 2073 struct buddy *buddy = find_buddy(gc->account, data->name);
2074 struct group *group = find_group_by_buddy(buddy); 2074 struct group *group = find_group_by_buddy(buddy);
2075 if (buddy && group) { 2075 if (buddy && group) {
2076 debug_printf("ssi: adding buddy %s to group %s\n", buddy->name, group->name); 2076 debug_printf("ssi: adding buddy %s to group %s\n", buddy->name, group->name);
2077 aim_ssi_sendauthrequest(od->sess, od->conn, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); 2077 aim_ssi_sendauthrequest(od->sess, od->conn, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list."));
2078 if (!aim_ssi_itemlist_finditem(od->sess->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY)) 2078 if (!aim_ssi_itemlist_finditem(od->sess->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY))
2099 static void gaim_auth_sendrequest(struct gaim_connection *gc, char *name) { 2099 static void gaim_auth_sendrequest(struct gaim_connection *gc, char *name) {
2100 struct name_data *data = g_new(struct name_data, 1); 2100 struct name_data *data = g_new(struct name_data, 1);
2101 struct buddy *buddy; 2101 struct buddy *buddy;
2102 gchar *dialog_msg, *nombre; 2102 gchar *dialog_msg, *nombre;
2103 2103
2104 buddy = find_buddy(gc->user, name); 2104 buddy = find_buddy(gc->account, name);
2105 if (buddy && (get_buddy_alias_only(buddy))) 2105 if (buddy && (get_buddy_alias_only(buddy)))
2106 nombre = g_strdup_printf("%s (%s)", name, get_buddy_alias_only(buddy)); 2106 nombre = g_strdup_printf("%s (%s)", name, get_buddy_alias_only(buddy));
2107 else 2107 else
2108 nombre = g_strdup(name); 2108 nombre = g_strdup(name);
2109 2109
2125 struct oscar_data *od = gc->proto_data; 2125 struct oscar_data *od = gc->proto_data;
2126 #ifdef NOSSI 2126 #ifdef NOSSI
2127 struct buddy *buddy; 2127 struct buddy *buddy;
2128 gchar message; 2128 gchar message;
2129 message = 0; 2129 message = 0;
2130 buddy = find_buddy(gc->user, data->name); 2130 buddy = find_buddy(gc->account, data->name);
2131 aim_send_im_ch4(od->sess, data->name, AIM_ICQMSG_AUTHGRANTED, &message); 2131 aim_send_im_ch4(od->sess, data->name, AIM_ICQMSG_AUTHGRANTED, &message);
2132 show_got_added(gc, NULL, data->name, (buddy ? get_buddy_alias_only(buddy) : NULL), NULL); 2132 show_got_added(gc, NULL, data->name, (buddy ? get_buddy_alias_only(buddy) : NULL), NULL);
2133 #else 2133 #else
2134 aim_ssi_sendauthreply(od->sess, od->conn, data->name, 0x01, NULL); 2134 aim_ssi_sendauthreply(od->sess, od->conn, data->name, 0x01, NULL);
2135 #endif 2135 #endif
3272 odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen; 3272 odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen;
3273 3273
3274 if (odata->icq) 3274 if (odata->icq)
3275 aim_bos_setprofile(sess, fr->conn, NULL, NULL, 0, NULL, NULL, 0, caps_icq); 3275 aim_bos_setprofile(sess, fr->conn, NULL, NULL, 0, NULL, NULL, 0, caps_icq);
3276 else { 3276 else {
3277 flags = check_encoding (gc->user->user_info); 3277 flags = check_encoding (gc->account->user_info);
3278 3278
3279 if (flags == 0) { 3279 if (flags == 0) {
3280 aim_bos_setprofile(sess, fr->conn, "us-ascii", gc->user->user_info, 3280 aim_bos_setprofile(sess, fr->conn, "us-ascii", gc->account->user_info,
3281 strlen(gc->user->user_info), NULL, NULL, 0, caps_aim); 3281 strlen(gc->account->user_info), NULL, NULL, 0, caps_aim);
3282 } else { 3282 } else {
3283 unicode = g_convert (gc->user->user_info, strlen(gc->user->user_info), 3283 unicode = g_convert (gc->account->user_info, strlen(gc->account->user_info),
3284 "UCS-2BE", "UTF-8", NULL, &unicode_len, NULL); 3284 "UCS-2BE", "UTF-8", NULL, &unicode_len, NULL);
3285 aim_bos_setprofile(sess, fr->conn, "unicode-2-0", unicode, unicode_len, 3285 aim_bos_setprofile(sess, fr->conn, "unicode-2-0", unicode, unicode_len,
3286 NULL, NULL, 0, caps_aim); 3286 NULL, NULL, 0, caps_aim);
3287 g_free(unicode); 3287 g_free(unicode);
3288 } 3288 }
3414 * and show it in the same window as info. g_show_info_text gets the status 3414 * and show it in the same window as info. g_show_info_text gets the status
3415 * message if the third arg is 0 (this seems really gross to me). The 3415 * message if the third arg is 0 (this seems really gross to me). The
3416 * parse-icq-status-message function knows if it is putting it's message in 3416 * parse-icq-status-message function knows if it is putting it's message in
3417 * an info window because the name will _not_ be in od->evilhack. For getting 3417 * an info window because the name will _not_ be in od->evilhack. For getting
3418 * only the away message the contact's UIN is put in od->evilhack. */ 3418 * only the away message the contact's UIN is put in od->evilhack. */
3419 if ((budlight = find_buddy(gc->user, who))) { 3419 if ((budlight = find_buddy(gc->account, who))) {
3420 if ((budlight->uc >> 16) & (AIM_ICQ_STATE_AWAY || AIM_ICQ_STATE_DND || AIM_ICQ_STATE_OUT || AIM_ICQ_STATE_BUSY || AIM_ICQ_STATE_CHAT)) { 3420 if ((budlight->uc >> 16) & (AIM_ICQ_STATE_AWAY || AIM_ICQ_STATE_DND || AIM_ICQ_STATE_OUT || AIM_ICQ_STATE_BUSY || AIM_ICQ_STATE_CHAT)) {
3421 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY) 3421 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY)
3422 g_show_info_text(gc, who, 0, buf, NULL); 3422 g_show_info_text(gc, who, 0, buf, NULL);
3423 else { 3423 else {
3424 char *state_msg = gaim_icq_status((budlight->uc & 0xffff0000) >> 16); 3424 char *state_msg = gaim_icq_status((budlight->uc & 0xffff0000) >> 16);
3711 ir->request = FALSE; 3711 ir->request = FALSE;
3712 args.flags |= AIM_IMFLAGS_BUDDYREQ; 3712 args.flags |= AIM_IMFLAGS_BUDDYREQ;
3713 debug_printf("sending buddy icon request with message\n"); 3713 debug_printf("sending buddy icon request with message\n");
3714 } 3714 }
3715 3715
3716 if (gc->user->iconfile[0] && !stat(gc->user->iconfile, &st)) { 3716 if (gc->account->iconfile[0] && !stat(gc->account->iconfile, &st)) {
3717 FILE *file = fopen(gc->user->iconfile, "r"); 3717 FILE *file = fopen(gc->account->iconfile, "r");
3718 if (file) { 3718 if (file) {
3719 char *buf = g_malloc(st.st_size); 3719 char *buf = g_malloc(st.st_size);
3720 fread(buf, 1, st.st_size, file); 3720 fread(buf, 1, st.st_size, file);
3721 3721
3722 args.iconlen = st.st_size; 3722 args.iconlen = st.st_size;
3781 } 3781 }
3782 3782
3783 static void oscar_get_away(struct gaim_connection *g, char *who) { 3783 static void oscar_get_away(struct gaim_connection *g, char *who) {
3784 struct oscar_data *odata = (struct oscar_data *)g->proto_data; 3784 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
3785 if (odata->icq) { 3785 if (odata->icq) {
3786 struct buddy *budlight = find_buddy(g->user, who); 3786 struct buddy *budlight = find_buddy(g->account, who);
3787 if (budlight) 3787 if (budlight)
3788 if ((budlight->uc & 0xffff0000) >> 16) 3788 if ((budlight->uc & 0xffff0000) >> 16)
3789 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY) 3789 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY)
3790 aim_send_im_ch2_geticqmessage(odata->sess, who, (budlight->uc & 0xffff0000) >> 16); 3790 aim_send_im_ch2_geticqmessage(odata->sess, who, (budlight->uc & 0xffff0000) >> 16);
3791 else 3791 else
3914 g_free(gc->away); 3914 g_free(gc->away);
3915 gc->away = NULL; 3915 gc->away = NULL;
3916 } 3916 }
3917 3917
3918 if (strcmp(state, _("Invisible"))) { 3918 if (strcmp(state, _("Invisible"))) {
3919 if (aim_ssi_getpermdeny(od->sess->ssi.local) != gc->user->permdeny) 3919 if (aim_ssi_getpermdeny(od->sess->ssi.local) != gc->account->permdeny)
3920 aim_ssi_setpermdeny(od->sess, od->conn, gc->user->permdeny, 3920 aim_ssi_setpermdeny(od->sess, od->conn, gc->account->permdeny,
3921 0xffffffff); 3921 0xffffffff);
3922 gc->user->permdeny = 4; 3922 gc->account->permdeny = 4;
3923 } else { 3923 } else {
3924 if (aim_ssi_getpermdeny(od->sess->ssi.local) != 0x03) 3924 if (aim_ssi_getpermdeny(od->sess->ssi.local) != 0x03)
3925 aim_ssi_setpermdeny(od->sess, od->conn, 0x03, 0xffffffff); 3925 aim_ssi_setpermdeny(od->sess, od->conn, 0x03, 0xffffffff);
3926 gc->user->permdeny = 3; 3926 gc->account->permdeny = 3;
3927 } 3927 }
3928 3928
3929 if (!strcmp(state, _("Online"))) 3929 if (!strcmp(state, _("Online")))
3930 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); 3930 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
3931 else if (!strcmp(state, _("Away"))) { 3931 else if (!strcmp(state, _("Away"))) {
3986 struct oscar_data *od = (struct oscar_data *)gc->proto_data; 3986 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
3987 #ifdef NOSSI 3987 #ifdef NOSSI
3988 aim_add_buddy(od->sess, od->conn, name); 3988 aim_add_buddy(od->sess, od->conn, name);
3989 #else 3989 #else
3990 if ((od->sess->ssi.received_data) && !(aim_ssi_itemlist_exists(od->sess->ssi.local, name))) { 3990 if ((od->sess->ssi.received_data) && !(aim_ssi_itemlist_exists(od->sess->ssi.local, name))) {
3991 struct buddy *buddy = find_buddy(gc->user, name); 3991 struct buddy *buddy = find_buddy(gc->account, name);
3992 struct group *group = find_group_by_buddy(buddy); 3992 struct group *group = find_group_by_buddy(buddy);
3993 if (buddy && group) { 3993 if (buddy && group) {
3994 debug_printf("ssi: adding buddy %s to group %s\n", name, group->name); 3994 debug_printf("ssi: adding buddy %s to group %s\n", name, group->name);
3995 aim_ssi_addbuddy(od->sess, od->conn, buddy->name, group->name, get_buddy_alias_only(buddy), NULL, NULL, 0); 3995 aim_ssi_addbuddy(od->sess, od->conn, buddy->name, group->name, get_buddy_alias_only(buddy), NULL, NULL, 0);
3996 } 3996 }
4013 } 4013 }
4014 aim_bos_setbuddylist(od->sess, od->conn, buf); 4014 aim_bos_setbuddylist(od->sess, od->conn, buf);
4015 #else 4015 #else
4016 if (od->sess->ssi.received_data) { 4016 if (od->sess->ssi.received_data) {
4017 while (buddies) { 4017 while (buddies) {
4018 struct buddy *buddy = find_buddy(gc->user, (const char *)buddies->data); 4018 struct buddy *buddy = find_buddy(gc->account, (const char *)buddies->data);
4019 struct group *group = find_group_by_buddy(buddy); 4019 struct group *group = find_group_by_buddy(buddy);
4020 if (buddy && group) { 4020 if (buddy && group) {
4021 debug_printf("ssi: adding buddy %s to group %s\n", (const char *)buddies->data, group->name); 4021 debug_printf("ssi: adding buddy %s to group %s\n", (const char *)buddies->data, group->name);
4022 aim_ssi_addbuddy(od->sess, od->conn, buddy->name, group->name, get_buddy_alias_only(buddy), NULL, NULL, 0); 4022 aim_ssi_addbuddy(od->sess, od->conn, buddy->name, group->name, get_buddy_alias_only(buddy), NULL, NULL, 0);
4023 } 4023 }
4148 if (curitem->name) { 4148 if (curitem->name) {
4149 char *gname = aim_ssi_itemlist_findparentname(sess->ssi.local, curitem->name); 4149 char *gname = aim_ssi_itemlist_findparentname(sess->ssi.local, curitem->name);
4150 char *gname_utf8 = gaim_try_conv_to_utf8(gname); 4150 char *gname_utf8 = gaim_try_conv_to_utf8(gname);
4151 char *alias = aim_ssi_getalias(sess->ssi.local, gname, curitem->name); 4151 char *alias = aim_ssi_getalias(sess->ssi.local, gname, curitem->name);
4152 char *alias_utf8 = gaim_try_conv_to_utf8(alias); 4152 char *alias_utf8 = gaim_try_conv_to_utf8(alias);
4153 struct buddy *buddy = find_buddy(gc->user, curitem->name); 4153 struct buddy *buddy = find_buddy(gc->account, curitem->name);
4154 /* Should gname be freed here? -- elb */ 4154 /* Should gname be freed here? -- elb */
4155 free(alias); 4155 free(alias);
4156 if (buddy) { 4156 if (buddy) {
4157 /* Get server stored alias */ 4157 /* Get server stored alias */
4158 if (alias_utf8) 4158 if (alias_utf8)
4159 strcpy(buddy->alias, alias_utf8); 4159 strcpy(buddy->alias, alias_utf8);
4160 } else { 4160 } else {
4161 debug_printf("ssi: adding buddy %s to group %s to local list\n", curitem->name, gname); 4161 debug_printf("ssi: adding buddy %s to group %s to local list\n", curitem->name, gname);
4162 add_buddy(gc->user, (gname_utf8 ? gname_utf8 : "orphans"), curitem->name, alias_utf8); 4162 add_buddy(gc->account, (gname_utf8 ? gname_utf8 : "orphans"), curitem->name, alias_utf8);
4163 tmp++; 4163 tmp++;
4164 } 4164 }
4165 free(gname_utf8); 4165 free(gname_utf8);
4166 free(alias_utf8); 4166 free(alias_utf8);
4167 } 4167 }
4173 4173
4174 case 0x0002: { /* Permit buddy */ 4174 case 0x0002: { /* Permit buddy */
4175 if (curitem->name) { 4175 if (curitem->name) {
4176 /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */ 4176 /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */
4177 GSList *list; 4177 GSList *list;
4178 for (list=gc->user->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); 4178 for (list=gc->account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
4179 if (!list) { 4179 if (!list) {
4180 debug_printf("ssi: adding permit buddy %s to local list\n", curitem->name); 4180 debug_printf("ssi: adding permit buddy %s to local list\n", curitem->name);
4181 gaim_privacy_permit_add(gc->user, curitem->name); 4181 gaim_privacy_permit_add(gc->account, curitem->name);
4182 build_allow_list(); 4182 build_allow_list();
4183 tmp++; 4183 tmp++;
4184 } 4184 }
4185 } 4185 }
4186 } break; 4186 } break;
4187 4187
4188 case 0x0003: { /* Deny buddy */ 4188 case 0x0003: { /* Deny buddy */
4189 if (curitem->name) { 4189 if (curitem->name) {
4190 GSList *list; 4190 GSList *list;
4191 for (list=gc->user->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); 4191 for (list=gc->account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
4192 if (!list) { 4192 if (!list) {
4193 debug_printf("ssi: adding deny buddy %s to local list\n", curitem->name); 4193 debug_printf("ssi: adding deny buddy %s to local list\n", curitem->name);
4194 gaim_privacy_deny_add(gc->user, curitem->name); 4194 gaim_privacy_deny_add(gc->account, curitem->name);
4195 build_block_list(); 4195 build_block_list();
4196 tmp++; 4196 tmp++;
4197 } 4197 }
4198 } 4198 }
4199 } break; 4199 } break;
4200 4200
4201 case 0x0004: { /* Permit/deny setting */ 4201 case 0x0004: { /* Permit/deny setting */
4202 if (curitem->data) { 4202 if (curitem->data) {
4203 fu8_t permdeny; 4203 fu8_t permdeny;
4204 if ((permdeny = aim_ssi_getpermdeny(sess->ssi.local)) && (permdeny != gc->user->permdeny)) { 4204 if ((permdeny = aim_ssi_getpermdeny(sess->ssi.local)) && (permdeny != gc->account->permdeny)) {
4205 debug_printf("ssi: changing permdeny from %d to %hhu\n", gc->user->permdeny, permdeny); 4205 debug_printf("ssi: changing permdeny from %d to %hhu\n", gc->account->permdeny, permdeny);
4206 gc->user->permdeny = permdeny; 4206 gc->account->permdeny = permdeny;
4207 if (od->icq && gc->user->permdeny == 0x03) { 4207 if (od->icq && gc->account->permdeny == 0x03) {
4208 serv_set_away(gc, "Invisible", ""); 4208 serv_set_away(gc, "Invisible", "");
4209 } 4209 }
4210 tmp++; 4210 tmp++;
4211 } 4211 }
4212 } 4212 }
4230 for (cur=groups; cur; cur=g_slist_next(cur)) { 4230 for (cur=groups; cur; cur=g_slist_next(cur)) {
4231 GSList *curb; 4231 GSList *curb;
4232 struct group *group = cur->data; 4232 struct group *group = cur->data;
4233 for (curb=group->members; curb; curb=curb->next) { 4233 for (curb=group->members; curb; curb=curb->next) {
4234 struct buddy *buddy = curb->data; 4234 struct buddy *buddy = curb->data;
4235 if(buddy->user == gc->user) { 4235 if(buddy->account == gc->account) {
4236 if (aim_ssi_itemlist_exists(sess->ssi.local, buddy->name)) { 4236 if (aim_ssi_itemlist_exists(sess->ssi.local, buddy->name)) {
4237 /* Store local alias on server */ 4237 /* Store local alias on server */
4238 char *alias = aim_ssi_getalias(sess->ssi.local, group->name, buddy->name); 4238 char *alias = aim_ssi_getalias(sess->ssi.local, group->name, buddy->name);
4239 if (!alias && buddy->alias[0]) 4239 if (!alias && buddy->alias[0])
4240 aim_ssi_aliasbuddy(sess, od->conn, group->name, buddy->name, buddy->alias); 4240 aim_ssi_aliasbuddy(sess, od->conn, group->name, buddy->name, buddy->alias);
4246 } 4246 }
4247 } 4247 }
4248 } 4248 }
4249 4249
4250 /* Permit list */ 4250 /* Permit list */
4251 if (gc->user->permit) { 4251 if (gc->account->permit) {
4252 for (cur=gc->user->permit; cur; cur=cur->next) 4252 for (cur=gc->account->permit; cur; cur=cur->next)
4253 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) { 4253 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) {
4254 debug_printf("ssi: adding permit %s from local list to server list\n", (char *)cur->data); 4254 debug_printf("ssi: adding permit %s from local list to server list\n", (char *)cur->data);
4255 aim_ssi_addpermit(sess, od->conn, cur->data); 4255 aim_ssi_addpermit(sess, od->conn, cur->data);
4256 } 4256 }
4257 } 4257 }
4258 4258
4259 /* Deny list */ 4259 /* Deny list */
4260 if (gc->user->deny) { 4260 if (gc->account->deny) {
4261 for (cur=gc->user->deny; cur; cur=cur->next) 4261 for (cur=gc->account->deny; cur; cur=cur->next)
4262 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_DENY)) { 4262 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_DENY)) {
4263 debug_printf("ssi: adding deny %s from local list to server list\n", (char *)cur->data); 4263 debug_printf("ssi: adding deny %s from local list to server list\n", (char *)cur->data);
4264 aim_ssi_adddeny(sess, od->conn, cur->data); 4264 aim_ssi_adddeny(sess, od->conn, cur->data);
4265 } 4265 }
4266 } 4266 }
4274 for (cur=groups, tmp=0; cur; cur=g_slist_next(cur)) { 4274 for (cur=groups, tmp=0; cur; cur=g_slist_next(cur)) {
4275 struct group* gr = (struct group*)cur->data; 4275 struct group* gr = (struct group*)cur->data;
4276 GSList *buds = gr->members; 4276 GSList *buds = gr->members;
4277 while(buds) { 4277 while(buds) {
4278 struct buddy *b = buds->data; 4278 struct buddy *b = buds->data;
4279 if(b->user == gc->user) 4279 if(b->account == gc->account)
4280 tmp++; 4280 tmp++;
4281 buds = buds->next; 4281 buds = buds->next;
4282 } 4282 }
4283 } 4283 }
4284 if (tmp > od->rights.maxbuddies) { 4284 if (tmp > od->rights.maxbuddies) {
4347 msg = va_arg(ap, char *); 4347 msg = va_arg(ap, char *);
4348 va_end(ap); 4348 va_end(ap);
4349 4349
4350 debug_printf("ssi: %s has given you permission to add him to your buddy list\n", sn); 4350 debug_printf("ssi: %s has given you permission to add him to your buddy list\n", sn);
4351 4351
4352 buddy = find_buddy(gc->user, sn); 4352 buddy = find_buddy(gc->account, sn);
4353 if (buddy && (get_buddy_alias_only(buddy))) 4353 if (buddy && (get_buddy_alias_only(buddy)))
4354 nombre = g_strdup_printf("%s (%s)", sn, get_buddy_alias_only(buddy)); 4354 nombre = g_strdup_printf("%s (%s)", sn, get_buddy_alias_only(buddy));
4355 else 4355 else
4356 nombre = g_strdup(sn); 4356 nombre = g_strdup(sn);
4357 4357
4381 msg = va_arg(ap, char *); 4381 msg = va_arg(ap, char *);
4382 va_end(ap); 4382 va_end(ap);
4383 4383
4384 debug_printf("ssi: received authorization request from %s\n", sn); 4384 debug_printf("ssi: received authorization request from %s\n", sn);
4385 4385
4386 buddy = find_buddy(gc->user, sn); 4386 buddy = find_buddy(gc->account, sn);
4387 if (buddy && (get_buddy_alias_only(buddy))) 4387 if (buddy && (get_buddy_alias_only(buddy)))
4388 nombre = g_strdup_printf("%s (%s)", sn, get_buddy_alias_only(buddy)); 4388 nombre = g_strdup_printf("%s (%s)", sn, get_buddy_alias_only(buddy));
4389 else 4389 else
4390 nombre = g_strdup(sn); 4390 nombre = g_strdup(sn);
4391 4391
4416 msg = va_arg(ap, char *); 4416 msg = va_arg(ap, char *);
4417 va_end(ap); 4417 va_end(ap);
4418 4418
4419 debug_printf("ssi: received authorization reply from %s. Reply is 0x%04hhx\n", sn, reply); 4419 debug_printf("ssi: received authorization reply from %s. Reply is 0x%04hhx\n", sn, reply);
4420 4420
4421 buddy = find_buddy(gc->user, sn); 4421 buddy = find_buddy(gc->account, sn);
4422 if (buddy && (get_buddy_alias_only(buddy))) 4422 if (buddy && (get_buddy_alias_only(buddy)))
4423 nombre = g_strdup_printf("%s (%s)", sn, get_buddy_alias_only(buddy)); 4423 nombre = g_strdup_printf("%s (%s)", sn, get_buddy_alias_only(buddy));
4424 else 4424 else
4425 nombre = g_strdup(sn); 4425 nombre = g_strdup(sn);
4426 4426
4447 4447
4448 va_start(ap, fr); 4448 va_start(ap, fr);
4449 sn = va_arg(ap, char *); 4449 sn = va_arg(ap, char *);
4450 va_end(ap); 4450 va_end(ap);
4451 4451
4452 buddy = find_buddy(gc->user, sn); 4452 buddy = find_buddy(gc->account, sn);
4453 debug_printf("ssi: %s added you to their buddy list\n", sn); 4453 debug_printf("ssi: %s added you to their buddy list\n", sn);
4454 show_got_added(gc, NULL, sn, (buddy ? get_buddy_alias_only(buddy) : NULL), NULL); 4454 show_got_added(gc, NULL, sn, (buddy ? get_buddy_alias_only(buddy) : NULL), NULL);
4455 4455
4456 return 1; 4456 return 1;
4457 } 4457 }
4756 4756
4757 debug_printf("DirectIM: initiate success to %s\n", sn); 4757 debug_printf("DirectIM: initiate success to %s\n", sn);
4758 dim = find_direct_im(od, sn); 4758 dim = find_direct_im(od, sn);
4759 4759
4760 if (!(cnv = gaim_find_conversation(sn))) 4760 if (!(cnv = gaim_find_conversation(sn)))
4761 cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->user, sn); 4761 cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, sn);
4762 gaim_input_remove(dim->watcher); 4762 gaim_input_remove(dim->watcher);
4763 dim->conn = newconn; 4763 dim->conn = newconn;
4764 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, 4764 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
4765 oscar_callback, dim->conn); 4765 oscar_callback, dim->conn);
4766 dim->connected = TRUE; 4766 dim->connected = TRUE;
4913 4913
4914 static void oscar_get_away_msg(struct gaim_connection *gc, char *who) { 4914 static void oscar_get_away_msg(struct gaim_connection *gc, char *who) {
4915 struct oscar_data *od = gc->proto_data; 4915 struct oscar_data *od = gc->proto_data;
4916 od->evilhack = g_slist_append(od->evilhack, g_strdup(normalize(who))); 4916 od->evilhack = g_slist_append(od->evilhack, g_strdup(normalize(who)));
4917 if (od->icq) { 4917 if (od->icq) {
4918 struct buddy *budlight = find_buddy(gc->user, who); 4918 struct buddy *budlight = find_buddy(gc->account, who);
4919 if (budlight) 4919 if (budlight)
4920 if ((budlight->uc >> 16) & (AIM_ICQ_STATE_AWAY || AIM_ICQ_STATE_DND || AIM_ICQ_STATE_OUT || AIM_ICQ_STATE_BUSY || AIM_ICQ_STATE_CHAT)) 4920 if ((budlight->uc >> 16) & (AIM_ICQ_STATE_AWAY || AIM_ICQ_STATE_DND || AIM_ICQ_STATE_OUT || AIM_ICQ_STATE_BUSY || AIM_ICQ_STATE_CHAT))
4921 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY) 4921 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY)
4922 aim_send_im_ch2_geticqmessage(od->sess, who, (budlight->uc & 0xffff0000) >> 16); 4922 aim_send_im_ch2_geticqmessage(od->sess, who, (budlight->uc & 0xffff0000) >> 16);
4923 else { 4923 else {
4945 #ifdef NOSSI 4945 #ifdef NOSSI
4946 GSList *list, *g; 4946 GSList *list, *g;
4947 char buf[MAXMSGLEN]; 4947 char buf[MAXMSGLEN];
4948 int at; 4948 int at;
4949 4949
4950 switch(gc->user->permdeny) { 4950 switch(gc->account->permdeny) {
4951 case 1: 4951 case 1:
4952 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gc->username); 4952 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gc->username);
4953 break; 4953 break;
4954 case 2: 4954 case 2:
4955 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gc->username); 4955 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gc->username);
4977 at = 0; 4977 at = 0;
4978 while (g) { 4978 while (g) {
4979 list = ((struct group *)g->data)->members; 4979 list = ((struct group *)g->data)->members;
4980 while (list) { 4980 while (list) {
4981 struct buddy *b = list->data; 4981 struct buddy *b = list->data;
4982 if(b->user == gc->user) 4982 if(b->account == gc->account)
4983 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", b->name); 4983 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", b->name);
4984 list = list->next; 4984 list = list->next;
4985 } 4985 }
4986 g = g->next; 4986 g = g->next;
4987 } 4987 }
4991 break; 4991 break;
4992 } 4992 }
4993 signoff_blocked(gc); 4993 signoff_blocked(gc);
4994 #else 4994 #else
4995 if (od->sess->ssi.received_data) 4995 if (od->sess->ssi.received_data)
4996 aim_ssi_setpermdeny(od->sess, od->conn, gc->user->permdeny, 0xffffffff); 4996 aim_ssi_setpermdeny(od->sess, od->conn, gc->account->permdeny, 0xffffffff);
4997 #endif 4997 #endif
4998 } 4998 }
4999 4999
5000 static void oscar_add_permit(struct gaim_connection *gc, const char *who) { 5000 static void oscar_add_permit(struct gaim_connection *gc, const char *who) {
5001 #ifdef NOSSI 5001 #ifdef NOSSI
5002 if (gc->user->permdeny == 3) 5002 if (gc->account->permdeny == 3)
5003 oscar_set_permit_deny(gc); 5003 oscar_set_permit_deny(gc);
5004 #else 5004 #else
5005 struct oscar_data *od = (struct oscar_data *)gc->proto_data; 5005 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
5006 debug_printf("ssi: About to add a permit\n"); 5006 debug_printf("ssi: About to add a permit\n");
5007 if (od->sess->ssi.received_data) 5007 if (od->sess->ssi.received_data)
5009 #endif 5009 #endif
5010 } 5010 }
5011 5011
5012 static void oscar_add_deny(struct gaim_connection *gc, const char *who) { 5012 static void oscar_add_deny(struct gaim_connection *gc, const char *who) {
5013 #ifdef NOSSI 5013 #ifdef NOSSI
5014 if (gc->user->permdeny == 4) 5014 if (gc->account->permdeny == 4)
5015 oscar_set_permit_deny(gc); 5015 oscar_set_permit_deny(gc);
5016 #else 5016 #else
5017 struct oscar_data *od = (struct oscar_data *)gc->proto_data; 5017 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
5018 debug_printf("ssi: About to add a deny\n"); 5018 debug_printf("ssi: About to add a deny\n");
5019 if (od->sess->ssi.received_data) 5019 if (od->sess->ssi.received_data)
5021 #endif 5021 #endif
5022 } 5022 }
5023 5023
5024 static void oscar_rem_permit(struct gaim_connection *gc, const char *who) { 5024 static void oscar_rem_permit(struct gaim_connection *gc, const char *who) {
5025 #ifdef NOSSI 5025 #ifdef NOSSI
5026 if (gc->user->permdeny == 3) 5026 if (gc->account->permdeny == 3)
5027 oscar_set_permit_deny(gc); 5027 oscar_set_permit_deny(gc);
5028 #else 5028 #else
5029 struct oscar_data *od = (struct oscar_data *)gc->proto_data; 5029 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
5030 debug_printf("ssi: About to delete a permit\n"); 5030 debug_printf("ssi: About to delete a permit\n");
5031 if (od->sess->ssi.received_data) 5031 if (od->sess->ssi.received_data)
5033 #endif 5033 #endif
5034 } 5034 }
5035 5035
5036 static void oscar_rem_deny(struct gaim_connection *gc, const char *who) { 5036 static void oscar_rem_deny(struct gaim_connection *gc, const char *who) {
5037 #ifdef NOSSI 5037 #ifdef NOSSI
5038 if (gc->user->permdeny == 4) 5038 if (gc->account->permdeny == 4)
5039 oscar_set_permit_deny(gc); 5039 oscar_set_permit_deny(gc);
5040 #else 5040 #else
5041 struct oscar_data *od = (struct oscar_data *)gc->proto_data; 5041 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
5042 debug_printf("ssi: About to delete a deny\n"); 5042 debug_printf("ssi: About to delete a deny\n");
5043 if (od->sess->ssi.received_data) 5043 if (od->sess->ssi.received_data)
5080 pbm->label = _("Get Status Msg"); 5080 pbm->label = _("Get Status Msg");
5081 pbm->callback = oscar_get_away_msg; 5081 pbm->callback = oscar_get_away_msg;
5082 pbm->gc = gc; 5082 pbm->gc = gc;
5083 m = g_list_append(m, pbm); 5083 m = g_list_append(m, pbm);
5084 } else { 5084 } else {
5085 struct buddy *b = find_buddy(gc->user, who); 5085 struct buddy *b = find_buddy(gc->account, who);
5086 5086
5087 if (!b || (b->uc & UC_UNAVAILABLE)) { 5087 if (!b || (b->uc & UC_UNAVAILABLE)) {
5088 pbm = g_new0(struct proto_buddy_menu, 1); 5088 pbm = g_new0(struct proto_buddy_menu, 1);
5089 pbm->label = _("Get Away Msg"); 5089 pbm->label = _("Get Away Msg");
5090 pbm->callback = oscar_get_away_msg; 5090 pbm->callback = oscar_get_away_msg;
5221 5221
5222 for (curg=groups; curg; curg=g_slist_next(curg)) { 5222 for (curg=groups; curg; curg=g_slist_next(curg)) {
5223 struct group *group = curg->data; 5223 struct group *group = curg->data;
5224 for (curb=group->members; curb; curb=g_slist_next(curb)) { 5224 for (curb=group->members; curb; curb=g_slist_next(curb)) {
5225 struct buddy *buddy = curb->data; 5225 struct buddy *buddy = curb->data;
5226 if (buddy->user == gc->user && aim_ssi_waitingforauth(od->sess->ssi.local, group->name, buddy->name)) { 5226 if (buddy->account == gc->account && aim_ssi_waitingforauth(od->sess->ssi.local, group->name, buddy->name)) {
5227 if (get_buddy_alias_only(buddy)) 5227 if (get_buddy_alias_only(buddy))
5228 nombre = g_strdup_printf(" %s (%s)", buddy->name, get_buddy_alias_only(buddy)); 5228 nombre = g_strdup_printf(" %s (%s)", buddy->name, get_buddy_alias_only(buddy));
5229 else 5229 else
5230 nombre = g_strdup_printf(" %s", buddy->name); 5230 nombre = g_strdup_printf(" %s", buddy->name);
5231 tmp = g_strdup_printf("%s<BR>%s", text, nombre); 5231 tmp = g_strdup_printf("%s<BR>%s", text, nombre);