Released v1
This commit is contained in:
76
include/defines.h
Normal file
76
include/defines.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/* vim: set foldmethod=marker : */
|
||||
/* {{{ Legal info
|
||||
* 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 Library 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.
|
||||
}}} */
|
||||
/* {{{ Author and file info
|
||||
* defines.h
|
||||
*
|
||||
* Wed Nov 09 22:16:59 2005
|
||||
* Copyright (C) 2005 Gergely POLONKAI
|
||||
* polesz@techinfo.hu
|
||||
*
|
||||
* Macro definitions used in many places
|
||||
}}} */
|
||||
|
||||
/* {{{ _BC_DEFINES_H */
|
||||
#ifndef _BC_DEFINES_H
|
||||
# define _BC_DEFINES_H
|
||||
|
||||
/* {{{ Locale-related definition. It's much easier this way */
|
||||
#define _(String) gettext(String)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ BC_COMMAND prototype definition */
|
||||
#define BC_COMMAND(x) gboolean x (t_tab_data *tab, int paramnum, gchar **param)
|
||||
/* In typedefs.h there is a struct which is for the command list.
|
||||
* To make life easier, you only have to change the functions' type here (and
|
||||
* in the previous line).
|
||||
*/
|
||||
#define BC_COMMAND_DEF(x) gboolean (* x )(t_tab_data *, int, gchar **)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ Command types */
|
||||
#define CT_INTERNAL 0
|
||||
#define CT_MODULE 1
|
||||
#define CT_SCRIPT 2
|
||||
/* }}} */
|
||||
|
||||
/* {{{ BotCommander error constants */
|
||||
#define BCE_SUCCESS 0
|
||||
#define BCE_BOT_EXISTS 1
|
||||
#define BCE_NOMEM 2
|
||||
#define BCE_NOBOT 3
|
||||
#define BCE_NOPROTO 4
|
||||
#define BCE_CANTRESOLV 5
|
||||
#define BCE_CANTCONNECT 6
|
||||
/* }}} */
|
||||
|
||||
/* {{{ The eggdrops character for eggdrop commands. You should never change this! */
|
||||
#define EGG_CMD_CHAR "."
|
||||
/* }}} */
|
||||
|
||||
/* {{{ The telnet codes we use, from RFC 854) */
|
||||
#define TELNET_IAC "\xff" /* Interpret As Command */
|
||||
#define TELNET_WILL "\xfb" /* Will */
|
||||
#define TELNET_WONT "\xfc" /* Won't */
|
||||
#define TELNET_ECHO "\x01" /* Echo */
|
||||
|
||||
#define TELNET_WILL_ECHO TELNET_IAC TELNET_WILL TELNET_ECHO
|
||||
#define TELNET_WONT_ECHO TELNET_IAC TELNET_WONT TELNET_ECHO
|
||||
/* }}} */
|
||||
|
||||
#endif
|
||||
/* }}} */
|
||||
|
161
include/functions.h
Normal file
161
include/functions.h
Normal file
@@ -0,0 +1,161 @@
|
||||
/* vim: set foldmethod=marker : */
|
||||
/* {{{ Legal info
|
||||
* 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 Library 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.
|
||||
}}} */
|
||||
/* {{{ Author and file info
|
||||
* functions.h
|
||||
*
|
||||
* Wed Nov 09 22:16:59 2005
|
||||
* Copyright 2004 Gergely POLONKAI
|
||||
* polesz@techinfo.hu
|
||||
*
|
||||
* Function prototypes
|
||||
}}} */
|
||||
|
||||
/* {{{ _BC_FUNCTIONS_H */
|
||||
#ifndef _BC_FUNCTIONS_H
|
||||
# define _BC_FUNCTIONS_H
|
||||
|
||||
/* {{{ Includes */
|
||||
# include <gtk/gtk.h>
|
||||
# include <stdarg.h>
|
||||
# include "typedefs.h"
|
||||
/* }}} */
|
||||
|
||||
/* {{{ widgets.c */
|
||||
void set_title(t_tab_data *, char *, ...);
|
||||
int create_main_window(void);
|
||||
void feed_message_to_terminal(t_tab_data *, gboolean, gchar *, ...);
|
||||
void feed_error_to_terminal(t_tab_data *, gboolean, gchar *, ...);
|
||||
void feed_info_to_terminal(t_tab_data *, gboolean, gchar *, ...);
|
||||
/* }}} */
|
||||
|
||||
/* {{{ callbacks.c */
|
||||
void destroy_event(GtkWidget *, gpointer);
|
||||
gboolean delete_event(GtkWidget *, GdkEvent *, gpointer);
|
||||
void toolbar_quit(GtkButton *, gpointer);
|
||||
void toolbar_add_tab(GtkButton *, gpointer);
|
||||
void toolbar_close_active(GtkButton *, gpointer);
|
||||
void toolbar_open_prefs(GtkButton *, gpointer);
|
||||
void book_change_tab(GtkNotebook *, GtkNotebookPage *newpage, guint, gpointer);
|
||||
void close_tab_cb(GtkWidget *, gpointer);
|
||||
gboolean entry_activate(GtkWidget *, gpointer);
|
||||
void menu_exit(GtkWidget *, gpointer);
|
||||
void menu_mode_changed(GtkWidget *, gpointer);
|
||||
void menu_botlist_open(GtkWidget *, gpointer);
|
||||
void menu_prefs_open(GtkWidget *, gpointer);
|
||||
void menu_new_tab(GtkWidget *, gpointer);
|
||||
void menu_close_tab(GtkWidget *, gpointer);
|
||||
void menu_about(GtkWidget *, gpointer);
|
||||
int vte_clicked(GtkWidget *, gpointer);
|
||||
int entry_keypress(GtkEntry *, GdkEventKey *, gpointer);
|
||||
void socket_event(gpointer, gint, GdkInputCondition);
|
||||
void menu_showhide_sidebar(GtkWidget *, gpointer);
|
||||
/* }}} */
|
||||
|
||||
/* {{{ main.c */
|
||||
void exit_cleanly(gboolean);
|
||||
void change_mode(char, gboolean);
|
||||
/* }}} */
|
||||
|
||||
/* {{{ tabs.c */
|
||||
int add_tab(t_tab_data **);
|
||||
t_tab_data *get_active_tab(void);
|
||||
gboolean close_tab(t_tab_data *);
|
||||
gboolean assign_bot_to_tab_by_name(t_tab_data *, gchar *);
|
||||
void assign_bot_to_tab(t_tab_data *, t_bot_data *);
|
||||
gint connect_tab(t_tab_data *);
|
||||
void update_channel_list(t_tab_data *);
|
||||
void update_user_list(t_tab_data *);
|
||||
gint find_tab_by_pagenum(gconstpointer, gconstpointer);
|
||||
void disconnect_tab(t_tab_data *);
|
||||
void change_active_tab(gint);
|
||||
/* }}} */
|
||||
|
||||
/* {{{ string.c */
|
||||
gboolean streq(gchar *, gchar *, gboolean);
|
||||
int wordwrap(gchar *, gchar *, gchar ***, gint *);
|
||||
void wl_free(gchar ***, gint);
|
||||
gboolean is_numeric(gchar *, gint *);
|
||||
gchar *trim(gchar *);
|
||||
/* }}} */
|
||||
|
||||
/* {{{ bots.c */
|
||||
#ifdef DEBUG
|
||||
void list_bots(void);
|
||||
#endif
|
||||
gint add_bot(gchar *, gchar *, guint, gchar *);
|
||||
t_bot_data *get_bot_by_botname(gchar *);
|
||||
gint create_bot_record(gchar *, gint, t_bot_data **);
|
||||
gint update_bot(t_bot_data *, gchar *, gchar *, guint, gchar *);
|
||||
void save_bot(t_bot_data *, t_bot_data *);
|
||||
void free_bot_data(gpointer, gpointer);
|
||||
t_bot_data *get_bot_by_conf_num(guint);
|
||||
/* }}} */
|
||||
|
||||
/* {{{ commands.c */
|
||||
gboolean process_commandline(gchar *, t_tab_data *);
|
||||
void process_botcommander_script_commands(t_tab_data *, char *);
|
||||
/* }}} */
|
||||
|
||||
/* {{{ config.c */
|
||||
gboolean init_config(void);
|
||||
void read_config_data(void);
|
||||
gboolean set_int_conf_value(gchar *, gint);
|
||||
gboolean set_string_conf_value(gchar *, gchar *);
|
||||
void read_bot_list_from_config(void);
|
||||
void save_bot_list_to_config(void);
|
||||
/* }}} */
|
||||
|
||||
/* {{{ about.c */
|
||||
void display_about_box(void);
|
||||
/* }}} */
|
||||
|
||||
/* {{{ setup.c */
|
||||
void display_setup_window(void);
|
||||
/* }}} */
|
||||
|
||||
/* {{{ networking.c */
|
||||
gint connect_to_host(gchar *, guint, int *, gint *, t_tab_data *);
|
||||
void process_incoming_data(t_tab_data *, char *);
|
||||
/* }}} */
|
||||
|
||||
/* {{{ history.c */
|
||||
void history_add(t_tab_data *, gchar, gchar *);
|
||||
gint get_history_len(t_tab_data *);
|
||||
/* }}} */
|
||||
|
||||
/* {{{ botlist.c */
|
||||
void display_botlist_window(void);
|
||||
void create_bot_editor(t_bot_data *);
|
||||
/* }}} */
|
||||
|
||||
/* {{{ chanprops.c */
|
||||
void update_channel_property(t_tab_data *, gchar *, gchar *);
|
||||
/* }}} */
|
||||
|
||||
/* {{{ debug.c */
|
||||
/* This one is only compiled if DEBUG is defined */
|
||||
# ifdef DEBUG
|
||||
void debug_init(void);
|
||||
void set_context(char *file, int line);
|
||||
# define Context set_context(__FILE__, __LINE__)
|
||||
# else /* DEBUG */
|
||||
# define Context
|
||||
# endif /* DEBUG */
|
||||
/* }}} */
|
||||
|
||||
#endif /* _BC_FUNCTIONS_H */
|
||||
/* }}} */
|
187
include/typedefs.h
Normal file
187
include/typedefs.h
Normal file
@@ -0,0 +1,187 @@
|
||||
/* vim: set foldmethod=marker : */
|
||||
/* {{{ Legal info
|
||||
* 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 Library 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.
|
||||
}}} */
|
||||
/* {{{ Author and file info
|
||||
* typedefs.h
|
||||
*
|
||||
* Wed Nov 09 22:16:59 2005
|
||||
* Copyright (C) 2005 Gergely POLONKAI
|
||||
* polesz@techinfo.hu
|
||||
*
|
||||
* Type definitions
|
||||
}}} */
|
||||
|
||||
/* {{{ _BC_TYPEDEFS_H */
|
||||
#ifndef _BC_TYPEDEFS_H
|
||||
# define _BC_TYPEDEFS_H
|
||||
|
||||
/* {{{ Includes */
|
||||
# include <gtk/gtk.h>
|
||||
|
||||
# include "defines.h"
|
||||
/* }}} */
|
||||
|
||||
/* {{{ Bot data */
|
||||
typedef struct _t_bot_data {
|
||||
/* The bot's name. NULL if now known */
|
||||
gchar *botname;
|
||||
/* The hostname of the bot */
|
||||
gchar *host;
|
||||
/* The port number of the bot */
|
||||
guint port;
|
||||
/* The handle in the bot (may be NULL) */
|
||||
gchar *handle;
|
||||
/* The config key value for this bot (used only when loading bot data from config */
|
||||
guint id;
|
||||
} t_bot_data;
|
||||
/* }}} */
|
||||
|
||||
/* {{{ History data */
|
||||
typedef struct _t_history_data {
|
||||
gchar *line;
|
||||
struct _t_history_data *next;
|
||||
} t_history_data;
|
||||
/* }}} */
|
||||
|
||||
/* {{{ Tab data */
|
||||
typedef struct _t_tab_data {
|
||||
/* General data */
|
||||
|
||||
/* The number of the tab */
|
||||
gint num;
|
||||
/* The current mode in the tab (b|e|m)*/
|
||||
char mode;
|
||||
/* The bot assigned to this tab */
|
||||
t_bot_data *bot;
|
||||
/* The history data */
|
||||
t_history_data *history;
|
||||
/* The current position in the history list */
|
||||
gint history_position;
|
||||
|
||||
/* BC script related data */
|
||||
|
||||
/* Currently we are in the middle of the channel list */
|
||||
gboolean chanlist_process;
|
||||
/* Currently we are in the middle of the user list */
|
||||
gboolean userlist_process;
|
||||
/* Currently we are processing the properties of this channel */
|
||||
gchar *chanprops_process;
|
||||
/* This is number x in the property list */
|
||||
gint chanprops_list_num;
|
||||
/* The channel list */
|
||||
GList *actual_channel_list;
|
||||
/* The user list */
|
||||
GList *actual_user_list;
|
||||
|
||||
/* Networking data */
|
||||
|
||||
/* TRUE if the tab is connected, FALSE otherwise */
|
||||
gboolean connected;
|
||||
/* The socket descriptor */
|
||||
int sock;
|
||||
/* The GDK socket tag */
|
||||
gint socktag;
|
||||
/* Set to TRUE when the first byte arrives from the other side */
|
||||
gboolean data_arrived;
|
||||
|
||||
/* Widgets */
|
||||
|
||||
/* The virtual terminal */
|
||||
GtkWidget *vt;
|
||||
/* Command line */
|
||||
GtkWidget *editbox;
|
||||
/* The hbox containing the tab label and the close button */
|
||||
GtkWidget *labelbox;
|
||||
/* The tab label */
|
||||
GtkWidget *label;
|
||||
/* The close button */
|
||||
GtkWidget *closebutton;
|
||||
/* List of channels */
|
||||
GtkWidget *channel_list;
|
||||
/* List of users (handles) */
|
||||
GtkWidget *user_list;
|
||||
/* Channel store */
|
||||
GtkListStore *channel_store;
|
||||
/* User store */
|
||||
GtkListStore *user_store;
|
||||
} t_tab_data;
|
||||
/* }}} */
|
||||
|
||||
/* {{{ Configuration data */
|
||||
typedef struct _t_config_data {
|
||||
/* GUI options */
|
||||
gboolean change_to_new_tab;
|
||||
/* VTE options */
|
||||
gboolean scroll_on_output;
|
||||
gboolean transparent_background;
|
||||
gfloat background_saturation;
|
||||
gchar *vte_font;
|
||||
/* General options */
|
||||
gboolean change_to_message;
|
||||
#ifdef DEBUG
|
||||
gboolean debug;
|
||||
#endif /* DEBUG */
|
||||
gchar default_mode;
|
||||
gboolean save_prefs;
|
||||
gint history_len;
|
||||
} t_config_data;
|
||||
/* }}} */
|
||||
|
||||
/* {{{ Command Data */
|
||||
typedef struct _t_command {
|
||||
/* The command verb */
|
||||
gchar *command_verb;
|
||||
/* Type of the command: 0 - Internal; 1 - From a module; 2 - From a script */
|
||||
guint type;
|
||||
/* How many parameters do we require? */
|
||||
gint min_paramnum;
|
||||
/* Can this command be abbreviated? */
|
||||
gboolean can_abbrev;
|
||||
/* The commands function */
|
||||
BC_COMMAND_DEF(func);
|
||||
} t_command;
|
||||
/* }}} */
|
||||
|
||||
/* {{{ Channel data */
|
||||
typedef struct _t_channel {
|
||||
/* The channel name */
|
||||
char *name;
|
||||
/* TRUE if then channel is active */
|
||||
gboolean active;
|
||||
/* The property list */
|
||||
GList *properties;
|
||||
} t_channel;
|
||||
/* }}} */
|
||||
|
||||
/* {{{ User data */
|
||||
typedef struct _t_user {
|
||||
/* The use name */
|
||||
char *name;
|
||||
} t_user;
|
||||
/* }}} */
|
||||
|
||||
/* {{{ Channel properties */
|
||||
typedef struct _t_chan_prop {
|
||||
char *name;
|
||||
gboolean bool_prop;
|
||||
gboolean bool_value;
|
||||
gchar *string_value;
|
||||
} t_chan_prop;
|
||||
/* }}} */
|
||||
|
||||
#endif
|
||||
/* }}} */
|
||||
|
63
include/variables.h
Normal file
63
include/variables.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/* vim: set foldmethod=marker : */
|
||||
/* {{{
|
||||
* 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 Library 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.
|
||||
}}} */
|
||||
/* {{{
|
||||
* variables.h
|
||||
*
|
||||
* Wed Nov 09 22:16:59 2005
|
||||
* Copyright (C) 2005 Gergely POLONKAI
|
||||
* polesz@techinfo.hu
|
||||
*
|
||||
* Variable definitions
|
||||
}}} */
|
||||
|
||||
/* {{{ _BC_VARIABLES_H */
|
||||
#ifndef _BC_VARIABLES_H
|
||||
# define _BC_VARIABLES_H
|
||||
|
||||
/* {{{ Includes */
|
||||
# include <gtk/gtk.h>
|
||||
# include <gconf/gconf-client.h>
|
||||
|
||||
#include "typedefs.h"
|
||||
/* }}} */
|
||||
|
||||
/* {{{ widgets.c */
|
||||
extern GtkWidget *main_window;
|
||||
extern GtkWidget *main_book;
|
||||
extern GtkWidget *main_statuslabel_mode;
|
||||
extern GtkWidget *main_menu_mode_b;
|
||||
extern GtkWidget *main_menu_mode_e;
|
||||
extern GtkWidget *main_menu_mode_m;
|
||||
extern GtkWidget *main_menu_show_sidebar;
|
||||
/* }}} */
|
||||
|
||||
/* {{{ tabs.c */
|
||||
extern GList *tab_list;
|
||||
/* }}} */
|
||||
|
||||
/* {{{ bots.c */
|
||||
extern GList *internal_bot_list;
|
||||
/* }}} */
|
||||
|
||||
/* {{{ config.c */
|
||||
extern t_config_data config_data;
|
||||
extern GConfClient *gconf_client;
|
||||
/* }}} */
|
||||
|
||||
#endif
|
||||
/* }}} */
|
||||
|
Reference in New Issue
Block a user