aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmd.c8
-rw-r--r--src/config.c3
-rw-r--r--src/config.h2
-rw-r--r--src/irc.c24
-rw-r--r--src/main.c14
-rw-r--r--src/nio.c2
6 files changed, 26 insertions, 27 deletions
diff --git a/src/cmd.c b/src/cmd.c
index b2ae011..03a6a26 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -88,7 +88,7 @@ static void cmd_chan_text(void) {
/* 0x02 = ^B = enable bold */
scr_print_active("<\x02");
- scr_print_active(conf->nick);
+ scr_print_active(config.nick);
scr_putc_active('\x02');
scr_print_active("> ");
@@ -318,7 +318,7 @@ static void do_me(void) {
txbuf_send();
scr_print_current("\x02* ");
- scr_print_current(conf->nick);
+ scr_print_current(config.nick);
scr_print_current("\x02 ");
scr_print_current(arg1);
scr_eol_current();
@@ -476,10 +476,10 @@ void cmd_rejoin_chans(void) {
}
}
- if(!*(conf->extra_channels))
+ if(!*(config.extra_channels))
return;
- strncpy(edit_box, conf->extra_channels, 128);
+ strncpy(edit_box, config.extra_channels, 128);
arg1 = edit_box;
mass_join(0);
edbox_clear();
diff --git a/src/config.c b/src/config.c
deleted file mode 100644
index f7c8982..0000000
--- a/src/config.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "config.h"
-
-conf_t *conf = (conf_t *)0x0400;
diff --git a/src/config.h b/src/config.h
index 6a4bfa9..ff25ea1 100644
--- a/src/config.h
+++ b/src/config.h
@@ -14,3 +14,5 @@ typedef struct {
} conf_t;
extern conf_t *conf;
+
+#define config (*(conf_t *)0x0400)
diff --git a/src/irc.c b/src/irc.c
index 9c2ccd8..559efcb 100644
--- a/src/irc.c
+++ b/src/irc.c
@@ -56,7 +56,7 @@ static void join_channel(void) {
*/
static void send_nick(void) {
- txbuf_set_str2("NICK ", conf->nick);
+ txbuf_set_str2("NICK ", config.nick);
txbuf_send();
}
@@ -224,7 +224,7 @@ static void do_ctcp(char is_notice) {
static void do_privmsg(void) {
/* TODO: this shouldn't be case-sensitive */
- if(strstr(msg_text, conf->nick))
+ if(strstr(msg_text, config.nick))
hilite = 1;
else
hilite = 0;
@@ -260,7 +260,7 @@ static void do_notice(void) {
static void do_join(void) {
ind_act_join();
- if(streq_i(conf->nick, msg_src)) {
+ if(streq_i(config.nick, msg_src)) {
scr_print_active("You");
} else {
scr_print_active("\x02=\x02");
@@ -272,10 +272,10 @@ static void do_join(void) {
}
static void do_nick(void) {
- /* Do not overwrite conf->nick with bogus data! sometimes when
+ /* Do not overwrite config.nick with bogus data! sometimes when
we get disconnected, upon reconnect we get a partial message.
if it's a NICK, missing its destination argument, we end up
- blowing away conf->nick, and subsequent reconnect attempts
+ blowing away config.nick, and subsequent reconnect attempts
fail with "USER: not enough parameters". This is purely
a band-aid; a proper solution involves rewriting parse_msg()
so it knows how many args each msg type needs, and refuses to
@@ -284,9 +284,9 @@ static void do_nick(void) {
return;
// ind_act_none();
- if(streq_i(conf->nick, msg_src)) {
+ if(streq_i(config.nick, msg_src)) {
scr_print_active("You are ");
- strncpy(conf->nick, msg_dest, 32);
+ strncpy(config.nick, msg_dest, 32);
} else {
scr_print_active(msg_src);
scr_print_active(" is ");
@@ -386,7 +386,7 @@ static void do_numeric(void) {
/* use the server's idea of what our nick is, in case it got
truncated. */
case RPL_WELCOME:
- strcpy(conf->nick, msg_args[0]);
+ strcpy(config.nick, msg_args[0]);
regged = 1;
do_catchall(1);
break;
@@ -757,8 +757,8 @@ void irc_register(void) {
/* 2nd arg: local (UNIX) username, just use the nick */
/* 3rd arg: "real" name */
- txbuf_set_str3("USER ", conf->nick, " 0 * :");
- txbuf_append_str(conf->real_name);
+ txbuf_set_str3("USER ", config.nick, " 0 * :");
+ txbuf_append_str(config.real_name);
txbuf_send();
send_nick();
@@ -1027,14 +1027,14 @@ static void poll_keyboard(void) {
/* only exits on error (e.g. connection closed, which might be via /QUIT). */
void irc_loop(void) {
/* this stuff happens on every connect. */
- hide_motd = conf->hide_motd;
+ hide_motd = config.hide_motd;
msgbuf[0] = msgbuf_len = regged = irc_away = minutes = 0;
need_rejoin = 1;
start_minute_timer();
while(1) {
ind_check_timer();
- if(conf->atract_away) {
+ if(config.atract_away) {
if(!irc_away && (OS.atract & 0x80)) {
irc_away = 1;
txbuf_send_str("AWAY :ATRACT mode");
diff --git a/src/main.c b/src/main.c
index ed84670..b2189be 100644
--- a/src/main.c
+++ b/src/main.c
@@ -98,7 +98,7 @@ void txbuf_send_str(const char *str) {
int fn_connect(void) {
scr_display(SCR_SERVER);
scr_print_current("Connecting to: ");
- scr_print_current(conf->url);
+ scr_print_current(config.url);
scr_eol_current();
err = nopen();
@@ -136,9 +136,9 @@ void init_channels(void) {
char i;
for(i = 0; i < MAX_SCREENS - 2; i++) {
- if(conf->channels[i][0]) {
+ if(config.channels[i][0]) {
scr_status[i + 2] = SCR_INACTIVE;
- strcpy(scr_names[i + 2], conf->channels[i]);
+ strcpy(scr_names[i + 2], config.channels[i]);
}
}
}
@@ -167,14 +167,14 @@ void reconnect(void) {
}
void main(void) {
- bell_type = conf->alert_type; /* TODO: have bell.s read staight from the struct */
+ bell_type = config.alert_type; /* TODO: have bell.s read staight from the struct */
OS.shflok = 0; // turn off shift-lock.
OS.soundr = 0; // Turn off SIO beeping sound
- OS.color2 = conf->colors[0]; /* text BG, user-selected */
- OS.color1 = conf->colors[1];
+ OS.color2 = config.colors[0]; /* text BG, user-selected */
+ OS.color1 = config.colors[1];
OS.color0 = 0x06; /* grey for inactive */
OS.color3 = 0x46; /* red for highlight */
- OS.noclik = conf->disable_keyclick;
+ OS.noclik = config.disable_keyclick;
hz = (GTIA_READ.pal & 0x0e) ? 60 : 50;
diff --git a/src/nio.c b/src/nio.c
index d848e18..b43c561 100644
--- a/src/nio.c
+++ b/src/nio.c
@@ -40,7 +40,7 @@ char nopen(void) {
set_defaults();
OS.dcb.dcomnd = 'O'; // Open
OS.dcb.dstats = DWRITE; // sending to to SIO device
- OS.dcb.dbuf = conf->url; // eg: N:TCP//
+ OS.dcb.dbuf = config.url; // eg: N:TCP//
OS.dcb.dbyt = 256; // max size of our device spec
OS.dcb.daux1 = OUPDATE; // Read and write
OS.dcb.daux2 = TRANS; // CR/LF translation