diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2006-01-14 21:34:10 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2006-01-14 21:34:10 +0100 |
commit | 9d6b229674144d2a48348aeb120604164f371904 (patch) | |
tree | 1af39b40c8ecab8fff7b909452d3303ef6d472c0 | |
parent | 5c577bd5e2ee33dbe7389df6f4baf659c34de365 (diff) | |
parent | 277674c82d3dbcb355214cbaceb34599832e1261 (diff) |
Imported changes from main tree.
-rw-r--r-- | bitlbee.c | 24 | ||||
-rwxr-xr-x | configure | 9 | ||||
-rw-r--r-- | irc.c | 15 | ||||
-rw-r--r-- | irc.h | 7 | ||||
-rw-r--r-- | protocols/yahoo/Makefile | 2 | ||||
-rw-r--r-- | protocols/yahoo/yahoo_list.c | 236 | ||||
-rw-r--r-- | protocols/yahoo/yahoo_list.h | 68 | ||||
-rw-r--r-- | util.c | 4 |
8 files changed, 25 insertions, 340 deletions
@@ -193,32 +193,12 @@ gboolean bitlbee_io_current_client_write( GIOChannel *source, GIOCondition condi irc_t *irc = data; int st, size; char *temp; -#ifdef FLOOD_SEND - time_t newtime; -#endif -#ifdef FLOOD_SEND - newtime = time( NULL ); - if( ( newtime - irc->oldtime ) > FLOOD_SEND_INTERVAL ) - { - irc->sentbytes = 0; - irc->oldtime = newtime; - } -#endif - if( irc->sendbuffer == NULL ) return( FALSE ); size = strlen( irc->sendbuffer ); - -#ifdef FLOOD_SEND - if( ( FLOOD_SEND_BYTES - irc->sentbytes ) > size ) - st = write( irc->fd, irc->sendbuffer, size ); - else - st = write( irc->fd, irc->sendbuffer, ( FLOOD_SEND_BYTES - irc->sentbytes ) ); -#else st = write( irc->fd, irc->sendbuffer, size ); -#endif if( st <= 0 ) { @@ -233,10 +213,6 @@ gboolean bitlbee_io_current_client_write( GIOChannel *source, GIOCondition condi } } -#ifdef FLOOD_SEND - irc->sentbytes += st; -#endif - if( st == size ) { g_free( irc->sendbuffer ); @@ -22,7 +22,6 @@ yahoo=1 debug=0 strip=1 -flood=0 ipv6=1 ssl=auto @@ -288,14 +287,6 @@ else fi; fi -if [ "$flood" = 1 ]; then - # echo '#define FLOOD_SEND' >> config.h - echo 'Flood protection is disabled in this release because of too many bugs.' 2> /dev/stderr - rm config.h - rm Makefile.settings - exit 1 -fi - echo if [ -z "$BITLBEE_VERSION" -a -d .bzr -a -x "`which bzr`" ]; then rev=`bzr revno` @@ -944,21 +944,6 @@ void irc_vawrite( irc_t *irc, char *format, va_list params ) if( irc->sendbuffer != NULL ) { size = strlen( irc->sendbuffer ) + strlen( line ); -#ifdef FLOOD_SEND - if( size > FLOOD_SEND_MAXBUFFER ) { - /* Die flooder, die! >:) */ - - g_free(irc->sendbuffer); - - /* We need the \r\n at the start because else we might append our string to a half - * sent line. A bit hackish, but it works. - */ - irc->sendbuffer = g_strdup( "\r\nERROR :Sendq Exceeded\r\n" ); - irc->quit = 1; - - return; - } -#endif irc->sendbuffer = g_renew ( char, irc->sendbuffer, size + 1 ); strcpy( ( irc->sendbuffer + strlen( irc->sendbuffer ) ), line ); } @@ -32,13 +32,6 @@ #define IRC_LOGIN_TIMEOUT 60 #define IRC_PING_STRING "PinglBee" -/* #define FLOOD_SEND - * Not yet enabled by default due to some problems. - */ -#define FLOOD_SEND_INTERVAL 30 -#define FLOOD_SEND_BYTES (1024*10) -#define FLOOD_SEND_MAXBUFFER (1024*20) - #define UMODES "ias" #define UMODES_PRIV "Ro" #define CMODES "nt" diff --git a/protocols/yahoo/Makefile b/protocols/yahoo/Makefile index e594cc1f..b4014f8a 100644 --- a/protocols/yahoo/Makefile +++ b/protocols/yahoo/Makefile @@ -9,7 +9,7 @@ -include ../../Makefile.settings # [SH] Program variables -objects = yahoo.o crypt.o libyahoo2.o yahoo_fn.o yahoo_httplib.o yahoo_list.o yahoo_util.o +objects = yahoo.o crypt.o libyahoo2.o yahoo_fn.o yahoo_httplib.o yahoo_util.o CFLAGS += -Wall -DSTDC_HEADERS -DHAVE_STRING_H -DHAVE_STRCHR -DHAVE_MEMCPY -DHAVE_GLIB LFLAGS += -r diff --git a/protocols/yahoo/yahoo_list.c b/protocols/yahoo/yahoo_list.c deleted file mode 100644 index cda631c6..00000000 --- a/protocols/yahoo/yahoo_list.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * yahoo_list.c: linked list routines - * - * Some code copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net> - * Other code copyright Meredydd Luff <meredydd AT everybuddy.com> - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Some of this code was borrowed from elist.c in the eb-lite sources - * - */ - -#include <stdlib.h> - -#include "yahoo_list.h" - -YList *y_list_append(YList * list, void *data) -{ - YList *n; - YList *new_list = malloc(sizeof(YList)); - YList *attach_to = NULL; - - new_list->next = NULL; - new_list->data = data; - - for (n = list; n != NULL; n = n->next) { - attach_to = n; - } - - if (attach_to == NULL) { - new_list->prev = NULL; - return new_list; - } else { - new_list->prev = attach_to; - attach_to->next = new_list; - return list; - } -} - -YList *y_list_prepend(YList * list, void *data) -{ - YList *n = malloc(sizeof(YList)); - - n->next = list; - n->prev = NULL; - n->data = data; - if (list) - list->prev = n; - - return n; -} - -YList *y_list_concat(YList * list, YList * add) -{ - YList *l; - - if(!list) - return add; - - if(!add) - return list; - - for (l = list; l->next; l = l->next) - ; - - l->next = add; - add->prev = l; - - return list; -} - -YList *y_list_remove(YList * list, void *data) -{ - YList *n; - - for (n = list; n != NULL; n = n->next) { - if (n->data == data) { - list=y_list_remove_link(list, n); - y_list_free_1(n); - break; - } - } - - return list; -} - -/* Warning */ -/* link MUST be part of list */ -/* caller must free link using y_list_free_1 */ -YList *y_list_remove_link(YList * list, const YList * link) -{ - if (!link) - return list; - - if (link->next) - link->next->prev = link->prev; - if (link->prev) - link->prev->next = link->next; - - if (link == list) - list = link->next; - - return list; -} - -int y_list_length(const YList * list) -{ - int retval = 0; - const YList *n = list; - - for (n = list; n != NULL; n = n->next) { - retval++; - } - - return retval; -} - -/* well, you could just check for list == NULL, but that would be - * implementation dependent - */ -int y_list_empty(const YList * list) -{ - if(!list) - return 1; - else - return 0; -} - -int y_list_singleton(const YList * list) -{ - if(!list || list->next) - return 0; - return 1; -} - -YList *y_list_copy(YList * list) -{ - YList *n; - YList *copy = NULL; - - for (n = list; n != NULL; n = n->next) { - copy = y_list_append(copy, n->data); - } - - return copy; -} - -void y_list_free_1(YList * list) -{ - free(list); -} - -void y_list_free(YList * list) -{ - YList *n = list; - - while (n != NULL) { - YList *next = n->next; - free(n); - n = next; - } -} - -YList *y_list_find(YList * list, const void *data) -{ - YList *l; - for (l = list; l && l->data != data; l = l->next) - ; - - return l; -} - -void y_list_foreach(YList * list, YListFunc fn, void * user_data) -{ - for (; list; list = list->next) - fn(list->data, user_data); -} - -YList *y_list_find_custom(YList * list, const void *data, YListCompFunc comp) -{ - YList *l; - for (l = list; l; l = l->next) - if (comp(l->data, data) == 0) - return l; - - return NULL; -} - -YList *y_list_nth(YList * list, int n) -{ - int i=n; - for ( ; list && i; list = list->next, i--) - ; - - return list; -} - -YList *y_list_insert_sorted(YList * list, void *data, YListCompFunc comp) -{ - YList *l, *n, *prev = NULL; - if (!list) - return y_list_append(list, data); - - n = malloc(sizeof(YList)); - n->data = data; - for (l = list; l && comp(l->data, n->data) <= 0; l = l->next) - prev = l; - - if (l) { - n->prev = l->prev; - l->prev = n; - } else - n->prev = prev; - - n->next = l; - - if(n->prev) { - n->prev->next = n; - return list; - } else { - return n; - } - -} diff --git a/protocols/yahoo/yahoo_list.h b/protocols/yahoo/yahoo_list.h index a7a69635..0d335acd 100644 --- a/protocols/yahoo/yahoo_list.h +++ b/protocols/yahoo/yahoo_list.h @@ -20,55 +20,29 @@ * */ -/* - * This is a replacement for the GList. It only provides functions that - * we use in Ayttm. Thanks to Meredyyd from everybuddy dev for doing - * most of it. - */ - #ifndef __YLIST_H__ #define __YLIST_H__ -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _YList { - struct _YList *next; - struct _YList *prev; - void *data; -} YList; - -typedef int (*YListCompFunc) (const void *, const void *); -typedef void (*YListFunc) (void *, void *); - -YList *y_list_append(YList * list, void *data); -YList *y_list_prepend(YList * list, void *data); -YList *y_list_remove_link(YList * list, const YList * link); -YList *y_list_remove(YList * list, void *data); - -YList *y_list_insert_sorted(YList * list, void * data, YListCompFunc comp); +/* GLib has linked list already, so I don't see why libyahoo2 has to copy this... */ + +typedef GList YList; + +#define y_list_append g_list_append +#define y_list_concat g_list_concat +#define y_list_copy g_list_copy +#define y_list_empty g_list_empty +#define y_list_find g_list_find +#define y_list_find_custom g_list_find_custom +#define y_list_foreach g_list_foreach +#define y_list_free g_list_free +#define y_list_free_1 g_list_free_1 +#define y_list_insert_sorted g_list_insert_sorted +#define y_list_length g_list_length +#define y_list_next g_list_next +#define y_list_nth g_list_nth +#define y_list_prepend g_list_prepend +#define y_list_remove g_list_remove +#define y_list_remove_link g_list_remove_link +#define y_list_singleton g_list_singleton -YList *y_list_copy(YList * list); - -YList *y_list_concat(YList * list, YList * add); - -YList *y_list_find(YList * list, const void *data); -YList *y_list_find_custom(YList * list, const void *data, YListCompFunc comp); - -YList *y_list_nth(YList * list, int n); - -void y_list_foreach(YList * list, YListFunc fn, void *user_data); - -void y_list_free_1(YList * list); -void y_list_free(YList * list); -int y_list_length(const YList * list); -int y_list_empty(const YList * list); -int y_list_singleton(const YList * list); - -#define y_list_next(list) list->next - -#ifdef __cplusplus -} -#endif #endif @@ -35,6 +35,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <ctype.h> #include <glib.h> #include <time.h> @@ -376,7 +377,8 @@ void http_encode( char *s ) for( i = j = 0; t[i]; i ++, j ++ ) { - if( t[i] <= ' ' || ((unsigned char *)t)[i] >= 128 || t[i] == '%' ) + /* if( t[i] <= ' ' || ((unsigned char *)t)[i] >= 128 || t[i] == '%' ) */ + if( !isalnum( t[i] ) ) { sprintf( s + j, "%%%02X", ((unsigned char*)t)[i] ); j += 2; |