Debug away msg when no client on.

This commit is contained in:
nohar 2006-09-25 12:08:31 +00:00
parent c13c58157b
commit 38f84edc01
5 changed files with 25 additions and 29 deletions

View File

@ -1,3 +1,7 @@
2006-09-25 Arnaud Cornet <arnaud.cornet@gmail.com>
* *: Debug no_client_away_msg.
2006-09-23 Arnaud Cornet <arnaud.cornet@gmail.com>
* src/irc.c: Untested oidentd IPV6 support.
@ -6,7 +10,7 @@
* src/bip.c: umask for better permissions when using in system mode.
* src/irc.c: added no_client_away_msg configuration directive and
code.
code as well as support for multiple on_connect_send.
2006-07-02 Arnaud Cornet <arnaud.cornet@gmail.com>

8
TODO
View File

@ -1,5 +1,4 @@
- uid, gid
- multiple on_connect_send
- keep invites when detached ?
- allow global (or per net ?) IP filtering
- more /bip commands
@ -23,10 +22,3 @@ Thanks a lot for your help.
Best regards,
Whoopie
--
Donner des droits plus méchants au log global
DONE:
11:23 < KiBi> Un /away truc chose automatique quand plus aucun client n'est
attaché.
- in english: automatic command when no more client is connected

View File

@ -395,6 +395,8 @@ void c_connection_free(struct c_connection *c)
}
free(c->away_nick);
free(c->no_client_away_msg);
char *s;
while ((s = list_remove_first(&c->on_connect_send)))
free(s);
@ -457,8 +459,10 @@ static int add_connection(list_t *connectionl, list_t *data,
case LEX_AWAY_NICK:
c->away_nick = t->pdata;
break;
case LEX_NO_CLIENT_AWAY_MSG:
c->no_client_away_msg = t->pdata;
break;
case LEX_ON_CONNECT_SEND:
printf("lex: %s\n", t->pdata);
list_add_last(&c->on_connect_send, t->pdata);
break;
default:
@ -816,13 +820,6 @@ void ircize(list_t *ll)
link->follow_nick = c->follow_nick;
link->ignore_first_nick = c->ignore_first_nick;
list_iterator_t ocsit;
for (list_it_init(&c->on_connect_send, &ocsit);
list_it_item(&ocsit);
list_it_next(&ocsit)) {
printf("yo:%s\n", list_it_item(&ocsit));
}
char *s;
while ((s = list_remove_first(
&link->on_connect_send))) {
@ -831,12 +828,6 @@ void ircize(list_t *ll)
list_append(&c->on_connect_send,
&link->on_connect_send);
for (list_it_init(&link->on_connect_send, &ocsit);
list_it_item(&ocsit);
list_it_next(&ocsit)) {
printf("fin:%s\n", (char *)list_it_item(&ocsit));
}
link->away_nick = strmaydup(c->away_nick);
link->no_client_away_msg =
@ -1063,7 +1054,7 @@ int ssl_check_trust(struct link_client *ic)
if(!LINK(ic)->untrusted_certs ||
sk_X509_num(LINK(ic)->untrusted_certs) <= 0)
return 0;
trustcert = sk_X509_value(LINK(ic)->untrusted_certs, 0);
strcpy(subject, "Subject: ");
strcpy(issuer, "Issuer: ");

View File

@ -187,6 +187,8 @@ con_command:
LEX_CHANNEL, $3); }
| LEX_ON_CONNECT_SEND LEX_EQ LEX_STRING { $$ = tuple_s_new(
LEX_ON_CONNECT_SEND, $3); }
| LEX_NO_CLIENT_AWAY_MSG LEX_EQ LEX_STRING { $$ = tuple_s_new(
LEX_NO_CLIENT_AWAY_MSG, $3); }
channel:
{ $$ = list_new(NULL); }
| channel cha_command LEX_SEMICOLON { list_add_last($1, $2); $$ = $1; }

View File

@ -321,10 +321,19 @@ static void irc_server_connected(struct link_server *server)
list_it_item(&itocs); list_it_next(&itocs)) {
ssize_t len = strlen(list_it_item(&itocs)) + 2;
char *str = malloc(len + 1);
sprintf(str, "%s\r\n", list_it_item(&itocs));
sprintf(str, "%s\r\n", (char *)list_it_item(&itocs));
write_line(CONN(server), str);
free(str);
}
if (LINK(server)->l_clientc == 0) {
if (LINK(server)->away_nick)
WRITE_LINE1(CONN(server), NULL, "NICK",
LINK(server)->away_nick);
if (LINK(server)->no_client_away_msg)
WRITE_LINE1(CONN(server), NULL, "AWAY",
LINK(server)->no_client_away_msg);
}
}
static int who_arg_to_ovmask(char *str)
@ -829,10 +838,8 @@ static int irc_cli_startup(struct link_client *ic, struct line *line,
LINK(server)->connect_nick);
/* change away status */
if (LINK(ic)->l_clientc == 0) {
if (server && LINK(ic)->no_client_away_msg)
WRITE_LINE0(CONN(server), NULL, "AWAY");
}
if (server && LINK(ic)->no_client_away_msg)
WRITE_LINE0(CONN(server), NULL, "AWAY");
}
free(initmask);