Compare commits
4 Commits
c14f4634b6
...
ad77e19bfe
Author | SHA1 | Date | |
---|---|---|---|
|
ad77e19bfe | ||
|
edd460a8fa | ||
|
4cd5bdb381 | ||
c6a872ed61 |
@ -3,7 +3,7 @@ if COND_WANT_TESTS
|
|||||||
endif
|
endif
|
||||||
SUBDIRS = src . $(MAYBE_TESTS)
|
SUBDIRS = src . $(MAYBE_TESTS)
|
||||||
|
|
||||||
dist_man_MANS = bip.1 bip.conf.5 bipmkpw.1
|
dist_man_MANS = bip.1 bip.conf.5 bipmkpw.1 bipgenconfig.1
|
||||||
|
|
||||||
examplesdir = $(prefix)/share/doc/bip/examples/
|
examplesdir = $(prefix)/share/doc/bip/examples/
|
||||||
dist_examples_DATA = samples/bip.conf samples/bip.vim
|
dist_examples_DATA = samples/bip.conf samples/bip.vim
|
||||||
|
@ -146,7 +146,7 @@ Defines the delay between each logfiles sync to the disk. Must be a non null
|
|||||||
positive integer.
|
positive integer.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fBreconn_timer\fP (default: \fB120\fP)
|
\fBreconn_timer\fP (default: \fB30\fP)
|
||||||
Defines the initial delay (in seconds) before a reconnection attempt.
|
Defines the initial delay (in seconds) before a reconnection attempt.
|
||||||
The delay increases with the number of attempts:
|
The delay increases with the number of attempts:
|
||||||
delay = reconn_timer * number of attempts
|
delay = reconn_timer * number of attempts
|
||||||
@ -227,7 +227,7 @@ This option should of course not be enabled if \fBbacklog_lines\fP is 0 !
|
|||||||
If you still want to do so, don't forget to \fB/BIP BLRESET\fP sometimes.
|
If you still want to do so, don't forget to \fB/BIP BLRESET\fP sometimes.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fBbacklog_lines\fP (default: \fB10\fP)
|
\fBbacklog_lines\fP (default: \fB0\fP)
|
||||||
If set to 0, BIP will replay all the logs since last client disconnect. Else,
|
If set to 0, BIP will replay all the logs since last client disconnect. Else,
|
||||||
it'll replay exactly \fBbacklog_lines\fP lines on each channel and privates.
|
it'll replay exactly \fBbacklog_lines\fP lines on each channel and privates.
|
||||||
Be aware that BIP will replay \fBbacklog_lines\fP lines of all privates, even
|
Be aware that BIP will replay \fBbacklog_lines\fP lines of all privates, even
|
||||||
|
@ -86,7 +86,7 @@
|
|||||||
# Sets the initial delay (in seconds) before a reconnection attempt.
|
# Sets the initial delay (in seconds) before a reconnection attempt.
|
||||||
# The delay increases with the number of attempts:
|
# The delay increases with the number of attempts:
|
||||||
# delay = reconn_timer * number of attempts
|
# delay = reconn_timer * number of attempts
|
||||||
#reconn_timer = 120;
|
#reconn_timer = 30;
|
||||||
|
|
||||||
# Network definition, a name and server info
|
# Network definition, a name and server info
|
||||||
#network {
|
#network {
|
||||||
|
@ -119,7 +119,7 @@ my %optdesc = (
|
|||||||
'optional' => 1,
|
'optional' => 1,
|
||||||
'depends' => 'log', 'depval' => 'true',
|
'depends' => 'log', 'depval' => 'true',
|
||||||
'desc' => 'Do you want to activate backlog {play back logs} system ?' },
|
'desc' => 'Do you want to activate backlog {play back logs} system ?' },
|
||||||
'backlog_lines' => { 'type' => 'i', 'adv' => 0, 'default' => '10',
|
'backlog_lines' => { 'type' => 'i', 'adv' => 0, 'default' => '0',
|
||||||
'optional' => 1,
|
'optional' => 1,
|
||||||
'depends' => 'backlog', 'depval' => 'true',
|
'depends' => 'backlog', 'depval' => 'true',
|
||||||
'desc' => 'How much line do you want bip to play back upon client connect' .
|
'desc' => 'How much line do you want bip to play back upon client connect' .
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define DEFAULT_BACKLOG 1
|
#define DEFAULT_BACKLOG 1
|
||||||
#define DEFAULT_ALWAYS_BACKLOG 0
|
#define DEFAULT_ALWAYS_BACKLOG 0
|
||||||
#define DEFAULT_BL_MSG_ONLY 0
|
#define DEFAULT_BL_MSG_ONLY 0
|
||||||
#define DEFAULT_BACKLOG_LINES 10
|
#define DEFAULT_BACKLOG_LINES 0
|
||||||
#define DEFAULT_BACKLOG_TIMESTAMP BLTSTime
|
#define DEFAULT_BACKLOG_TIMESTAMP BLTSTime
|
||||||
#define DEFAULT_BLRESET_ON_TALK 0
|
#define DEFAULT_BLRESET_ON_TALK 0
|
||||||
#define DEFAULT_BLRESET_CONNECTION 0
|
#define DEFAULT_BLRESET_CONNECTION 0
|
||||||
@ -29,6 +29,6 @@
|
|||||||
#define DEFAULT_LOG_LEVEL LOG_INFO
|
#define DEFAULT_LOG_LEVEL LOG_INFO
|
||||||
#define DEFAULT_LOG_FORMAT "%u/%n/%Y-%m/%c.%d.log"
|
#define DEFAULT_LOG_FORMAT "%u/%n/%Y-%m/%c.%d.log"
|
||||||
#define DEFAULT_BIP_USE_NOTICE 0
|
#define DEFAULT_BIP_USE_NOTICE 0
|
||||||
#define DEFAULT_RECONN_TIMER 120
|
#define DEFAULT_RECONN_TIMER 30
|
||||||
|
|
||||||
#endif /* DEFAULTS_H */
|
#endif /* DEFAULTS_H */
|
||||||
|
16
src/irc.c
16
src/irc.c
@ -33,6 +33,7 @@
|
|||||||
extern int sighup;
|
extern int sighup;
|
||||||
extern bip_t *_bip;
|
extern bip_t *_bip;
|
||||||
|
|
||||||
|
static int irc_generic_error(struct link_server *server, struct line *line);
|
||||||
static int irc_join(struct link_server *server, struct line *line);
|
static int irc_join(struct link_server *server, struct line *line);
|
||||||
static int irc_part(struct link_server *server, struct line *line);
|
static int irc_part(struct link_server *server, struct line *line);
|
||||||
static int irc_mode(struct link_server *server, struct line *line);
|
static int irc_mode(struct link_server *server, struct line *line);
|
||||||
@ -625,6 +626,10 @@ int irc_dispatch_server(bip_t *bip, struct link_server *server,
|
|||||||
ret = irc_quit(server, line);
|
ret = irc_quit(server, line);
|
||||||
} else if (irc_line_elem_equals(line, 0, "NICK")) {
|
} else if (irc_line_elem_equals(line, 0, "NICK")) {
|
||||||
ret = irc_nick(server, line);
|
ret = irc_nick(server, line);
|
||||||
|
} else if (irc_line_is_error(line)) {
|
||||||
|
// IRC errors catchall (for unhandled ones)
|
||||||
|
// logs error to bip.log
|
||||||
|
ret = irc_generic_error(server, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == OK_COPY) {
|
if (ret == OK_COPY) {
|
||||||
@ -1448,6 +1453,17 @@ static int origin_is_me(struct line *l, struct link_server *server)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int irc_generic_error(struct link_server *server, struct line *line)
|
||||||
|
{
|
||||||
|
if (irc_line_count(line) == 4)
|
||||||
|
mylog(LOG_INFO, "[%s] IRC error: %s", LINK(server)->name,
|
||||||
|
irc_line_elem(line, 3));
|
||||||
|
else
|
||||||
|
mylog(LOG_INFO, "[%s] IRC error: %s", LINK(server)->name,
|
||||||
|
irc_line_to_string(line));
|
||||||
|
return OK_COPY;
|
||||||
|
}
|
||||||
|
|
||||||
static int irc_join(struct link_server *server, struct line *line)
|
static int irc_join(struct link_server *server, struct line *line)
|
||||||
{
|
{
|
||||||
char *s_nick;
|
char *s_nick;
|
||||||
|
@ -143,6 +143,12 @@ void irc_line_drop(struct line *line, int elem)
|
|||||||
bip_cfree(array_drop(&line->words, elem));
|
bip_cfree(array_drop(&line->words, elem));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int irc_line_is_error(struct line *line)
|
||||||
|
{
|
||||||
|
const char *irc_code = irc_line_elem(line, 0);
|
||||||
|
return (irc_code[0] == '4');
|
||||||
|
}
|
||||||
|
|
||||||
int irc_line_elem_equals(struct line *line, int elem, const char *cmp)
|
int irc_line_elem_equals(struct line *line, int elem, const char *cmp)
|
||||||
{
|
{
|
||||||
return !strcmp(irc_line_elem(line, elem), cmp);
|
return !strcmp(irc_line_elem(line, elem), cmp);
|
||||||
|
@ -98,6 +98,7 @@ int irc_line_includes(struct line *line, int elem);
|
|||||||
const char *irc_line_elem(struct line *line, int elem);
|
const char *irc_line_elem(struct line *line, int elem);
|
||||||
int irc_line_count(struct line *line);
|
int irc_line_count(struct line *line);
|
||||||
char *irc_line_pop(struct line *l);
|
char *irc_line_pop(struct line *l);
|
||||||
|
int irc_line_is_error(struct line *line);
|
||||||
int irc_line_elem_equals(struct line *line, int elem, const char *cmp);
|
int irc_line_elem_equals(struct line *line, int elem, const char *cmp);
|
||||||
int irc_line_elem_case_equals(struct line *line, int elem, const char *cmp);
|
int irc_line_elem_case_equals(struct line *line, int elem, const char *cmp);
|
||||||
void irc_line_drop(struct line *line, int elem);
|
void irc_line_drop(struct line *line, int elem);
|
||||||
|
Loading…
Reference in New Issue
Block a user