Now it even build

This commit is contained in:
nohar 2006-09-18 18:05:17 +00:00
parent 925bee51c8
commit e3410afe93
6 changed files with 63 additions and 39 deletions

View File

@ -395,7 +395,9 @@ void c_connection_free(struct c_connection *c)
}
free(c->away_nick);
free(c->on_connect_send);
char *s;
while ((s = list_remove_first(&c->on_connect_send)))
free(s);
}
static int add_connection(list_t *connectionl, list_t *data,
@ -456,7 +458,7 @@ static int add_connection(list_t *connectionl, list_t *data,
c->away_nick = t->pdata;
break;
case LEX_ON_CONNECT_SEND:
list_add(&c->on_connect_send, t->pdata);
list_add_last(&c->on_connect_send, t->pdata);
break;
default:
conf_die("unknown keyword in connection statement");
@ -791,7 +793,6 @@ void ircize(list_t *ll)
} \
} while(0);
MAYFREE(link->away_nick);
MAYFREE(link->no_client_away_msg);
MAYFREE(link->password);
MAYFREE(link->user);
MAYFREE(link->real_name);
@ -814,17 +815,17 @@ void ircize(list_t *ll)
link->follow_nick = c->follow_nick;
link->ignore_first_nick = c->ignore_first_nick;
/* XXX vider laliste on_connect_send */
list_iterator_t ocsit;
for (list_it_init(&c->channell, &ocsit);
for (list_it_init(&c->on_connect_send, &ocsit);
list_it_item(&ocsit);
list_it_next(&ocsit)) {
free(list_it_item(&ocsit));
}
list_init(&link->on_connect_send);
list_init(&link->on_connect_send, NULL);
list_append(&link->on_connect_send,
&c->on_connect_send);
link->away_nick = strmaydup(c->away_nick);
link->no_client_away_msg =
strmaydup(c->no_client_away_msg);
@ -1197,12 +1198,15 @@ void adm_ignore_first_nick(struct link_client *ic, char *val)
void adm_on_connect_send(struct link_client *ic, char *val)
{
struct link *link = LINK(ic);
if (link->on_connect_send) {
free(link->on_connect_send);
link->on_connect_send = NULL;
}
char *s;
if (val != NULL)
link->on_connect_send = strdup(val);
list_add_last(&link->on_connect_send, strdup(val));
else {
s = list_remove_last(&link->on_connect_send);
if (s)
free(s);
}
}
void adm_away_nick(struct link_client *ic, char *val)

View File

@ -1,7 +1,9 @@
/* A Bison parser, made by GNU Bison 2.1. */
/* A Bison parser, made by GNU Bison 2.3. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
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
@ -18,10 +20,18 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
@ -75,9 +85,10 @@
LEX_DEFAULT_USER = 301,
LEX_DEFAULT_NICK = 302,
LEX_DEFAULT_REALNAME = 303,
LEX_BOOL = 304,
LEX_INT = 305,
LEX_STRING = 306
LEX_NO_CLIENT_AWAY_MSG = 304,
LEX_BOOL = 305,
LEX_INT = 306,
LEX_STRING = 307
};
#endif
/* Tokens. */
@ -127,23 +138,26 @@
#define LEX_DEFAULT_USER 301
#define LEX_DEFAULT_NICK 302
#define LEX_DEFAULT_REALNAME 303
#define LEX_BOOL 304
#define LEX_INT 305
#define LEX_STRING 306
#define LEX_NO_CLIENT_AWAY_MSG 304
#define LEX_BOOL 305
#define LEX_INT 306
#define LEX_STRING 307
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 85 "conf.y"
typedef union YYSTYPE {
{
int number;
char *string;
void *list;
struct tuple *tuple;
} YYSTYPE;
/* Line 1447 of yacc.c. */
#line 147 "y.tab.h"
}
/* Line 1529 of yacc.c. */
#line 160 "conf.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
@ -151,5 +165,3 @@ typedef union YYSTYPE {
extern YYSTYPE yylval;

View File

@ -316,10 +316,12 @@ static void irc_server_connected(struct link_server *server)
free(initmask);
/* basic helper for nickserv and co */
if (LINK(server)->on_connect_send) {
ssize_t len = strlen(LINK(server)->on_connect_send) + 2;
list_iterator_t itocs;
for (list_it_init(&LINK(server)->on_connect_send, &itocs);
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", LINK(server)->on_connect_send);
sprintf(str, "%s\r\n", list_it_item(&itocs));
write_line(CONN(server), str);
free(str);
}

View File

@ -91,6 +91,7 @@ struct link {
int follow_nick;
int ignore_first_nick;
list_t on_connect_send;
char *no_client_away_msg;
char *away_nick;
hash_t chan_infos; /* channels we want */
list_t chan_infos_order; /* for order only */

View File

@ -16,6 +16,16 @@
#include "connection.h"
#define WRITE_LINE0(con, org, com) \
do { \
struct line l; \
irc_line_init(&l); \
l.origin = org; \
_irc_line_append(&l, com); \
irc_line_write(&l, con); \
free(l.elemv); \
} while(0)
#define WRITE_LINE1(con, org, com, a) \
do { \
struct line l; \

View File

@ -262,11 +262,6 @@ void *list_remove_last(list_t *list)
return ptr;
}
static void *__list_ptr_cpy(void *a)
{
return a;
}
/*
static void *list_remove_item(list_t *l, struct list_item *li)
{