Initial revision

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 1999-09-03 14:27:29 +00:00 committed by cras
commit 770ae4596d
29 changed files with 4987 additions and 0 deletions

2
src/.cvsignore Normal file
View file

@ -0,0 +1,2 @@
Makefile
Makefile.in

17
src/Makefile.am Normal file
View file

@ -0,0 +1,17 @@
if HAS_CURSES
TEXTUI=gui-text
endif
if BUILD_GNOMEUI
GNOMEUI=gui-gnome
endif
noinst_HEADERS = \
common.h \
common-setup.h \
irssi-plugin.h \
irssi-plugin-gui.h
SUBDIRS = irc-base irc-extra ui-common lib-config lib-nongui settings $(GNOMEUI) $(TEXTUI) gui-none
EXTRA_DIST = signal.doc

125
src/common-setup.h Normal file
View file

@ -0,0 +1,125 @@
#ifndef __COMMON_SETUP_H
#define __COMMON_SETUP_H
#define DCC_FILE_CREATE_MODE 0644
#define LOG_FILE_CREATE_MODE 0644
#define CMD_CHAR '/'
/* How often to check if there's anyone to be unignored in autoignore list */
#define AUTOIGNORE_TIMECHECK 10000
/* How often to check if there's anyone to be unbanned in knockout list */
#define KNOCKOUT_TIMECHECK 10000
/* How often to check users in notify list */
#define NOTIFY_TIMECHECK 30000
/* How often to check for gone status of nick */
#define MAX_GONE_REFRESH_TIME 300
/* Maximum time to wait for more JOINs before sending massjoin signal */
#define MAX_MASSJOIN_WAIT 5000
/* lists */
extern GList *aliases, *ignores, *completions, *notifies, *hilights;
/* look and feel */
extern gboolean toggle_show_menubar;
extern gboolean toggle_show_toolbar;
extern gboolean toggle_show_statusbar;
extern gboolean toggle_show_nicklist;
extern gboolean toggle_show_timestamps;
extern gboolean toggle_hide_text_style;
extern gboolean toggle_bell_beeps;
extern gboolean toggle_actlist_moves;
extern gboolean toggle_privmsg_beeps;
extern gboolean toggle_use_status_window;
extern gboolean toggle_use_msgs_window;
extern gboolean toggle_autoraise_msgs_window;
extern gboolean toggle_autocreate_query;
extern gboolean toggle_notifylist_popups;
extern gboolean toggle_use_tabbed_windows;
extern gint tab_orientation;
/* misc */
extern gchar *url_www_client;
extern gchar *url_ftp_client;
extern gchar *url_mail_client;
extern gchar *ctcp_version_reply;
extern gchar *default_quit_message;
extern gchar *default_user_mode;
extern gint max_command_history;
extern gint max_textwidget_lines;
extern gint rawlog_lines;
extern gint block_remove_lines;
extern gint knockout_time; /* How many seconds to keep /knockouted ban */
extern gboolean check_irssi_versions; /* Check if there's new irssi version available */
/* nick completion */
extern gchar *completion_char;
extern gboolean completion_disable_auto;
extern gint completion_keep_publics;
extern gint completion_keep_ownpublics;
extern gint completion_keep_privates;
/* flood protection */
extern gint flood_timecheck; /* Flood check timeout */
extern gint flood_max_msgs; /* Max msgs in FLOOD_TIMECHECK msecs before considered as flooding */
extern gint autoignore_time; /* How many seconds to keep someone autoignored */
extern gint ctcp_timecheck; /* CTCP reply send timeout */
extern gint max_ctcp_queue; /* Max CTCP reply queue length */
extern gint cmd_queue_speed; /* Minimum timeout before sending the next command to server */
/* dcc */
extern gboolean toggle_dcc_autodisplay_dialog;
extern gboolean toggle_dcc_autoget;
extern gboolean toggle_dcc_autorename;
extern gint dcc_max_autoget_size;
extern gchar *dcc_download_path;
extern gboolean toggle_dcc_fast_send;
extern gchar *dcc_upload_path;
extern gboolean toggle_dcc_mirc_ctcp;
extern gint dcc_block_size;
extern gint dcc_timeout;
/* servers */
typedef struct
{
gchar *server;
gchar *ircnet;
gchar *password;
gint port;
gboolean autoconnect;
time_t last_connect; /* to avoid reconnecting too fast.. */
}
SETUP_SERVER_REC;
/* servers */
extern GList *setupservers; /* list of local servers */
extern GList *ircnets; /* list of available ircnets */
extern gint server_reconnect_time; /* reconnect to server no sooner than n seconds */
extern gchar *source_host; /* Our own IP to use */
extern gboolean source_host_ok; /* Use source_host_ip .. */
extern IPADDR source_host_ip; /* Resolved address */
extern gchar *default_nick, *alternate_nick, *user_name, *real_name;
extern gboolean toggle_skip_motd;
/* IRC proxy */
extern gboolean toggle_use_ircproxy;
extern gchar *proxy_address;
extern gint proxy_port;
extern gchar *proxy_string;
/* appearance */
extern gboolean toggle_use_zvt;
extern gboolean toggle_use_transparency;
extern gboolean toggle_shaded_transparency;
extern gint panel_max_channels;
#endif

114
src/common.h Normal file
View file

@ -0,0 +1,114 @@
#ifndef __COMMON_H
#define __COMMON_H
#define IRSSI_AUTHOR "Timo Sirainen <cras@irccrew.org>"
#define IRSSI_WEBSITE "http://xlife.dhs.org/irssi/"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdarg.h>
#include <ctype.h>
# ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include <errno.h>
#include <time.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/utsname.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_DIRENT_H
# include <dirent.h>
#endif
#include <fcntl.h>
#ifdef HAVE_SOCKS_H
#include <socks.h>
#endif
#include <netdb.h>
#include <sys/socket.h>
#include <signal.h>
#include <sys/signal.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <glib.h>
#include <gmodule.h>
typedef struct
{
gushort family;
#ifdef HAVE_IPV6
struct in6_addr addr;
#else
struct in_addr addr;
#endif
}
IPADDR;
#include "lib-config/irssi-config.h"
#include "common-setup.h"
/* GUI library must provide these functions: */
typedef enum
{
GUI_INPUT_READ = 1 << 0,
GUI_INPUT_WRITE = 1 << 1,
GUI_INPUT_EXCEPTION = 1 << 2
} GUIInputCondition;
typedef void (*GUIInputFunction) (gpointer data, gint handle, GUIInputCondition condition);
typedef gint (*GUITimeoutFunction) (gpointer data);
gint gui_input_add(gint handle, GUIInputCondition condition,
GUIInputFunction function, gpointer data);
void gui_input_remove(gint tag);
guint gui_timeout_add(guint32 interval, GUITimeoutFunction function, gpointer data);
void gui_timeout_remove(gint tag);
#ifdef MEM_DEBUG
void ig_mem_profile(void);
void ig_set_data(gchar *data);
gpointer ig_malloc(gint size, gchar *file, gint line);
gpointer ig_malloc0(gint size, gchar *file, gint line);
gpointer ig_realloc(gpointer mem, gulong size, gchar *file, gint line);
gchar *ig_strdup(const char *str, gchar *file, gint line);
gchar *ig_strconcat(const char *str, ...);
gchar *ig_strdup_printf(const gchar *format, ...) G_GNUC_PRINTF (1, 2);
void ig_free(gpointer p);
GString *ig_string_new(gchar *str);
void ig_string_free(GString *str, gboolean freeit);
#define g_malloc(a) ig_malloc(a, __FILE__, __LINE__)
#define g_malloc0(a) ig_malloc0(a, __FILE__, __LINE__)
#define g_realloc(a,b) ig_realloc(a, b, __FILE__, __LINE__)
#define g_strdup(a) ig_strdup(a, __FILE__, __LINE__)
#define g_strconcat ig_strconcat
#define g_strdup_printf ig_strdup_printf
#define g_strdup_vprintf ig_strdup_vprintf
#define g_free ig_free
#define g_string_new ig_string_new
#define g_string_free ig_string_free
#endif
#endif

11
src/irssi-plugin-gui.h Normal file
View file

@ -0,0 +1,11 @@
/* This contains all the necessary includes for creating GUI widgets to
plugins */
#ifdef HAVE_GTK
#include "gui-gnome/irssi.h"
#include "gui-gnome/setup-int.h"
#endif
#if defined (HAVE_CURSES) || defined (HAVE_SLANG)
#include "gui-text/irssi.h"
#endif

9
src/irssi-plugin.h Normal file
View file

@ -0,0 +1,9 @@
/* This contains all the necessary includes for irssi plugins.
irc-extra/plugins.h and irc-extra/plugins-commands.h has all the plugin
management functions */
#include "common.h"
#include "irc-base/irc-base.h"
#include "irc-extra/irc-extra.h"
#include "ui-common/ui-common.h"
#include "settings/settings.h"

178
src/signal.doc Normal file
View file

@ -0,0 +1,178 @@
IRC base
--------
* Requires to work properly:
"gui exit", CHANNEL_REC
"gui channel open", CHANNEL_REC
"send command", gchar *command, SERVER_REC, CHANNEL_REC
* Provides signals:
bans.c:
"ban new", BAN_REC
"ban remove", BAN_REC
"ban exception new", BAN_REC
"ban exception remove", BAN_REC
"ban type changed", gchar *bantype
channels.c:
"channel created", CHANNEL_REC
"channel destroyed", CHANNEL_REC
"channel name changed", CHANNEL_REC
"channel topic changed", CHANNEL_REC
"channel query", CHANNEL_REC
"channel sync", CHANNEL_REC
ctcp.c:
"ctcp msg "<cmd>, gchar *args, SERVER_REC, gchar *nick, gchar *addr, gchar *target
"default ctcp msg", gchar *args, SERVER_REC, gchar *nick, gchar *addr, gchar *target
"ctcp reply "<cmd>, gchar *args, SERVER_REC, gchar *nick, gchar *addr, gchar *target
"default ctcp reply", gchar *args, SERVER_REC, gchar *nick, gchar *addr, gchar *target
irc.c:
"send command", gchar *args, SERVER_REC
"command "<cmd>, gchar *args, SERVER_REC, CHANNEL_REC
"default command", gchar *args, SERVER_REC, CHANNEL_REC
"server event", gchar *args, SERVER_REC, gchar *sender_nick, gchar *sender_address
"event "<cmd>, gchar *args, SERVER_REC, gchar *sender_nick, gchar *sender_address
"default event", gchar *args, SERVER_REC, gchar *sender_nick, gchar *sender_address
modes.c:
"invitelist new", CHANNEL_REC, gchar *mask
"invitelist remove", CHANNEL_REC, gchar *mask
"channel mode changed", CHANNEL_REC
"user mode changed", SERVER_REC
"nick mode changed", CHANNEL_REC, NICK_REC
nicklist.c:
"nicklist new" CHANNEL_REC, NICK_REC
"nicklist remove" CHANNEL_REC, NICK_REC
"nicklist changed" CHANNEL_REC, NICK_REC, gchar *oldnick
"server nick changed" SERVER_REC
"massjoin" CHANNEL_REC, GList of NICK_RECs
server.c:
"server connect failed", SERVER_REC
"server connected", SERVER_REC
"server connecting", SERVER_REC, gulong *ip
"server looking", SERVER_REC
"server disconnected", SERVER_REC
"event connected", SERVER_REC
signal.c:
"signal", gchar *name, ...
IRC extra
---------
* Requires to work properly:
"print text stripped", SERVER_REC, gchar *channel, GINT_TO_POINTER(level), gchar *text
"plugin add menu", gchar *menuitem, void (*unload_func) (gpointer, PLUGIN_REC), PLUGIN_REC
* Provides signals:
dcc.c:
"dcc ctcp"<cmd>, gchar *args, DCC_REC
"default dcc ctcp", gchar *args, DCC_REC
"dcc unknown ctcp", gchar *args, gchar *sender, gchar *sendaddr
"dcc reply"<cmd>, gchar *args, DCC_REC
"default dcc reply"<cmd>, gchar *args, DCC_REC
"dcc unknown reply", gchar *args, gchar *sender, gchar *sendaddr
"dcc chat message", DCC_REC, gchar *msg
"dcc created", DCC_REC
"dcc destroyed", DCC_REC
"dcc connected", DCC_REC
"dcc rejecting", DCC_REC
"dcc closed", DCC_REC
"dcc chat message", DCC_REC, gchar *msg
"dcc transfer update", DCC_REC
"dcc request", DCC_REC
"dcc get receive", DCC_REC
"dcc error connect", DCC_REC
"dcc error file create", DCC_REC, gchar *filename
"dcc error file not found", gchar *nick, gchar *filename
"dcc error get not found", gchar *nick
"dcc error send exists", gchar *nick, gchar *filename
"dcc error unknown type", gchar *type
"dcc error close not found", gchar *type, gchar *nick, gchar *filename
flood.c:
"flood", SERVER_REC, gchar *nick, gchar *host, gchar *level, gchar *target
ignore.c:
"autoignore new", SERVER_REC, AUTOIGNORE_REC
"autoignore remove", SERVER_REC, AUTOIGNORE_REC
"ignore new", LIST_REC
"ignore change", LIST_REC
"ignore remove", LIST_REC
log.c:
"log created", LOG_REC
"log destroyed", LOG_REC
"log opened", LOG_REC
"log closed", LOG_REC
"log written", LOG_REC, gchar *line
"log item created", LOG_REC, LOG_ITEM_REC
"log item destroyed", LOG_REC, LOG_ITEM_REC
notifylist.c:
"notifylist new", LIST_REC
"notifylist remove", LIST_REC
"notifylist joined", SERVER_REC, gchar *nick, gchar *username, gchar *host, gchar *realname
"notifylist left", SERVER_REC, gchar *nick
plugins.c:
"plugin created", PLUGIN_REC
"plugin destroyed", PLUGIN_REC
"plugin cant load", gchar *name
"plugin already loaded", gchar *name
"plugin not loaded", gchar *name
UI common
---------
* Requires to work properly:
"gui print text", CHANNEL_REC, GINT_TO_POINTER fg, bg, flags, gchar *text
"gui window goto", GINT_TO_POINTER(number)
( "print text finished", CHANNEL_REC ) - can be used to determine when
all "gui print text"s are sent
* Provides signals:
ui-printtext.c:
"print text", SERVER_REC, gchar *channel, GINT_TO_POINTER(level), gchar *text
"print text stripped", SERVER_REC, gchar *channel, GINT_TO_POINTER(level), gchar *text
ui-themes.c:
"theme created", THEME_REC
"theme destroyed", THEME_REC
ui-windows.c:
"window created", WINDOW_REC
"window destroyed", WINDOW_REC