| 993 |
993 |
| 994 |
994 |
| 995 void do_new_bp(GtkWidget *w, struct addbp *b) |
995 void do_new_bp(GtkWidget *w, struct addbp *b) |
| 996 { |
996 { |
| 997 struct buddy_pounce *bp = g_new0(struct buddy_pounce, 1); |
997 struct buddy_pounce *bp = g_new0(struct buddy_pounce, 1); |
| 998 |
998 |
| |
999 if(strlen(gtk_entry_get_text(GTK_ENTRY(b->nameentry))) == 0) { |
| |
1000 do_error_dialog(_("Please enter a buddy to pounce."), _("Buddy Pounce Error")); |
| |
1001 g_free(bp); |
| |
1002 return; |
| |
1003 } |
| |
1004 |
| 999 g_snprintf(bp->name, 80, "%s", gtk_entry_get_text(GTK_ENTRY(b->nameentry))); |
1005 g_snprintf(bp->name, 80, "%s", gtk_entry_get_text(GTK_ENTRY(b->nameentry))); |
| 1000 g_snprintf(bp->message, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->messentry))); |
1006 g_snprintf(bp->message, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->messentry))); |
| 1001 g_snprintf(bp->command, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->commentry))); |
1007 g_snprintf(bp->command, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->commentry))); |
| 1002 g_snprintf(bp->pouncer, 80, "%s", b->user->username); |
1008 g_snprintf(bp->pouncer, 80, "%s", b->user->username); |
| 1003 |
1009 |
| 1241 struct gaim_connection *gc; |
1247 struct gaim_connection *gc; |
| 1242 |
1248 |
| 1243 junk = gtk_editable_get_chars(GTK_EDITABLE(b->text), 0, -1); |
1249 junk = gtk_editable_get_chars(GTK_EDITABLE(b->text), 0, -1); |
| 1244 |
1250 |
| 1245 if (b->user) { |
1251 if (b->user) { |
| 1246 g_snprintf(b->user->user_info, sizeof(b->user->user_info), "%s", junk); |
1252 strncpy_withhtml(b->user->user_info, junk, sizeof b->user->user_info); |
| 1247 gc = b->user->gc; |
1253 gc = b->user->gc; |
| 1248 |
1254 |
| 1249 save_prefs(); |
1255 save_prefs(); |
| 1250 |
1256 |
| 1251 if (gc) { |
1257 if (gc) |
| 1252 buf = g_malloc(strlen(junk) * 4); |
1258 serv_set_info(gc, b->user->user_info); |
| 1253 if (!buf) { |
|
| 1254 buf = g_malloc(1); |
|
| 1255 buf[0] = 0; |
|
| 1256 } |
|
| 1257 //g_snprintf(buf, MIN(strlen(junk) * 2, 4096), "%s", junk); |
|
| 1258 strncpy_withhtml(buf, junk, MIN(strlen(junk) * 2, 4096)); |
|
| 1259 serv_set_info(gc, buf); |
|
| 1260 g_free(buf); |
|
| 1261 } |
|
| 1262 } |
1259 } |
| 1263 g_free(junk); |
1260 g_free(junk); |
| 1264 destroy_dialog(NULL, b->window); |
1261 destroy_dialog(NULL, b->window); |
| 1265 g_free(b); |
1262 g_free(b); |
| 1266 } |
1263 } |
| 1622 gtk_widget_show(b->window); |
1619 gtk_widget_show(b->window); |
| 1623 } |
1620 } |
| 1624 |
1621 |
| 1625 static void info_choose(GtkWidget *opt, struct set_info_dlg *b) |
1622 static void info_choose(GtkWidget *opt, struct set_info_dlg *b) |
| 1626 { |
1623 { |
| 1627 int text_len; |
1624 int text_len = gtk_text_get_length(GTK_TEXT(b->text)); |
| 1628 struct aim_user *u = gtk_object_get_user_data(GTK_OBJECT(opt)); |
1625 struct aim_user *u = gtk_object_get_user_data(GTK_OBJECT(opt)); |
| |
1626 gchar *buf = g_malloc(strlen(u->user_info)+1); |
| 1629 b->user = u; |
1627 b->user = u; |
| 1630 text_len = gtk_text_get_length(GTK_TEXT(b->text)); |
1628 |
| |
1629 strncpy_nohtml(buf, u->user_info, strlen(u->user_info)+1); |
| |
1630 |
| 1631 gtk_text_set_point(GTK_TEXT(b->text), 0); |
1631 gtk_text_set_point(GTK_TEXT(b->text), 0); |
| 1632 gtk_text_forward_delete(GTK_TEXT(b->text), text_len); |
1632 gtk_text_forward_delete(GTK_TEXT(b->text), text_len); |
| 1633 gtk_text_insert(GTK_TEXT(b->text), NULL, NULL, NULL, u->user_info, -1); |
1633 gtk_text_insert(GTK_TEXT(b->text), NULL, NULL, NULL, buf, -1); |
| |
1634 |
| |
1635 g_free(buf); |
| 1634 } |
1636 } |
| 1635 |
1637 |
| 1636 static void info_user_menu(struct set_info_dlg *b, GtkWidget *box) |
1638 static void info_user_menu(struct set_info_dlg *b, GtkWidget *box) |
| 1637 { |
1639 { |
| 1638 GtkWidget *hbox; |
1640 GtkWidget *hbox; |
| 1676 |
1678 |
| 1677 void show_set_info() |
1679 void show_set_info() |
| 1678 { |
1680 { |
| 1679 GtkWidget *buttons; |
1681 GtkWidget *buttons; |
| 1680 GtkWidget *vbox; |
1682 GtkWidget *vbox; |
| 1681 |
1683 gchar *buf; |
| |
1684 struct aim_user *tmp; |
| |
1685 |
| 1682 struct set_info_dlg *b = g_new0(struct set_info_dlg, 1); |
1686 struct set_info_dlg *b = g_new0(struct set_info_dlg, 1); |
| 1683 |
1687 |
| 1684 b->window = gtk_window_new(GTK_WINDOW_DIALOG); |
1688 b->window = gtk_window_new(GTK_WINDOW_DIALOG); |
| 1685 gtk_window_set_wmclass(GTK_WINDOW(b->window), "set_info", "Gaim"); |
1689 gtk_window_set_wmclass(GTK_WINDOW(b->window), "set_info", "Gaim"); |
| 1686 dialogwindows = g_list_prepend(dialogwindows, b->window); |
1690 dialogwindows = g_list_prepend(dialogwindows, b->window); |
| 1712 b->text = gtk_text_new(NULL, NULL); |
1716 b->text = gtk_text_new(NULL, NULL); |
| 1713 gtk_text_set_word_wrap(GTK_TEXT(b->text), TRUE); |
1717 gtk_text_set_word_wrap(GTK_TEXT(b->text), TRUE); |
| 1714 gtk_text_set_editable(GTK_TEXT(b->text), TRUE); |
1718 gtk_text_set_editable(GTK_TEXT(b->text), TRUE); |
| 1715 gtk_widget_set_usize(b->text, 300, 200); |
1719 gtk_widget_set_usize(b->text, 300, 200); |
| 1716 if (aim_users) { |
1720 if (aim_users) { |
| 1717 gtk_text_insert(GTK_TEXT(b->text), NULL, NULL, NULL, |
1721 tmp = ((struct gaim_connection *)connections->data)->user; |
| 1718 ((struct gaim_connection *)connections->data)->user->user_info, -1); |
1722 buf = g_malloc(strlen(tmp->user_info)+1); |
| 1719 b->user = ((struct gaim_connection *)connections->data)->user; |
1723 strncpy_nohtml(buf, tmp->user_info, strlen(tmp->user_info)+1); |
| |
1724 gtk_text_insert(GTK_TEXT(b->text), NULL, NULL, NULL, buf, -1); |
| |
1725 b->user = tmp; |
| |
1726 g_free(buf); |
| 1720 } |
1727 } |
| 1721 |
1728 |
| 1722 gtk_widget_show(b->text); |
1729 gtk_widget_show(b->text); |
| 1723 |
1730 |
| 1724 gtk_box_pack_start(GTK_BOX(vbox), b->text, TRUE, TRUE, 0); |
1731 gtk_box_pack_start(GTK_BOX(vbox), b->text, TRUE, TRUE, 0); |
| 1729 gtk_container_add(GTK_CONTAINER(b->window), vbox); |
1736 gtk_container_add(GTK_CONTAINER(b->window), vbox); |
| 1730 gtk_widget_realize(b->window); |
1737 gtk_widget_realize(b->window); |
| 1731 aol_icon(b->window->window); |
1738 aol_icon(b->window->window); |
| 1732 |
1739 |
| 1733 gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Set User Info")); |
1740 gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Set User Info")); |
| |
1741 gtk_window_set_focus(GTK_WINDOW(b->window), b->text); |
| 1734 gtk_widget_show(b->window); |
1742 gtk_widget_show(b->window); |
| 1735 |
1743 |
| 1736 } |
1744 } |
| 1737 |
1745 |
| 1738 /*------------------------------------------------------------------------*/ |
1746 /*------------------------------------------------------------------------*/ |