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->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, 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; c->away_nick = t->pdata;
break; break;
case LEX_ON_CONNECT_SEND: case LEX_ON_CONNECT_SEND:
list_add(&c->on_connect_send, t->pdata); list_add_last(&c->on_connect_send, t->pdata);
break; break;
default: default:
conf_die("unknown keyword in connection statement"); conf_die("unknown keyword in connection statement");
@ -791,7 +793,6 @@ void ircize(list_t *ll)
} \ } \
} while(0); } while(0);
MAYFREE(link->away_nick); MAYFREE(link->away_nick);
MAYFREE(link->no_client_away_msg);
MAYFREE(link->password); MAYFREE(link->password);
MAYFREE(link->user); MAYFREE(link->user);
MAYFREE(link->real_name); MAYFREE(link->real_name);
@ -814,17 +815,17 @@ void ircize(list_t *ll)
link->follow_nick = c->follow_nick; link->follow_nick = c->follow_nick;
link->ignore_first_nick = c->ignore_first_nick; link->ignore_first_nick = c->ignore_first_nick;
/* XXX vider laliste on_connect_send */
list_iterator_t ocsit; 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_item(&ocsit);
list_it_next(&ocsit)) { list_it_next(&ocsit)) {
free(list_it_item(&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, list_append(&link->on_connect_send,
&c->on_connect_send); &c->on_connect_send);
link->away_nick = strmaydup(c->away_nick); link->away_nick = strmaydup(c->away_nick);
link->no_client_away_msg = link->no_client_away_msg =
strmaydup(c->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) void adm_on_connect_send(struct link_client *ic, char *val)
{ {
struct link *link = LINK(ic); struct link *link = LINK(ic);
if (link->on_connect_send) { char *s;
free(link->on_connect_send);
link->on_connect_send = NULL;
}
if (val != NULL) 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) 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, /* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
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 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 it under the terms of the GNU General Public License as published by
@ -18,10 +20,18 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */ Boston, MA 02110-1301, USA. */
/* As a special exception, when this file is copied by Bison into a /* As a special exception, you may create a larger work that contains
Bison output file, you may use that output file without restriction. part or all of the Bison parser skeleton and distribute that work
This special exception was added by the Free Software Foundation under terms of your choice, so long as that work isn't itself a
in version 1.24 of Bison. */ 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. */ /* Tokens. */
#ifndef YYTOKENTYPE #ifndef YYTOKENTYPE
@ -75,9 +85,10 @@
LEX_DEFAULT_USER = 301, LEX_DEFAULT_USER = 301,
LEX_DEFAULT_NICK = 302, LEX_DEFAULT_NICK = 302,
LEX_DEFAULT_REALNAME = 303, LEX_DEFAULT_REALNAME = 303,
LEX_BOOL = 304, LEX_NO_CLIENT_AWAY_MSG = 304,
LEX_INT = 305, LEX_BOOL = 305,
LEX_STRING = 306 LEX_INT = 306,
LEX_STRING = 307
}; };
#endif #endif
/* Tokens. */ /* Tokens. */
@ -127,23 +138,26 @@
#define LEX_DEFAULT_USER 301 #define LEX_DEFAULT_USER 301
#define LEX_DEFAULT_NICK 302 #define LEX_DEFAULT_NICK 302
#define LEX_DEFAULT_REALNAME 303 #define LEX_DEFAULT_REALNAME 303
#define LEX_BOOL 304 #define LEX_NO_CLIENT_AWAY_MSG 304
#define LEX_INT 305 #define LEX_BOOL 305
#define LEX_STRING 306 #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" #line 85 "conf.y"
typedef union YYSTYPE { {
int number; int number;
char *string; char *string;
void *list; void *list;
struct tuple *tuple; struct tuple *tuple;
} YYSTYPE; }
/* Line 1447 of yacc.c. */ /* Line 1529 of yacc.c. */
#line 147 "y.tab.h" #line 160 "conf.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
@ -151,5 +165,3 @@ typedef union YYSTYPE {
extern YYSTYPE yylval; extern YYSTYPE yylval;

View File

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

View File

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

View File

@ -16,6 +16,16 @@
#include "connection.h" #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) \ #define WRITE_LINE1(con, org, com, a) \
do { \ do { \
struct line l; \ struct line l; \

View File

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