diff options
| -rw-r--r-- | crypting.c | 14 | ||||
| -rw-r--r-- | crypting.h | 3 | ||||
| -rw-r--r-- | irc.c | 7 | ||||
| -rw-r--r-- | nick.c | 21 | ||||
| -rw-r--r-- | nick.h | 12 | ||||
| -rw-r--r-- | protocols/proxy.c | 22 | ||||
| -rw-r--r-- | protocols/proxy.h | 2 | 
7 files changed, 31 insertions, 50 deletions
@@ -45,9 +45,6 @@ typedef struct irc  	char *password;  } irc_t; -#define set_add( a, b, c, d ) -#define set_find( a, b ) NULL -  #include "md5.h"  #include "crypting.h"  #include <string.h> @@ -68,9 +65,6 @@ typedef struct irc     Sets pass without checking */  void setpassnc (irc_t *irc, const char *pass)   { -	if (!set_find (irc, "password")) -		set_add (irc, "password", NULL, passchange); -	  	if (irc->password) g_free (irc->password);  	if (pass) { @@ -81,12 +75,8 @@ void setpassnc (irc_t *irc, const char *pass)  	}  } -char *passchange (irc_t *irc, void *set, char *value) { -	setpassnc (irc, value); -	return (NULL); -} - -int setpass (irc_t *irc, const char *pass, char* md5sum) { +int setpass (irc_t *irc, const char *pass, const char* md5sum)  +{  	md5_state_t md5state;  	md5_byte_t digest[16];  	int i, j; @@ -24,8 +24,7 @@  */  void setpassnc (irc_t *irc, const char *pass); /* USE WITH CAUTION! */ -char *passchange (irc_t *irc, void *set, char *value); -int setpass (irc_t *irc, const char *pass, char* md5sum); +int setpass (irc_t *irc, const char *pass, const char* md5sum);  char *hashpass (irc_t *irc);  char *obfucrypt (irc_t *irc, char *line);  char *deobfucrypt (irc_t *irc, char *line); @@ -31,6 +31,12 @@ static gboolean irc_userping( gpointer _irc );  GSList *irc_connection_list = NULL; +char *passchange (irc_t *irc, void *set, char *value)  +{ +	setpassnc (irc, value); +	return (NULL); +} +  irc_t *irc_new( int fd )  {  	irc_t *irc = g_new0( irc_t, 1 ); @@ -128,6 +134,7 @@ irc_t *irc_new( int fd )  	set_add( irc, "strip_html", "true", NULL );  	set_add( irc, "to_char", ": ", set_eval_to_char );  	set_add( irc, "typing_notice", "false", set_eval_bool ); +	set_add( irc, "password", NULL, passchange);  	conf_loaddefaults( irc ); @@ -26,7 +26,7 @@  #define BITLBEE_CORE  #include "bitlbee.h" -void nick_set( irc_t *irc, char *handle, int proto, char *nick ) +void nick_set( irc_t *irc, const char *handle, int proto, const char *nick )  {  	nick_t *m = NULL, *n = irc->nicks; @@ -55,7 +55,7 @@ void nick_set( irc_t *irc, char *handle, int proto, char *nick )  	nick_strip( n->nick );  } -char *nick_get( irc_t *irc, char *handle, int proto, const char *realname ) +char *nick_get( irc_t *irc, const char *handle, int proto, const char *realname )  {  	static char nick[MAX_NICK_LENGTH+1];  	nick_t *n = irc->nicks; @@ -128,7 +128,7 @@ char *nick_get( irc_t *irc, char *handle, int proto, const char *realname )  	return( nick );  } -void nick_del( irc_t *irc, char *nick ) +void nick_del( irc_t *irc, const char *nick )  {  	nick_t *l = NULL, *n = irc->nicks; @@ -175,9 +175,9 @@ void nick_strip( char * nick )  		nick[j++] = '\0';  } -int nick_ok( char *nick ) +int nick_ok( const char *nick )  { -	char *s; +	const char *s;  	/* Empty/long nicks are not allowed */  	if( !*nick || strlen( nick ) > MAX_NICK_LENGTH ) @@ -236,7 +236,7 @@ int nick_uc( char *nick )  	return( 1 );  } -int nick_cmp( char *a, char *b ) +int nick_cmp( const char *a, const char *b )  {  	char aa[1024] = "", bb[1024] = ""; @@ -252,12 +252,7 @@ int nick_cmp( char *a, char *b )  	}  } -char *nick_dup( char *nick ) +char *nick_dup( const char *nick )  { -	char *cp; -	 -	cp = g_new0 ( char, MAX_NICK_LENGTH + 1 ); -	strncpy( cp, nick, MAX_NICK_LENGTH ); -	 -	return( cp ); +	return g_strndup( nick, MAX_NICK_LENGTH );  } @@ -31,13 +31,13 @@ typedef struct __NICK  	struct __NICK *next;  } nick_t; -void nick_set( irc_t *irc, char *handle, int proto, char *nick ); -char *nick_get( irc_t *irc, char *handle, int proto, const char *realname ); -void nick_del( irc_t *irc, char *nick ); +void nick_set( irc_t *irc, const char *handle, int proto, const char *nick ); +char *nick_get( irc_t *irc, const char *handle, int proto, const char *realname ); +void nick_del( irc_t *irc, const char *nick );  void nick_strip( char *nick ); -int nick_ok( char *nick ); +int nick_ok( const char *nick );  int nick_lc( char *nick );  int nick_uc( char *nick ); -int nick_cmp( char *a, char *b ); -char *nick_dup( char *nick ); +int nick_cmp( const char *a, const char *b ); +char *nick_dup( const char *nick ); diff --git a/protocols/proxy.c b/protocols/proxy.c index fb87e356..0546f2d7 100644 --- a/protocols/proxy.c +++ b/protocols/proxy.c @@ -49,16 +49,6 @@  #define GAIM_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL)  #define GAIM_ERR_COND   (G_IO_HUP | G_IO_ERR | G_IO_NVAL) -/*FIXME*		 -	#ifndef _WIN32 -		if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { -			closesocket(fd); -			g_free(phb); -			return -1; -		} -		fcntl(fd, F_SETFL, 0); -#endif*/ -  char proxyhost[128] = "";  int proxyport = 0;  int proxytype = PROXY_NONE; @@ -82,7 +72,7 @@ typedef struct _GaimIOClosure { -static struct sockaddr_in *gaim_gethostbyname(char *host, int port) +static struct sockaddr_in *gaim_gethostbyname(const char *host, int port)  {  	static struct sockaddr_in sin; @@ -153,7 +143,7 @@ static void gaim_io_connected(gpointer data, gint source, GaimInputCondition con  	}  } -static int proxy_connect_none(char *host, unsigned short port, struct PHB *phb) +static int proxy_connect_none(const char *host, unsigned short port, struct PHB *phb)  {  	struct sockaddr_in *sin;  	int fd = -1; @@ -280,7 +270,7 @@ static void http_canwrite(gpointer data, gint source, GaimInputCondition cond)  	phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, http_canread, phb);  } -static int proxy_connect_http(char *host, unsigned short port, struct PHB *phb) +static int proxy_connect_http(const char *host, unsigned short port, struct PHB *phb)  {  	phb->host = g_strdup(host);  	phb->port = port; @@ -364,7 +354,7 @@ static void s4_canwrite(gpointer data, gint source, GaimInputCondition cond)  	phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s4_canread, phb);  } -static int proxy_connect_socks4(char *host, unsigned short port, struct PHB *phb) +static int proxy_connect_socks4(const char *host, unsigned short port, struct PHB *phb)  {  	phb->host = g_strdup(host);  	phb->port = port; @@ -546,7 +536,7 @@ static void s5_canwrite(gpointer data, gint source, GaimInputCondition cond)  	phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s5_canread, phb);  } -static int proxy_connect_socks5(char *host, unsigned short port, struct PHB *phb) +static int proxy_connect_socks5(const char *host, unsigned short port, struct PHB *phb)  {  	phb->host = g_strdup(host);  	phb->port = port; @@ -587,7 +577,7 @@ void gaim_input_remove(gint tag)  		g_source_remove(tag);  } -int proxy_connect(char *host, int port, GaimInputFunction func, gpointer data) +int proxy_connect(const char *host, int port, GaimInputFunction func, gpointer data)  {  	struct PHB *phb; diff --git a/protocols/proxy.h b/protocols/proxy.h index 7c34fc40..47c966d2 100644 --- a/protocols/proxy.h +++ b/protocols/proxy.h @@ -55,6 +55,6 @@ typedef void (*GaimInputFunction)(gpointer, gint, GaimInputCondition);  G_MODULE_EXPORT gint gaim_input_add(int, GaimInputCondition, GaimInputFunction, gpointer);  G_MODULE_EXPORT void gaim_input_remove(gint); -G_MODULE_EXPORT int proxy_connect(char *host, int port, GaimInputFunction func, gpointer data); +G_MODULE_EXPORT int proxy_connect(const char *host, int port, GaimInputFunction func, gpointer data);  #endif /* _PROXY_H_ */  | 
