diff -urN xchat-1.1.8/src/Makefile.am xchat/src/Makefile.am --- xchat-1.1.8/src/Makefile.am Wed Aug 11 04:45:40 1999 +++ xchat/src/Makefile.am Sun Aug 22 14:29:16 1999 @@ -4,12 +4,12 @@ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ -DLOCALEDIR=\"$(datadir)/locale\" \ -I$(includedir) \ - $(GNOME_INCLUDEDIR) - - + $(GNOME_INCLUDEDIR) + + bin_PROGRAMS = xchat -xchat_SOURCES = chanlist.c cfgfiles.c ctcp.c dcc.c dialog.c \ +xchat_SOURCES = chanopts.c chanlist.c cfgfiles.c ctcp.c dcc.c dialog.c \ editlist.c fkeys.c gtkutil.c history.c ignore.c \ inbound.c lastlog.c maingui.c menu.c notify.c outbound.c \ palette.c perl.c plugin.c rawlog.c server.c serverlist.c \ @@ -24,4 +24,15 @@ style.h \ userlist.h \ util.h \ + chanopts.h \ xchat.h + diff -urN xchat-1.1.8/src/Makefile.gtk xchat/src/Makefile.gtk --- xchat-1.1.8/src/Makefile.gtk Sun Aug 15 02:49:23 1999 +++ xchat/src/Makefile.gtk Sun Aug 22 14:30:01 1999 @@ -5,7 +5,7 @@ L_POSTFLAGS = `gtk-config --libs` PROGNAME = xchat -O_FILES = chanlist.o cfgfiles.o ctcp.o dcc.o dialog.o \ +O_FILES = chanopts.o chanlist.o cfgfiles.o ctcp.o dcc.o dialog.o \ editlist.o fkeys.o gtkutil.o history.o ignore.o inbound.o \ lastlog.o maingui.o menu.o notify.o outbound.o palette.o \ plugin.o rawlog.o server.o serverlist.o settings.o text.o \ @@ -32,3 +32,18 @@ install-strip: cp $(PROGRAME) /usr/local/bin/$(PROGRAME) strip /usr/local/bin/$(PROGRAME) + diff -urN xchat-1.1.8/src/Makefile.in xchat/src/Makefile.in --- xchat-1.1.8/src/Makefile.in Sun Aug 15 02:50:51 1999 +++ xchat/src/Makefile.in Sun Aug 22 14:31:26 1999 @@ -96,10 +96,10 @@ bin_PROGRAMS = xchat -xchat_SOURCES = chanlist.c cfgfiles.c ctcp.c dcc.c dialog.c editlist.c fkeys.c gtkutil.c history.c ignore.c inbound.c lastlog.c maingui.c menu.c notify.c outbound.c palette.c perl.c plugin.c rawlog.c server.c serverlist.c settings.c text.c userlist.c urlgrab.c util.c xchat.c +xchat_SOURCES = chantops.c chanlist.c cfgfiles.c ctcp.c dcc.c dialog.c editlist.c fkeys.c gtkutil.c history.c ignore.c inbound.c lastlog.c maingui.c menu.c notify.c outbound.c palette.c perl.c plugin.c rawlog.c server.c serverlist.c settings.c text.c userlist.c urlgrab.c util.c xchat.c -noinst_HEADERS = dcc.h history.h menu.h notify.h plugin.h serverlist.h style.h userlist.h util.h xchat.h +noinst_HEADERS = dcc.h history.h menu.h notify.h plugin.h serverlist.h style.h userlist.h util.h chanopts.h xchat.h mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../myconfig.h @@ -111,7 +111,7 @@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ -xchat_OBJECTS = chanlist.o cfgfiles.o ctcp.o dcc.o dialog.o editlist.o \ +xchat_OBJECTS = chanopts.o chanlist.o cfgfiles.o ctcp.o dcc.o dialog.o editlist.o \ fkeys.o gtkutil.o history.o ignore.o inbound.o lastlog.o maingui.o \ menu.o notify.o outbound.o palette.o perl.o plugin.o rawlog.o server.o \ serverlist.o settings.o text.o userlist.o urlgrab.o util.o xchat.o @@ -131,7 +131,7 @@ TAR = tar GZIP_ENV = --best -DEP_FILES = .deps/cfgfiles.P .deps/chanlist.P .deps/ctcp.P .deps/dcc.P \ +DEP_FILES = .deps/chanopts.P .deps/cfgfiles.P .deps/chanlist.P .deps/ctcp.P .deps/dcc.P \ .deps/dialog.P .deps/editlist.P .deps/fkeys.P .deps/gtkutil.P \ .deps/history.P .deps/ignore.P .deps/inbound.P .deps/lastlog.P \ .deps/maingui.P .deps/menu.P .deps/notify.P .deps/outbound.P \ diff -urN xchat-1.1.8/src/chanopts.c xchat/src/chanopts.c --- xchat-1.1.8/src/chanopts.c Wed Dec 31 21:00:00 1969 +++ xchat/src/chanopts.c Sun Aug 22 15:44:46 1999 @@ -0,0 +1,376 @@ +/* X-Chat + * Copyright (C) 1998 Peter Zelezny. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * X-Chat Channel Central + * Copyright (C) 1999 Augusto Cesar Radtke + */ + +#include "xchat.h" +#include "gtkutil.h" +#include "chanopts.h" + +extern int tcp_send (struct server *serv, char *buf); +extern int check_is_number(char *t); +extern void change_channel_flag(GtkWidget *wid, struct session *sess, char flag); + +void close_chanopts_window(GtkWidget *wid, struct ChanoptsWidgets *chops) +{ + gtk_object_destroy(GTK_OBJECT(chops->window)); + free(chops); +} + +void apply_topic_cb(GtkWidget *wid, struct ChanoptsWidgets *chops) +{ + gchar *buf = gtk_entry_get_text(GTK_ENTRY(chops->topic_text)); + char tbuf[300]; + + if (chops->sess->channel[0] && chops->sess->server->connected) + { + snprintf(tbuf, sizeof(tbuf), "TOPIC %s :%s\r\n", chops->sess->channel, buf); + tcp_send(chops->sess->server, tbuf); + } else + gtk_entry_set_text(GTK_ENTRY(chops->topic_text), ""); +} + +void apply_modes_cb(GtkWidget *wid, struct ChanoptsWidgets *chops) +{ + change_channel_flag(chops->invite_checkbutton, chops->sess, 'i'); + change_channel_flag(chops->private_checkbutton, chops->sess, 'p'); + change_channel_flag(chops->secret_checkbutton, chops->sess, 's'); + change_channel_flag(chops->moderated_checkbutton, chops->sess, 'm'); + change_channel_flag(chops->external_checkbutton, chops->sess, 'n'); + change_channel_flag(chops->topic_checkbutton, chops->sess, 't'); + + if (GTK_TOGGLE_BUTTON(chops->limit_checkbutton)->active) + { + if (chops->sess->server->connected && chops->sess->channel[0]) + { + char outbuf[512]; + + if (check_is_number(gtk_entry_get_text(GTK_ENTRY(chops->limit_entry))) == FALSE) + { + gtkutil_simpledialog("User limit must be a number!\n"); + gtk_entry_set_text(GTK_ENTRY(chops->limit_entry), ""); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(chops->limit_checkbutton), FALSE); + return; + } + + snprintf(outbuf, sizeof(outbuf), "MODE %s +l %d\r\n", chops->sess->channel, + atoi(gtk_entry_get_text(GTK_ENTRY(chops->limit_entry)))); + tcp_send(chops->sess->server, outbuf); + snprintf(outbuf, sizeof(outbuf), "MODE %s\r\n", chops->sess->channel); + tcp_send(chops->sess->server, outbuf); + } + } else + change_channel_flag(chops->limit_checkbutton, chops->sess, 'l'); + + + if (GTK_TOGGLE_BUTTON(chops->key_checkbutton)->active) + { + char outbuf[512]; + + if (chops->sess->server->connected && chops->sess->channel[0]) + { + snprintf(outbuf, sizeof(outbuf), "MODE %s +k %s\r\n", chops->sess->channel, + gtk_entry_get_text(GTK_ENTRY(chops->key_entry))); + tcp_send(chops->sess->server, outbuf); + snprintf(outbuf, sizeof(outbuf), "MODE %s\r\n", chops->sess->channel); + tcp_send(chops->sess->server, outbuf); + } + } else + { + char outbuf[512]; + + if (chops->sess->server->connected && chops->sess->channel[0]) + { + snprintf(outbuf, sizeof(outbuf), "MODE %s -k %s\r\n", chops->sess->channel, + gtk_entry_get_text(GTK_ENTRY(chops->key_entry))); + tcp_send(chops->sess->server, outbuf); + snprintf(outbuf, sizeof(outbuf), "MODE %s\r\n", chops->sess->channel); + tcp_send(chops->sess->server, outbuf); + } + } +} + +void select_row_cb(GtkWidget *wid, gint row, gint column, GdkEventButton *button, struct ChanoptsWidgets *chops) +{ + chops->bans_current_row = row; +} + +void unban_cb(GtkWidget *wid, struct ChanoptsWidgets *chops) +{ + struct bantype *bt; + char outbuf[512]; + + bt = gtk_clist_get_row_data(GTK_CLIST(chops->bans_clist), chops->bans_current_row); + + if (chops->sess->server->connected && chops->sess->channel[0]) + { + snprintf(outbuf, 512, "MODE %s -b %s\r\n", chops->sess->channel, bt->banmask); + tcp_send(chops->sess->server, outbuf); + memset(outbuf, 0, sizeof(outbuf)); + snprintf(outbuf, 512, "MODE %s\r\n", chops->sess->channel); + tcp_send(chops->sess->server, outbuf); + } + + gtk_clist_remove(GTK_CLIST(chops->bans_clist), chops->bans_current_row); +} + +void get_bans_cb(struct bantype *bt, struct ChanoptsWidgets *chops) +{ + gchar *text[3]; + gint row; + long n; + + n = atol(bt->bantime); + + text[0] = (gchar *) bt->banmask; + text[1] = (gchar *) bt->banby; + text[2] = (gchar *) ctime(&n); + + row = gtk_clist_append(GTK_CLIST(chops->bans_clist), text); + gtk_clist_set_row_data(GTK_CLIST(chops->bans_clist), row, bt); +} + + +void open_chanopts_window(struct session *sess) +{ + gchar *buf; + static gchar *titles[] = {"Ban mask", "Ban by", "Date"}; + struct ChanoptsWidgets *chops; + + /* some initializations */ + chops = malloc(sizeof(struct ChanoptsWidgets)); + memset(chops, 0, sizeof(struct ChanoptsWidgets)); + chops->sess = sess; + + buf = (gchar *) g_malloc(BUFSIZE); + snprintf(buf, BUFSIZE, "MODE %s +b\r\n", chops->sess->channel); + tcp_send(chops->sess->server, buf); + memset(buf, 0, sizeof(buf)); + + /* window title */ + snprintf(buf, BUFSIZE, "X-Chat Channel Central - %s", sess->channel); + + /* create the window */ + chops->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_container_border_width(GTK_CONTAINER(chops->window), 1); + gtk_window_set_title(GTK_WINDOW(chops->window), buf); + gtk_window_position(GTK_WINDOW(chops->window), GTK_WIN_POS_MOUSE); + gtk_window_set_policy(GTK_WINDOW(chops->window), TRUE, TRUE, FALSE); + memset(buf, 0, sizeof(buf)); + + /* create the main notebook */ + chops->notebook = gtk_notebook_new(); + gtk_container_add(GTK_CONTAINER(chops->window), chops->notebook); + gtk_notebook_set_tab_pos(GTK_NOTEBOOK(chops->notebook), GTK_POS_LEFT); + + chops->tab_topic = gtk_label_new("Topic"); + chops->tab_modes = gtk_label_new("Modes"); + chops->tab_bans = gtk_label_new("Bans"); + chops->tab_clones = gtk_label_new("Clones"); + + chops->vbox_topic = gtk_vbox_new(FALSE, 4); + chops->vbox_modes = gtk_vbox_new(FALSE, 4); + chops->vbox_bans = gtk_vbox_new(FALSE, 4); + + chops->label_clones = gtk_label_new("Feature not implemented yet."); + gtk_container_border_width(GTK_CONTAINER(chops->vbox_topic), 15); + gtk_container_border_width(GTK_CONTAINER(chops->vbox_modes), 15); + gtk_container_border_width(GTK_CONTAINER(chops->vbox_bans), 15); + + gtk_notebook_append_page(GTK_NOTEBOOK(chops->notebook), chops->vbox_topic, chops->tab_topic); + gtk_notebook_append_page(GTK_NOTEBOOK(chops->notebook), chops->vbox_modes, chops->tab_modes); + gtk_notebook_append_page(GTK_NOTEBOOK(chops->notebook), chops->vbox_bans, chops->tab_bans); + gtk_notebook_append_page(GTK_NOTEBOOK(chops->notebook), chops->label_clones, chops->tab_clones); + + + /* the topic tab */ + snprintf(buf, BUFSIZE, "The current topic for %s channel is: ", sess->channel); + chops->topic_label = gtk_label_new(buf); + gtk_box_pack_start(GTK_BOX(chops->vbox_topic), chops->topic_label, FALSE, TRUE, 0); + memset(buf, 0, sizeof(buf)); + + buf = gtk_entry_get_text(GTK_ENTRY(sess->topicgad)); + chops->topic_text = gtk_entry_new_with_max_length(255); + gtk_box_pack_start(GTK_BOX(chops->vbox_topic), chops->topic_text, TRUE, TRUE, 0); + gtk_entry_set_editable(GTK_ENTRY(chops->topic_text), TRUE); + gtk_entry_set_text(GTK_ENTRY(chops->topic_text), buf); + memset(buf, 0, sizeof(buf)); + + chops->hbox_topic_buttons = gtk_hbutton_box_new(); + gtk_hbutton_box_set_spacing_default(10); + gtk_box_pack_start(GTK_BOX(chops->vbox_topic), chops->hbox_topic_buttons, FALSE, FALSE, 0); + + chops->topic_button_apply = gtk_button_new_with_label("Apply"); + chops->topic_button_cancel = gtk_button_new_with_label("Cancel"); + gtk_container_add(GTK_CONTAINER(chops->hbox_topic_buttons), chops->topic_button_apply); + gtk_container_add(GTK_CONTAINER(chops->hbox_topic_buttons), chops->topic_button_cancel); + gtk_signal_connect(GTK_OBJECT(chops->topic_button_apply), "clicked", + GTK_SIGNAL_FUNC(apply_topic_cb), chops); + gtk_signal_connect(GTK_OBJECT(chops->topic_button_cancel), "clicked", + GTK_SIGNAL_FUNC(close_chanopts_window), chops); + + /* the modes tab */ + snprintf(buf, BUFSIZE, "Channel Modes - %s", sess->channel); + chops->modes_frame = gtk_frame_new(buf); + gtk_box_pack_start(GTK_BOX(chops->vbox_modes), chops->modes_frame, FALSE, TRUE, 0); + memset(buf, 0, sizeof(buf)); + + chops->vbox_internal_modes = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(chops->modes_frame), chops->vbox_internal_modes); + + chops->invite_checkbutton = gtk_check_button_new_with_label("Invite"); + chops->limit_checkbutton = gtk_check_button_new_with_label("Limit to: "); + chops->private_checkbutton = gtk_check_button_new_with_label("Private"); + chops->secret_checkbutton = gtk_check_button_new_with_label("Secret"); + chops->key_checkbutton = gtk_check_button_new_with_label("Key: "); + chops->moderated_checkbutton = gtk_check_button_new_with_label("Moderated"); + chops->external_checkbutton = gtk_check_button_new_with_label("No external messages"); + chops->topic_checkbutton = gtk_check_button_new_with_label("Only ops change topic"); + + chops->hbox_modes_limit = gtk_hbox_new(FALSE, 0); + chops->limit_entry = gtk_entry_new_with_max_length(3); + chops->limit_label = gtk_label_new(" users "); + gtk_label_set_justify(GTK_LABEL(chops->limit_label), GTK_JUSTIFY_LEFT); + gtk_box_pack_start(GTK_BOX(chops->hbox_modes_limit), chops->limit_checkbutton, FALSE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(chops->hbox_modes_limit), chops->limit_entry, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(chops->hbox_modes_limit), chops->limit_label, FALSE, TRUE, 0); + + chops->hbox_modes_key = gtk_hbox_new(FALSE, 0); + chops->key_entry = gtk_entry_new_with_max_length(16); + gtk_box_pack_start(GTK_BOX(chops->hbox_modes_key), chops->key_checkbutton, FALSE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(chops->hbox_modes_key), chops->key_entry, FALSE, FALSE, 0); + + gtk_box_pack_start(GTK_BOX(chops->vbox_internal_modes), chops->invite_checkbutton, FALSE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(chops->vbox_internal_modes), chops->hbox_modes_limit, FALSE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(chops->vbox_internal_modes), chops->private_checkbutton, FALSE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(chops->vbox_internal_modes), chops->secret_checkbutton, FALSE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(chops->vbox_internal_modes), chops->hbox_modes_key, FALSE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(chops->vbox_internal_modes), chops->moderated_checkbutton, FALSE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(chops->vbox_internal_modes), chops->external_checkbutton, FALSE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(chops->vbox_internal_modes), chops->topic_checkbutton, FALSE, TRUE, 0); + + if (GTK_TOGGLE_BUTTON(chops->sess->flag_wid[0])->active) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chops->topic_checkbutton), TRUE); + + if (GTK_TOGGLE_BUTTON(chops->sess->flag_wid[1])->active) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chops->external_checkbutton), TRUE); + + if (GTK_TOGGLE_BUTTON(chops->sess->flag_wid[2])->active) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chops->secret_checkbutton), TRUE); + + if (GTK_TOGGLE_BUTTON(chops->sess->flag_wid[3])->active) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chops->invite_checkbutton), TRUE); + + if (GTK_TOGGLE_BUTTON(chops->sess->flag_wid[4])->active) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chops->private_checkbutton), TRUE); + + if (GTK_TOGGLE_BUTTON(chops->sess->flag_wid[5])->active) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chops->moderated_checkbutton), TRUE); + + if (GTK_TOGGLE_BUTTON(chops->sess->flag_wid[6])->active) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chops->limit_checkbutton), TRUE); + buf = gtk_entry_get_text(GTK_ENTRY(chops->sess->limit_entry)); + gtk_entry_set_text(GTK_ENTRY(chops->limit_entry), buf); + memset(buf, 0, sizeof(buf)); + } + + if (GTK_TOGGLE_BUTTON(chops->sess->flag_wid[7])->active) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chops->key_checkbutton), TRUE); + buf = gtk_entry_get_text(GTK_ENTRY(chops->sess->key_entry)); + gtk_entry_set_text(GTK_ENTRY(chops->key_entry), buf); + memset(buf, 0, sizeof(buf)); + } + + chops->hbox_modes_buttons = gtk_hbutton_box_new(); + gtk_hbutton_box_set_spacing_default(10); + gtk_box_pack_start(GTK_BOX(chops->vbox_modes), chops->hbox_modes_buttons, FALSE, FALSE, 0); + + chops->modes_button_apply = gtk_button_new_with_label("Apply"); + chops->modes_button_cancel = gtk_button_new_with_label("Cancel"); + gtk_container_add(GTK_CONTAINER(chops->hbox_modes_buttons), chops->modes_button_apply); + gtk_container_add(GTK_CONTAINER(chops->hbox_modes_buttons), chops->modes_button_cancel); + gtk_signal_connect(GTK_OBJECT(chops->modes_button_apply), "clicked", + GTK_SIGNAL_FUNC(apply_modes_cb), chops); + gtk_signal_connect(GTK_OBJECT(chops->modes_button_cancel), "clicked", + GTK_SIGNAL_FUNC(close_chanopts_window), chops); + + + /* the bans tab */ + snprintf(buf, BUFSIZE, "Current bans on %s channel:", chops->sess->channel); + chops->label_bans = gtk_label_new(buf); + gtk_box_pack_start(GTK_BOX(chops->vbox_bans), chops->label_bans, FALSE, TRUE, 0); + memset(buf, 0, sizeof(buf)); + + chops->scrolled_bans_window = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(chops->scrolled_bans_window), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_box_pack_start(GTK_BOX(chops->vbox_bans), chops->scrolled_bans_window, TRUE, TRUE, 0); + + chops->bans_clist = gtk_clist_new_with_titles(3, titles); + gtk_clist_set_column_width(GTK_CLIST(chops->bans_clist), 0, 150); + gtk_clist_set_column_width(GTK_CLIST(chops->bans_clist), 1, 100); + gtk_clist_set_column_width(GTK_CLIST(chops->bans_clist), 2, 150); + gtk_clist_set_column_justification(GTK_CLIST(chops->bans_clist), 0, GTK_JUSTIFY_LEFT); + gtk_clist_set_column_justification(GTK_CLIST(chops->bans_clist), 1, GTK_JUSTIFY_LEFT); + gtk_clist_set_column_justification(GTK_CLIST(chops->bans_clist), 2, GTK_JUSTIFY_LEFT); + gtk_clist_set_selection_mode(GTK_CLIST(chops->bans_clist), GTK_SELECTION_BROWSE); + gtk_clist_set_shadow_type(GTK_CLIST(chops->bans_clist), GTK_SHADOW_ETCHED_IN); + gtk_container_add(GTK_CONTAINER(chops->scrolled_bans_window), chops->bans_clist); + + g_slist_foreach(chops->sess->banlist, (GFunc) get_bans_cb, chops); + + chops->hbox_bans_buttons = gtk_hbutton_box_new(); + gtk_hbutton_box_set_spacing_default(10); + gtk_box_pack_start(GTK_BOX(chops->vbox_bans), chops->hbox_bans_buttons, FALSE, FALSE, 0); + + chops->bans_button_apply = gtk_button_new_with_label("Unban"); + chops->bans_button_cancel = gtk_button_new_with_label("Cancel"); + gtk_container_add(GTK_CONTAINER(chops->hbox_bans_buttons), chops->bans_button_apply); + gtk_container_add(GTK_CONTAINER(chops->hbox_bans_buttons), chops->bans_button_cancel); + gtk_signal_connect(GTK_OBJECT(chops->bans_clist), "select_row", + GTK_SIGNAL_FUNC(select_row_cb), chops); + gtk_signal_connect(GTK_OBJECT(chops->bans_button_apply), "clicked", + GTK_SIGNAL_FUNC(unban_cb), chops); + gtk_signal_connect(GTK_OBJECT(chops->bans_button_cancel), "clicked", + GTK_SIGNAL_FUNC(close_chanopts_window), chops); + + /* finishing the all thing */ + gtk_widget_show_all(chops->window); +} + + + + + + + + + + + + + + + + + + + + + diff -urN xchat-1.1.8/src/chanopts.h xchat/src/chanopts.h --- xchat-1.1.8/src/chanopts.h Wed Dec 31 21:00:00 1969 +++ xchat/src/chanopts.h Sun Aug 22 14:37:19 1999 @@ -0,0 +1,82 @@ +/* X-Chat + * Copyright (C) 1998 Peter Zelezny. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * X-Chat Channel Central + * Copyright (C) 1999 Augusto Cesar Radtke + */ + +#define BUFSIZE 128 + +struct ChanoptsWidgets { + struct session *sess; + GtkWidget *window; + GtkWidget *notebook; + GtkWidget *tab_topic; + GtkWidget *tab_modes; + GtkWidget *tab_bans; + GtkWidget *tab_clones; + GtkWidget *vbox_topic; + GtkWidget *vbox_modes; + GtkWidget *vbox_bans; + GtkWidget *label_clones; + GtkWidget *topic_label; + GtkWidget *topic_text; + GtkWidget *hbox_topic_buttons; + GtkWidget *topic_button_apply; + GtkWidget *topic_button_cancel; + GtkWidget *modes_frame; + GtkWidget *vbox_internal_modes; + GtkWidget *invite_checkbutton; + GtkWidget *limit_checkbutton; + GtkWidget *private_checkbutton; + GtkWidget *secret_checkbutton; + GtkWidget *key_checkbutton; + GtkWidget *moderated_checkbutton; + GtkWidget *external_checkbutton; + GtkWidget *topic_checkbutton; + GtkWidget *hbox_modes_limit; + GtkWidget *limit_entry; + GtkWidget *limit_label; + GtkWidget *hbox_modes_key; + GtkWidget *key_entry; + GtkWidget *hbox_modes_buttons; + GtkWidget *modes_button_apply; + GtkWidget *modes_button_cancel; + GtkWidget *label_bans; + GtkWidget *scrolled_bans_window; + GtkWidget *bans_clist; + GtkWidget *bans_button_apply; + GtkWidget *bans_button_cancel; + GtkWidget *hbox_bans_buttons; + gint bans_current_row; +}; + diff -urN xchat-1.1.8/src/inbound.c xchat/src/inbound.c --- xchat-1.1.8/src/inbound.c Sat Aug 14 23:57:31 1999 +++ xchat/src/inbound.c Sun Aug 22 14:59:43 1999 @@ -1237,6 +1237,31 @@ handle_command (tbuf, sess, 0, 0); } +gint find_ban(struct bantype *bt, char *banmask) +{ + if (!strcmp(banmask, bt->banmask)) + return(0); + + return(-1); +} + +void insert_ban(struct session *sess, char *banmask, char *banby, char *bantime) +{ + struct bantype *bt; + + bt = malloc(sizeof(struct bantype)); + + snprintf(bt->banmask, 128, "%s", banmask); + snprintf(bt->banby, 64, "%s", banby); + snprintf(bt->bantime, 64, "%s", bantime); + + if (!g_slist_find_custom(sess->banlist, banmask, (GCompareFunc) find_ban)) { + if (!sess->banlist) sess->banlist = NULL; + + sess->banlist = g_slist_append(sess->banlist, bt); + } +} + /* process_line() */ /* returns 0 on success */ /* returns -1 if disconnectd */ @@ -1501,6 +1526,8 @@ case 366: end_of_names (serv, outbuf, find_word (pdibuf, 4), text); break; + case 367: + if (sess) insert_ban(sess, word[5], word[6], word[7]); case 376: case 422: /* end of motd */ serv->end_of_motd = TRUE; diff -urN xchat-1.1.8/src/maingui.c xchat/src/maingui.c --- xchat-1.1.8/src/maingui.c Sun Aug 15 02:47:59 1999 +++ xchat/src/maingui.c Sun Aug 22 15:09:21 1999 @@ -85,6 +85,7 @@ extern struct user *find_name (struct session *sess, char *name); extern void create_panel_widget (); extern void popup_eval_command (struct session *sess, char *cmd, char *nick, char *allnick); +extern void open_chanopts_window(struct session *sess); int key_handle_key_press (GtkWidget *, GdkEventKey *, gpointer); void userlist_button (GtkWidget * box, char *label, char *cmd, @@ -1555,6 +1556,12 @@ #endif +/* chan options callback */ +void chanopts_cb(GtkWidget *button, struct session *sess) +{ + open_chanopts_window(sess); +} + /* 'X' button pressed */ void @@ -1657,6 +1664,11 @@ gtk_box_pack_start (GTK_BOX (tbox), wid, 0, 0, 0); gtk_widget_show (wid); add_tip (wid, "Link/DeLink this tab"); + + wid = gtkutil_button(sess->window, GNOME_STOCK_BUTTON_UP, 0, chanopts_cb, sess, 0); + gtk_box_pack_start(GTK_BOX(tbox), wid, 0, 0, 0); + gtk_widget_show(wid); + add_tip(wid, "Channel Options"); #else wid = gtk_button_new_with_label ("X"); gtk_box_pack_start (GTK_BOX (tbox), wid, 0, 0, 0); diff -urN xchat-1.1.8/src/xchat.h xchat/src/xchat.h --- xchat-1.1.8/src/xchat.h Sat Aug 14 23:56:08 1999 +++ xchat/src/xchat.h Sun Aug 22 14:35:58 1999 @@ -279,6 +279,8 @@ #define flag_l flag_wid[6] #define flag_k flag_wid[7] + + struct session { GtkWidget *window; @@ -314,6 +316,7 @@ struct server *server; struct user *userlist; + GSList *banlist; /* ban list of the channel */ char channel[202]; char waitchannel[202]; /* waiting to join this channel */ char nick[202]; @@ -436,3 +439,15 @@ char nick[64]; char *message; }; + +struct bantype +{ + gchar banmask[128]; + gchar banby[64]; + gchar bantime[64]; +}; + +