| 1342 g_free(data->who); |
1342 g_free(data->who); |
| 1343 g_free(data); |
1343 g_free(data); |
| 1344 } |
1344 } |
| 1345 |
1345 |
| 1346 /* this is the right click menu cb thingy */ |
1346 /* this is the right click menu cb thingy */ |
| 1347 static void oscar_ask_direct_im(GaimConnection *gc, const char *who) { |
1347 static void oscar_ask_direct_im(GaimBlistNode *node, gpointer ignored) { |
| |
1348 |
| |
1349 GaimBuddy *buddy; |
| |
1350 GaimConnection *gc; |
| 1348 gchar *buf; |
1351 gchar *buf; |
| 1349 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1); |
1352 struct ask_do_dir_im *data; |
| 1350 data->who = g_strdup(who); |
1353 |
| |
1354 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); |
| |
1355 |
| |
1356 buddy = (GaimBuddy *) node; |
| |
1357 gc = gaim_account_get_connection(buddy->account); |
| |
1358 |
| |
1359 data = g_new0(struct ask_do_dir_im, 1); |
| |
1360 data->who = g_strdup(buddy->name); |
| 1351 data->gc = gc; |
1361 data->gc = gc; |
| 1352 buf = g_strdup_printf(_("You have selected to open a Direct IM connection with %s."), who); |
1362 buf = g_strdup_printf(_("You have selected to open a Direct IM connection with %s."), |
| |
1363 buddy->name); |
| 1353 |
1364 |
| 1354 gaim_request_action(gc, NULL, buf, |
1365 gaim_request_action(gc, NULL, buf, |
| 1355 _("Because this reveals your IP address, it " |
1366 _("Because this reveals your IP address, it " |
| 1356 "may be considered a privacy risk. Do you " |
1367 "may be considered a privacy risk. Do you " |
| 1357 "wish to continue?"), |
1368 "wish to continue?"), |
| 1358 0, data, 2, |
1369 0, data, 2, |
| 1359 _("Connect"), G_CALLBACK(oscar_direct_im), |
1370 _("Connect"), G_CALLBACK(oscar_direct_im), |
| 1360 _("Cancel"), G_CALLBACK(oscar_cancel_direct_im)); |
1371 _("Cancel"), G_CALLBACK(oscar_cancel_direct_im)); |
| 1361 g_free(buf); |
1372 g_free(buf); |
| 1362 } |
1373 } |
| 1363 |
1374 |
| 1364 /***************************************************************************** |
1375 /***************************************************************************** |
| 1365 * End scary direct im stuff |
1376 * End scary direct im stuff |
| 1906 xfer->fd = 0; |
1917 xfer->fd = 0; |
| 1907 gaim_xfer_set_completed(xfer, TRUE); |
1918 gaim_xfer_set_completed(xfer, TRUE); |
| 1908 } |
1919 } |
| 1909 } |
1920 } |
| 1910 |
1921 |
| 1911 static void oscar_ask_sendfile(GaimConnection *gc, const char *destsn) { |
1922 static void oscar_ask_sendfile(GaimBlistNode *node, gpointer data) { |
| 1912 OscarData *od = (OscarData *)gc->proto_data; |
1923 |
| |
1924 GaimBuddy *buddy; |
| |
1925 GaimConnection *gc; |
| |
1926 |
| |
1927 OscarData *od; |
| 1913 GaimXfer *xfer; |
1928 GaimXfer *xfer; |
| 1914 struct aim_oft_info *oft_info; |
1929 struct aim_oft_info *oft_info; |
| 1915 const char *ip; |
1930 const char *ip; |
| 1916 |
1931 |
| |
1932 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); |
| |
1933 |
| |
1934 buddy = (GaimBuddy *) node; |
| |
1935 gc = gaim_account_get_connection(buddy->account); |
| |
1936 od = (OscarData *)gc->proto_data; |
| |
1937 |
| 1917 /* You want to send a file to someone else, you're so generous */ |
1938 /* You want to send a file to someone else, you're so generous */ |
| 1918 |
1939 |
| 1919 /* Build the file transfer handle */ |
1940 /* Build the file transfer handle */ |
| 1920 xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, destsn); |
1941 xfer = gaim_xfer_new(buddy->account, GAIM_XFER_SEND, buddy->name); |
| 1921 |
1942 |
| 1922 /* Create the oscar-specific data */ |
1943 /* Create the oscar-specific data */ |
| 1923 ip = gaim_network_get_my_ip(od->conn ? od->conn->fd : -1); |
1944 ip = gaim_network_get_my_ip(od->conn ? od->conn->fd : -1); |
| 1924 oft_info = aim_oft_createinfo(od->sess, NULL, destsn, ip, 0, 0, 0, NULL); |
1945 oft_info = aim_oft_createinfo(od->sess, NULL, buddy->name, ip, 0, 0, 0, NULL); |
| 1925 xfer->data = oft_info; |
1946 xfer->data = oft_info; |
| 1926 |
1947 |
| 1927 /* Setup our I/O op functions */ |
1948 /* Setup our I/O op functions */ |
| 1928 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init_send); |
1949 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init_send); |
| 1929 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); |
1950 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); |
| 6622 gaim_check_comment(od, text); |
6656 gaim_check_comment(od, text); |
| 6623 |
6657 |
| 6624 oscar_free_name_data(data); |
6658 oscar_free_name_data(data); |
| 6625 } |
6659 } |
| 6626 |
6660 |
| 6627 static void oscar_buddycb_edit_comment(GaimConnection *gc, const char *name) { |
6661 static void oscar_buddycb_edit_comment(GaimBlistNode *node, gpointer ignore) { |
| 6628 OscarData *od = gc->proto_data; |
6662 |
| 6629 struct name_data *data = g_new(struct name_data, 1); |
6663 GaimBuddy *buddy; |
| 6630 GaimBuddy *b; |
6664 GaimConnection *gc; |
| |
6665 OscarData *od; |
| |
6666 struct name_data *data; |
| 6631 GaimGroup *g; |
6667 GaimGroup *g; |
| 6632 char *comment; |
6668 char *comment; |
| 6633 gchar *comment_utf8; |
6669 gchar *comment_utf8; |
| 6634 |
6670 |
| 6635 if (!(b = gaim_find_buddy(gaim_connection_get_account(gc), name))) |
6671 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); |
| |
6672 |
| |
6673 buddy = (GaimBuddy *) node; |
| |
6674 gc = gaim_account_get_connection(buddy->account); |
| |
6675 od = gc->proto_data; |
| |
6676 |
| |
6677 data = g_new(struct name_data, 1); |
| |
6678 |
| |
6679 if (!(g = gaim_find_buddys_group(buddy))) |
| 6636 return; |
6680 return; |
| 6637 if (!(g = gaim_find_buddys_group(b))) |
6681 comment = aim_ssi_getcomment(od->sess->ssi.local, g->name, buddy->name); |
| 6638 return; |
|
| 6639 comment = aim_ssi_getcomment(od->sess->ssi.local, g->name, name); |
|
| 6640 comment_utf8 = comment ? gaim_utf8_try_convert(comment) : NULL; |
6682 comment_utf8 = comment ? gaim_utf8_try_convert(comment) : NULL; |
| 6641 |
6683 |
| 6642 data->gc = gc; |
6684 data->gc = gc; |
| 6643 data->name = g_strdup(name); |
6685 data->name = g_strdup(buddy->name); |
| 6644 data->nick = NULL; |
6686 data->nick = NULL; |
| 6645 |
6687 |
| 6646 gaim_request_input(gc, NULL, _("Buddy Comment:"), NULL, |
6688 gaim_request_input(gc, NULL, _("Buddy Comment:"), NULL, |
| 6647 comment_utf8, TRUE, FALSE, NULL, |
6689 comment_utf8, TRUE, FALSE, NULL, |
| 6648 _("OK"), G_CALLBACK(oscar_ssi_editcomment), |
6690 _("OK"), G_CALLBACK(oscar_ssi_editcomment), |
| 6651 |
6693 |
| 6652 free(comment); |
6694 free(comment); |
| 6653 g_free(comment_utf8); |
6695 g_free(comment_utf8); |
| 6654 } |
6696 } |
| 6655 |
6697 |
| 6656 static GList *oscar_buddy_menu(GaimConnection *gc, const char *who) { |
6698 static GList *oscar_buddy_menu(GaimBuddy *buddy) { |
| |
6699 |
| |
6700 GaimConnection *gc = gaim_account_get_connection(buddy->account); |
| 6657 OscarData *od = gc->proto_data; |
6701 OscarData *od = gc->proto_data; |
| |
6702 |
| 6658 GList *m = NULL; |
6703 GList *m = NULL; |
| 6659 struct proto_buddy_menu *pbm; |
6704 GaimBlistNodeAction *act; |
| 6660 |
6705 |
| 6661 pbm = g_new0(struct proto_buddy_menu, 1); |
6706 act = gaim_blist_node_action_new(_("Edit Buddy Comment"), |
| 6662 pbm->label = _("Edit Buddy Comment"); |
6707 oscar_buddycb_edit_comment, NULL); |
| 6663 pbm->callback = oscar_buddycb_edit_comment; |
6708 m = g_list_append(m, act); |
| 6664 pbm->gc = gc; |
|
| 6665 m = g_list_append(m, pbm); |
|
| 6666 |
6709 |
| 6667 if (od->icq) { |
6710 if (od->icq) { |
| 6668 #if 0 |
6711 #if 0 |
| 6669 pbm = g_new0(struct proto_buddy_menu, 1); |
6712 act = gaim_blist_node_action_new(_("Get Status Msg"), |
| 6670 pbm->label = _("Get Status Msg"); |
6713 oscar_get_icqstatusmsg, NULL); |
| 6671 pbm->callback = oscar_get_icqstatusmsg; |
6714 m = g_list_append(m, act); |
| 6672 pbm->gc = gc; |
|
| 6673 m = g_list_append(m, pbm); |
|
| 6674 #endif |
6715 #endif |
| 6675 } else { |
6716 } else { |
| 6676 GaimBuddy *b = gaim_find_buddy(gc->account, who); |
|
| 6677 aim_userinfo_t *userinfo; |
6717 aim_userinfo_t *userinfo; |
| 6678 |
6718 userinfo = aim_locate_finduserinfo(od->sess, buddy->name); |
| 6679 if (b) |
6719 |
| 6680 userinfo = aim_locate_finduserinfo(od->sess, b->name); |
6720 if (userinfo && aim_sncmp(gaim_account_get_username(buddy->account), buddy->name) && |
| 6681 |
6721 GAIM_BUDDY_IS_ONLINE(buddy)) { |
| 6682 if (b && userinfo && aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), who) && GAIM_BUDDY_IS_ONLINE(b)) { |
6722 |
| 6683 if (userinfo->capabilities & AIM_CAPS_DIRECTIM) { |
6723 if (userinfo->capabilities & AIM_CAPS_DIRECTIM) { |
| 6684 pbm = g_new0(struct proto_buddy_menu, 1); |
6724 act = gaim_blist_node_action_new(_("Direct IM"), |
| 6685 pbm->label = _("Direct IM"); |
6725 oscar_ask_direct_im, NULL); |
| 6686 pbm->callback = oscar_ask_direct_im; |
6726 m = g_list_append(m, act); |
| 6687 pbm->gc = gc; |
|
| 6688 m = g_list_append(m, pbm); |
|
| 6689 } |
6727 } |
| 6690 |
6728 |
| 6691 if (userinfo->capabilities & AIM_CAPS_SENDFILE) { |
6729 if (userinfo->capabilities & AIM_CAPS_SENDFILE) { |
| 6692 pbm = g_new0(struct proto_buddy_menu, 1); |
6730 act = gaim_blist_node_action_new(_("Send File"), |
| 6693 pbm->label = _("Send File"); |
6731 oscar_ask_sendfile, NULL); |
| 6694 pbm->callback = oscar_ask_sendfile; |
6732 m = g_list_append(m, act); |
| 6695 pbm->gc = gc; |
|
| 6696 m = g_list_append(m, pbm); |
|
| 6697 } |
6733 } |
| 6698 #if 0 |
6734 #if 0 |
| 6699 if (userinfo->capabilities & AIM_CAPS_GETFILE) { |
6735 if (userinfo->capabilities & AIM_CAPS_GETFILE) { |
| 6700 pbm = g_new0(struct proto_buddy_menu, 1); |
6736 act = gaim_blist_node_action_new(_("Get File"), |
| 6701 pbm->label = _("Get File"); |
6737 oscar_ask_getfile, NULL); |
| 6702 pbm->callback = oscar_ask_getfile; |
6738 m = g_list_append(m, act); |
| 6703 pbm->gc = gc; |
|
| 6704 m = g_list_append(m, pbm); |
|
| 6705 } |
6739 } |
| 6706 #endif |
6740 #endif |
| 6707 } |
6741 } |
| 6708 } |
6742 } |
| 6709 |
6743 |
| 6710 if (od->sess->ssi.received_data) { |
6744 if (od->sess->ssi.received_data) { |
| 6711 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, who); |
6745 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, buddy->name); |
| 6712 if (gname && aim_ssi_waitingforauth(od->sess->ssi.local, gname, who)) { |
6746 if (gname && aim_ssi_waitingforauth(od->sess->ssi.local, gname, buddy->name)) { |
| 6713 pbm = g_new0(struct proto_buddy_menu, 1); |
6747 act = gaim_blist_node_action_new(_("Re-request Authorization"), |
| 6714 pbm->label = _("Re-request Authorization"); |
6748 gaim_auth_sendrequest_menu, NULL); |
| 6715 pbm->callback = gaim_auth_sendrequest; |
6749 m = g_list_append(m, act); |
| 6716 pbm->gc = gc; |
|
| 6717 m = g_list_append(m, pbm); |
|
| 6718 } |
6750 } |
| 6719 } |
6751 } |
| 6720 |
6752 |
| 6721 return m; |
6753 return m; |
| 6722 } |
6754 } |
| |
6755 |
| |
6756 |
| |
6757 static GList *oscar_blist_node_menu(GaimBlistNode *node) { |
| |
6758 if(GAIM_BLIST_NODE_IS_BUDDY(node)) { |
| |
6759 return oscar_buddy_menu((GaimBuddy *) node); |
| |
6760 } else { |
| |
6761 return NULL; |
| |
6762 } |
| |
6763 } |
| |
6764 |
| 6723 |
6765 |
| 6724 static void oscar_format_screenname(GaimConnection *gc, const char *nick) { |
6766 static void oscar_format_screenname(GaimConnection *gc, const char *nick) { |
| 6725 OscarData *od = gc->proto_data; |
6767 OscarData *od = gc->proto_data; |
| 6726 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), nick)) { |
6768 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), nick)) { |
| 6727 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { |
6769 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { |