comparison src/protocols/oscar/oscar.c @ 5136:381da05cb5ed

[gaim-migrate @ 5500] this started out as simply adding an option to right-click on a jabber buddy and re-request authorization. Then I ended up chasing the disgusting mess of const vs non-const parameters all over gaim. The end result is that you can now right-click on jabber buddies and re-request auth like you can for ICQ. Also, a lot more things are const that should be, I fixed a bug or two, and I cleaned up one of my least favorite functions in gaim (linkify_text). It is now decidedly less evil. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Tue, 15 Apr 2003 04:18:00 +0000
parents 2acc2ee66597
children ac9ca88d4b25
comparison
equal deleted inserted replaced
5135:102135caa225 5136:381da05cb5ed
1062 } 1062 }
1063 1063
1064 return NULL; 1064 return NULL;
1065 } 1065 }
1066 1066
1067 static void oscar_ask_sendfile(struct gaim_connection *gc, char *destsn) { 1067 static void oscar_ask_sendfile(struct gaim_connection *gc, const char *destsn) {
1068 struct oscar_data *od = (struct oscar_data *)gc->proto_data; 1068 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
1069 1069
1070 /* You want to send a file to someone else, you're so generous */ 1070 /* You want to send a file to someone else, you're so generous */
1071 struct gaim_xfer *xfer; 1071 struct gaim_xfer *xfer;
1072 struct oscar_xfer_data *xfer_data; 1072 struct oscar_xfer_data *xfer_data;
2441 } 2441 }
2442 2442
2443 gaim_free_name_data(data); 2443 gaim_free_name_data(data);
2444 } 2444 }
2445 2445
2446 static void gaim_auth_sendrequest(struct gaim_connection *gc, char *name) { 2446 static void gaim_auth_sendrequest(struct gaim_connection *gc, const char *name) {
2447 struct name_data *data = g_new(struct name_data, 1); 2447 struct name_data *data = g_new(struct name_data, 1);
2448 struct buddy *buddy; 2448 struct buddy *buddy;
2449 gchar *dialog_msg, *nombre; 2449 gchar *dialog_msg, *nombre;
2450 2450
2451 buddy = gaim_find_buddy(gc->account, name); 2451 buddy = gaim_find_buddy(gc->account, name);
4155 aim_im_sendmtn(od->sess, 0x0001, name, 0x0000); 4155 aim_im_sendmtn(od->sess, 0x0001, name, 0x0000);
4156 } 4156 }
4157 } 4157 }
4158 return 0; 4158 return 0;
4159 } 4159 }
4160 static void oscar_ask_direct_im(struct gaim_connection *gc, char *name); 4160 static void oscar_ask_direct_im(struct gaim_connection *gc, const char *name);
4161 4161
4162 static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int len, int imflags) { 4162 static int oscar_send_im(struct gaim_connection *gc, const char *name, const char *message, int len, int imflags) {
4163 struct oscar_data *od = (struct oscar_data *)gc->proto_data; 4163 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
4164 struct direct_im *dim = find_direct_im(od, name); 4164 struct direct_im *dim = find_direct_im(od, name);
4165 int ret = 0; 4165 int ret = 0;
4166 GError *err = NULL; 4166 GError *err = NULL;
4167 4167
4280 if (ret >= 0) 4280 if (ret >= 0)
4281 return 1; 4281 return 1;
4282 return ret; 4282 return ret;
4283 } 4283 }
4284 4284
4285 static void oscar_get_info(struct gaim_connection *g, char *name) { 4285 static void oscar_get_info(struct gaim_connection *g, const char *name) {
4286 struct oscar_data *od = (struct oscar_data *)g->proto_data; 4286 struct oscar_data *od = (struct oscar_data *)g->proto_data;
4287 if (od->icq) 4287 if (od->icq)
4288 aim_icq_getallinfo(od->sess, name); 4288 aim_icq_getallinfo(od->sess, name);
4289 else 4289 else
4290 /* people want the away message on the top, so we get the away message 4290 /* people want the away message on the top, so we get the away message
4291 * first and then get the regular info, since it's too difficult to 4291 * first and then get the regular info, since it's too difficult to
4292 * insert in the middle. i hate people. */ 4292 * insert in the middle. i hate people. */
4293 aim_getinfo(od->sess, od->conn, name, AIM_GETINFO_AWAYMESSAGE); 4293 aim_getinfo(od->sess, od->conn, name, AIM_GETINFO_AWAYMESSAGE);
4294 } 4294 }
4295 4295
4296 static void oscar_get_away(struct gaim_connection *g, char *who) { 4296 static void oscar_get_away(struct gaim_connection *g, const char *who) {
4297 struct oscar_data *od = (struct oscar_data *)g->proto_data; 4297 struct oscar_data *od = (struct oscar_data *)g->proto_data;
4298 if (od->icq) { 4298 if (od->icq) {
4299 struct buddy *budlight = gaim_find_buddy(g->account, who); 4299 struct buddy *budlight = gaim_find_buddy(g->account, who);
4300 if (budlight) 4300 if (budlight)
4301 if ((budlight->uc & 0xffff0000) >> 16) 4301 if ((budlight->uc & 0xffff0000) >> 16)
5423 char *who; 5423 char *who;
5424 struct gaim_connection *gc; 5424 struct gaim_connection *gc;
5425 }; 5425 };
5426 5426
5427 static void oscar_cancel_direct_im(struct ask_do_dir_im *data) { 5427 static void oscar_cancel_direct_im(struct ask_do_dir_im *data) {
5428 g_free(data->who);
5428 g_free(data); 5429 g_free(data);
5429 } 5430 }
5430 5431
5431 static void oscar_direct_im(struct ask_do_dir_im *data) { 5432 static void oscar_direct_im(struct ask_do_dir_im *data) {
5432 struct gaim_connection *gc = data->gc; 5433 struct gaim_connection *gc = data->gc;
5433 struct oscar_data *od; 5434 struct oscar_data *od;
5434 struct direct_im *dim; 5435 struct direct_im *dim;
5435 5436
5436 if (!g_slist_find(connections, gc)) { 5437 if (!g_slist_find(connections, gc)) {
5438 g_free(data->who);
5437 g_free(data); 5439 g_free(data);
5438 return; 5440 return;
5439 } 5441 }
5440 5442
5441 od = (struct oscar_data *)gc->proto_data; 5443 od = (struct oscar_data *)gc->proto_data;
5447 gaim_input_remove(dim->watcher); 5449 gaim_input_remove(dim->watcher);
5448 g_free(dim); 5450 g_free(dim);
5449 debug_printf("Gave up on old direct IM, trying again\n"); 5451 debug_printf("Gave up on old direct IM, trying again\n");
5450 } else { 5452 } else {
5451 do_error_dialog("DirectIM already open.", NULL, GAIM_ERROR); 5453 do_error_dialog("DirectIM already open.", NULL, GAIM_ERROR);
5454 g_free(data->who);
5452 g_free(data); 5455 g_free(data);
5453 return; 5456 return;
5454 } 5457 }
5455 } 5458 }
5456 dim = g_new0(struct direct_im, 1); 5459 dim = g_new0(struct direct_im, 1);
5467 } else { 5470 } else {
5468 do_error_dialog(_("Unable to open Direct IM"), NULL, GAIM_ERROR); 5471 do_error_dialog(_("Unable to open Direct IM"), NULL, GAIM_ERROR);
5469 g_free(dim); 5472 g_free(dim);
5470 } 5473 }
5471 5474
5475 g_free(data->who);
5472 g_free(data); 5476 g_free(data);
5473 } 5477 }
5474 5478
5475 static void oscar_ask_direct_im(struct gaim_connection *gc, gchar *who) { 5479 static void oscar_ask_direct_im(struct gaim_connection *gc, const char *who) {
5476 char buf[BUF_LONG]; 5480 char buf[BUF_LONG];
5477 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1); 5481 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1);
5478 data->who = who; 5482 data->who = g_strdup(who);
5479 data->gc = gc; 5483 data->gc = gc;
5480 g_snprintf(buf, sizeof(buf), _("You have selected to open a Direct IM connection with %s."), who); 5484 g_snprintf(buf, sizeof(buf), _("You have selected to open a Direct IM connection with %s."), who);
5481 do_ask_dialog(buf, _("Because this reveals your IP address, it may be considered a privacy risk. Do you wish to continue?"), data, _("Connect"), oscar_direct_im, _("Cancel"), oscar_cancel_direct_im, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE); 5485 do_ask_dialog(buf, _("Because this reveals your IP address, it may be considered a privacy risk. Do you wish to continue?"), data, _("Connect"), oscar_direct_im, _("Cancel"), oscar_cancel_direct_im, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE);
5482 } 5486 }
5483 5487
5606 m = g_list_append(m, _("Invisible")); 5610 m = g_list_append(m, _("Invisible"));
5607 5611
5608 return m; 5612 return m;
5609 } 5613 }
5610 5614
5611 static GList *oscar_buddy_menu(struct gaim_connection *gc, char *who) { 5615 static GList *oscar_buddy_menu(struct gaim_connection *gc, const char *who) {
5612 struct oscar_data *od = gc->proto_data; 5616 struct oscar_data *od = gc->proto_data;
5613 GList *m = NULL; 5617 GList *m = NULL;
5614 struct proto_buddy_menu *pbm; 5618 struct proto_buddy_menu *pbm;
5615 5619
5616 if (od->icq) { 5620 if (od->icq) {