diff options
| -rwxr-xr-x | configure | 6 | ||||
| -rw-r--r-- | ipc.h | 4 | ||||
| -rw-r--r-- | irc.c | 22 | ||||
| -rw-r--r-- | irc.h | 10 | ||||
| -rw-r--r-- | irc_commands.c | 6 | ||||
| -rw-r--r-- | log.h | 2 | ||||
| -rw-r--r-- | protocols/http_client.c | 5 | ||||
| -rw-r--r-- | protocols/nogaim.c | 252 | ||||
| -rw-r--r-- | protocols/nogaim.h | 15 | ||||
| -rw-r--r-- | protocols/oscar/aim.h | 7 | ||||
| -rw-r--r-- | protocols/oscar/chat.c | 16 | ||||
| -rw-r--r-- | protocols/oscar/im.c | 2 | ||||
| -rw-r--r-- | protocols/oscar/oscar.c | 21 | ||||
| -rw-r--r-- | root_commands.c | 16 | ||||
| -rw-r--r-- | user.c | 4 | ||||
| -rw-r--r-- | util.c | 7 | 
16 files changed, 254 insertions, 141 deletions
| @@ -168,24 +168,28 @@ if [ -z "$PKG_CONFIG" ]; then  	PKG_CONFIG=pkg-config  fi +GLIB=0 +  if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then  	cat<<EOF>>Makefile.settings  EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0`  CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0`  EOF  	echo '#define GLIB2' >> config.h +	GLIB=2  elif type glib-config > /dev/null 2> /dev/null; then  	cat<<EOF>>Makefile.settings  EFLAGS+=`glib-config --libs`  CFLAGS+=`glib-config --cflags`  EOF  	echo '#define GLIB1' >> config.h +	GLIB=1  else  	echo 'Cannot find glib development libraries, aborting. (Install libglib-dev?)'  	exit 1;  fi -if [ -r /usr/include/iconv.h ]; then +if [ GLIB = 1 -o -r /usr/include/iconv.h ]; then  	:;  elif [ -r /usr/local/include/iconv.h ]; then  	echo CFLAGS+=-I/usr/local/include >> Makefile.settings @@ -46,9 +46,9 @@ void ipc_master_free_one( struct bitlbee_child *child );  void ipc_master_free_all();  void ipc_to_master( char **cmd ); -void ipc_to_master_str( char *format, ... ); +void ipc_to_master_str( char *format, ... ) G_GNUC_PRINTF( 1, 2 );  void ipc_to_children( char **cmd ); -void ipc_to_children_str( char *format, ... ); +void ipc_to_children_str( char *format, ... ) G_GNUC_PRINTF( 1, 2 );  /* We need this function in inetd mode, so let's just make it non-static. */  void ipc_master_cmd_rehash( irc_t *data, char **cmd ); @@ -831,7 +831,7 @@ void irc_topic( irc_t *irc, char *channel )  		if( c )  			irc_reply( irc, 332, "%s :BitlBee groupchat: \"%s\". Please keep in mind that root-commands won't work here. Have fun!", channel, c->title );  		else -			irc_reply( irc, 331, "%s :No topic for this channel" ); +			irc_reply( irc, 331, "%s :No topic for this channel", channel );  	}  } @@ -887,7 +887,7 @@ void irc_join( irc_t *irc, user_t *u, char *channel )  	nick_lc( nick );  	if( g_hash_table_lookup( irc->watches, nick ) )  	{ -		irc_reply( irc, 600, "%s %s %s %d :%s", u->nick, u->user, u->host, time( NULL ), "logged online" ); +		irc_reply( irc, 600, "%s %s %s %d :%s", u->nick, u->user, u->host, (int) time( NULL ), "logged online" );  	}  	g_free( nick );  } @@ -912,7 +912,7 @@ void irc_kill( irc_t *irc, user_t *u )  	nick_lc( nick );  	if( g_hash_table_lookup( irc->watches, nick ) )  	{ -		irc_reply( irc, 601, "%s %s %s %d :%s", u->nick, u->user, u->host, time( NULL ), "logged offline" ); +		irc_reply( irc, 601, "%s %s %s %d :%s", u->nick, u->user, u->host, (int) time( NULL ), "logged offline" );  	}  	g_free( nick );  } @@ -1012,7 +1012,7 @@ int irc_send( irc_t *irc, char *nick, char *s, int flags )  	}  	else if( c && c->gc && c->gc->prpl )  	{ -		return( serv_send_chat( irc, c->gc, c->id, s ) ); +		return( bim_chat_msg( c->gc, c->id, s ) );  	}  	return( 0 ); @@ -1022,8 +1022,12 @@ static gboolean buddy_send_handler_delayed( gpointer data, gint fd, b_input_cond  {  	user_t *u = data; +	/* Shouldn't happen, but just to be sure. */ +	if( u->sendbuf_len < 2 ) +		return FALSE; +	  	u->sendbuf[u->sendbuf_len-2] = 0; /* Cut off the last newline */ -	serv_send_im( u->gc->irc, u, u->sendbuf, u->sendbuf_flags ); +	bim_buddy_msg( u->gc, u->handle, u->sendbuf, u->sendbuf_flags );  	g_free( u->sendbuf );  	u->sendbuf = NULL; @@ -1044,7 +1048,7 @@ void buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags )  		if( u->sendbuf_len > 0 && u->sendbuf_flags != flags)  		{ -			//Flush the buffer +			/* Flush the buffer */  			b_event_remove( u->sendbuf_timer );  			buddy_send_handler_delayed( u, -1, 0 );  		} @@ -1052,14 +1056,14 @@ void buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags )  		if( u->sendbuf_len == 0 )  		{  			u->sendbuf_len = strlen( msg ) + 2; -			u->sendbuf = g_new (char, u->sendbuf_len ); +			u->sendbuf = g_new( char, u->sendbuf_len );  			u->sendbuf[0] = 0;  			u->sendbuf_flags = flags;  		}  		else  		{  			u->sendbuf_len += strlen( msg ) + 1; -			u->sendbuf = g_renew ( char, u->sendbuf, u->sendbuf_len ); +			u->sendbuf = g_renew( char, u->sendbuf, u->sendbuf_len );  		}  		strcat( u->sendbuf, msg ); @@ -1075,7 +1079,7 @@ void buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags )  	}  	else  	{ -		serv_send_im( irc, u, msg, flags ); +		bim_buddy_msg( u->gc, u->handle, msg, flags );  	}  } @@ -102,7 +102,7 @@ typedef struct irc  extern GSList *irc_connection_list;  irc_t *irc_new( int fd ); -void irc_abort( irc_t *irc, int immed, char *format, ... ); +void irc_abort( irc_t *irc, int immed, char *format, ... ) G_GNUC_PRINTF( 3, 4 );  void irc_free( irc_t *irc );  void irc_exec( irc_t *irc, char **cmd ); @@ -111,10 +111,10 @@ char **irc_parse_line( char *line );  char *irc_build_line( char **cmd );  void irc_vawrite( irc_t *irc, char *format, va_list params ); -void irc_write( irc_t *irc, char *format, ... ); -void irc_write_all( int now, char *format, ... ); -void irc_reply( irc_t *irc, int code, char *format, ... ); -G_MODULE_EXPORT int irc_usermsg( irc_t *irc, char *format, ... ); +void irc_write( irc_t *irc, char *format, ... ) G_GNUC_PRINTF( 2, 3 ); +void irc_write_all( int now, char *format, ... ) G_GNUC_PRINTF( 2, 3 ); +void irc_reply( irc_t *irc, int code, char *format, ... ) G_GNUC_PRINTF( 3, 4 ); +G_MODULE_EXPORT int irc_usermsg( irc_t *irc, char *format, ... ) G_GNUC_PRINTF( 2, 3 );  char **irc_tokenize( char *buffer );  void irc_login( irc_t *irc ); diff --git a/irc_commands.c b/irc_commands.c index 01b01dfb..fe67a534 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -384,9 +384,9 @@ static void irc_cmd_watch( irc_t *irc, char **cmd )  				g_hash_table_insert( irc->watches, nick, nick );  			if( u && u->online ) -				irc_reply( irc, 604, "%s %s %s %d :%s", u->nick, u->user, u->host, time( NULL ), "is online" ); +				irc_reply( irc, 604, "%s %s %s %d :%s", u->nick, u->user, u->host, (int) time( NULL ), "is online" );  			else -				irc_reply( irc, 605, "%s %s %s %d :%s", nick, "*", "*", time( NULL ), "is offline" ); +				irc_reply( irc, 605, "%s %s %s %d :%s", nick, "*", "*", (int) time( NULL ), "is offline" );  		}  		else if( cmd[i][0] == '-' )  		{ @@ -447,7 +447,7 @@ static void irc_cmd_away( irc_t *irc, char **cmd )  		struct gaim_connection *gc = a->gc;  		if( gc && gc->flags & OPT_LOGGED_IN ) -			proto_away( gc, u->away ); +			bim_set_away( gc, u->away );  	}  } @@ -53,7 +53,7 @@ typedef struct log_t {  void log_init(void);  void log_link(int level, int output); -void log_message(int level, char *message, ...); +void log_message(int level, char *message, ...) G_GNUC_PRINTF( 2, 3 );  void log_error(char *functionname);  #endif diff --git a/protocols/http_client.c b/protocols/http_client.c index d686cfb8..1a431e25 100644 --- a/protocols/http_client.c +++ b/protocols/http_client.c @@ -239,6 +239,11 @@ static gboolean http_incoming_data( gpointer data, int source, b_input_condition  	return FALSE;  got_reply: +	/* Maybe if the webserver is overloaded, or when there's bad SSL +	   support... */ +	if( req->bytes_read == 0 ) +		goto cleanup; +	  	/* Zero termination is very convenient. */  	req->reply_headers[req->bytes_read] = 0; diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 4c32cd40..b1975f19 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -35,19 +35,6 @@  #include "nogaim.h"  #include <ctype.h> -static char *proto_away_alias[8][5] = -{ -	{ "Away from computer", "Away", "Extended away", NULL }, -	{ "NA", "N/A", "Not available", NULL }, -	{ "Busy", "Do not disturb", "DND", "Occupied", NULL }, -	{ "Be right back", "BRB", NULL }, -	{ "On the phone", "Phone", "On phone", NULL }, -	{ "Out to lunch", "Lunch", "Food", NULL }, -	{ "Invisible", "Hidden" }, -	{ NULL } -}; -static char *proto_away_alias_find( GList *gcm, char *away ); -  static int remove_chat_buddy_silent( struct conversation *b, char *handle );  GSList *connections; @@ -155,83 +142,6 @@ void nogaim_init()  GSList *get_connections() { return connections; } -int proto_away( struct gaim_connection *gc, char *away ) -{ -	GList *m, *ms; -	char *s; -	 -	if( !away ) away = ""; -	ms = m = gc->prpl->away_states( gc ); -	 -	while( m ) -	{ -		if( *away ) -		{ -			if( g_strncasecmp( m->data, away, strlen( m->data ) ) == 0 ) -				break; -		} -		else -		{ -			if( g_strcasecmp( m->data, "Available" ) == 0 ) -				break; -			if( g_strcasecmp( m->data, "Online" ) == 0 ) -				break; -		} -		m = m->next; -	} -	 -	if( m ) -	{ -		gc->prpl->set_away( gc, m->data, *away ? away : NULL ); -	} -	else -	{ -		s = proto_away_alias_find( ms, away ); -		if( s ) -		{ -			gc->prpl->set_away( gc, s, away ); -			if( set_getint( gc->irc, "debug" ) ) -				serv_got_crap( gc, "Setting away state to %s", s ); -		} -		else -			gc->prpl->set_away( gc, GAIM_AWAY_CUSTOM, away ); -	} -	 -	g_list_free( ms ); -	 -	return( 1 ); -} - -static char *proto_away_alias_find( GList *gcm, char *away ) -{ -	GList *m; -	int i, j; -	 -	for( i = 0; *proto_away_alias[i]; i ++ ) -	{ -		for( j = 0; proto_away_alias[i][j]; j ++ ) -			if( g_strncasecmp( away, proto_away_alias[i][j], strlen( proto_away_alias[i][j] ) ) == 0 ) -				break; -		 -		if( !proto_away_alias[i][j] )	/* If we reach the end, this row */ -			continue;		/* is not what we want. Next!    */ -		 -		/* Now find an entry in this row which exists in gcm */ -		for( j = 0; proto_away_alias[i][j]; j ++ ) -		{ -			m = gcm; -			while( m ) -			{ -				if( g_strcasecmp( proto_away_alias[i][j], m->data ) == 0 ) -					return( proto_away_alias[i][j] ); -				m = m->next; -			} -		} -	} -	 -	return( NULL ); -} -  /* multi.c */  struct gaim_connection *new_gaim_conn( struct aim_user *user ) @@ -356,7 +266,7 @@ void account_online( struct gaim_connection *gc )  	/* Also necessary when we're not away, at least for some of the  	   protocols. */ -	proto_away( gc, u->away ); +	bim_set_away( gc, u->away );  }  gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ) @@ -480,7 +390,14 @@ void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *rea  	}  	else if( gc->user->proto_opt[0] && *gc->user->proto_opt[0] )  	{ -		u->host = g_strdup( gc->user->proto_opt[0] ); +		char *colon; +		 +		if( ( colon = strchr( gc->user->proto_opt[0], ':' ) ) ) +			u->host = g_strndup( gc->user->proto_opt[0], +			                     colon - gc->user->proto_opt[0] ); +		else +			u->host = g_strdup( gc->user->proto_opt[0] ); +		  		u->user = g_strdup( handle );  		/* s/ /_/ ... important for AOL screennames */ @@ -1021,24 +938,30 @@ char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value )  	return( set_eval_bool( irc, set, value ) );  } -int serv_send_im( irc_t *irc, user_t *u, char *msg, int flags ) + + + +/* The plan is to not allow straight calls to prpl functions anymore, but do +   them all from some wrappers. We'll start to define some down here: */ + +int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags )  {  	char *buf = NULL;  	int st; -	if( ( u->gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) ) +	if( ( gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )  	{  		buf = escape_html( msg );  		msg = buf;  	} -	st = ((struct gaim_connection *)u->gc)->prpl->send_im( u->gc, u->handle, msg, strlen( msg ), flags ); +	st = gc->prpl->send_im( gc, handle, msg, strlen( msg ), flags );  	g_free( buf );  	return st;  } -int serv_send_chat( irc_t *irc, struct gaim_connection *gc, int id, char *msg ) +int bim_chat_msg( struct gaim_connection *gc, int id, char *msg )  {  	char *buf = NULL;  	int st; @@ -1054,3 +977,140 @@ int serv_send_chat( irc_t *irc, struct gaim_connection *gc, int id, char *msg )  	return st;  } + +static char *bim_away_alias_find( GList *gcm, char *away ); + +int bim_set_away( struct gaim_connection *gc, char *away ) +{ +	GList *m, *ms; +	char *s; +	 +	if( !away ) away = ""; +	ms = m = gc->prpl->away_states( gc ); +	 +	while( m ) +	{ +		if( *away ) +		{ +			if( g_strncasecmp( m->data, away, strlen( m->data ) ) == 0 ) +				break; +		} +		else +		{ +			if( g_strcasecmp( m->data, "Available" ) == 0 ) +				break; +			if( g_strcasecmp( m->data, "Online" ) == 0 ) +				break; +		} +		m = m->next; +	} +	 +	if( m ) +	{ +		gc->prpl->set_away( gc, m->data, *away ? away : NULL ); +	} +	else +	{ +		s = bim_away_alias_find( ms, away ); +		if( s ) +		{ +			gc->prpl->set_away( gc, s, away ); +			if( set_getint( gc->irc, "debug" ) ) +				serv_got_crap( gc, "Setting away state to %s", s ); +		} +		else +			gc->prpl->set_away( gc, GAIM_AWAY_CUSTOM, away ); +	} +	 +	g_list_free( ms ); +	 +	return( 1 ); +} + +static char *bim_away_alias_list[8][5] = +{ +	{ "Away from computer", "Away", "Extended away", NULL }, +	{ "NA", "N/A", "Not available", NULL }, +	{ "Busy", "Do not disturb", "DND", "Occupied", NULL }, +	{ "Be right back", "BRB", NULL }, +	{ "On the phone", "Phone", "On phone", NULL }, +	{ "Out to lunch", "Lunch", "Food", NULL }, +	{ "Invisible", "Hidden" }, +	{ NULL } +}; + +static char *bim_away_alias_find( GList *gcm, char *away ) +{ +	GList *m; +	int i, j; +	 +	for( i = 0; *bim_away_alias_list[i]; i ++ ) +	{ +		for( j = 0; bim_away_alias_list[i][j]; j ++ ) +			if( g_strncasecmp( away, bim_away_alias_list[i][j], strlen( bim_away_alias_list[i][j] ) ) == 0 ) +				break; +		 +		if( !bim_away_alias_list[i][j] )	/* If we reach the end, this row */ +			continue;			/* is not what we want. Next!    */ +		 +		/* Now find an entry in this row which exists in gcm */ +		for( j = 0; bim_away_alias_list[i][j]; j ++ ) +		{ +			m = gcm; +			while( m ) +			{ +				if( g_strcasecmp( bim_away_alias_list[i][j], m->data ) == 0 ) +					return( bim_away_alias_list[i][j] ); +				m = m->next; +			} +		} +	} +	 +	return( NULL ); +} + +void bim_add_allow( struct gaim_connection *gc, char *handle ) +{ +	if( g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->prpl->cmp_buddynames ) == NULL ) +	{ +		gc->permit = g_slist_prepend( gc->permit, g_strdup( handle ) ); +	} +	 +	gc->prpl->add_permit( gc, handle ); +} + +void bim_rem_allow( struct gaim_connection *gc, char *handle ) +{ +	GSList *l; +	 +	if( ( l = g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->prpl->cmp_buddynames ) ) ) +	{ +		g_free( l->data ); +		gc->permit = g_slist_delete_link( gc->permit, l ); +	} +	 +	gc->prpl->rem_permit( gc, handle ); +} + +void bim_add_block( struct gaim_connection *gc, char *handle ) +{ +	if( g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->prpl->cmp_buddynames ) == NULL ) +	{ +		gc->deny = g_slist_prepend( gc->deny, g_strdup( handle ) ); +	} +	 +	gc->prpl->add_deny( gc, handle ); +} + +void bim_rem_block( struct gaim_connection *gc, char *handle ) +{ +	GSList *l; +	 +	if( ( l = g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->prpl->cmp_buddynames ) ) ) +	{ +		g_free( l->data ); +		gc->deny = g_slist_delete_link( gc->deny, l ); +	} +	 +	gc->prpl->rem_deny( gc, handle ); +} diff --git a/protocols/nogaim.h b/protocols/nogaim.h index 3f88a9ef..b0319d27 100644 --- a/protocols/nogaim.h +++ b/protocols/nogaim.h @@ -51,7 +51,7 @@  #define SELF_ALIAS_LEN 400  #define BUDDY_ALIAS_MAXLEN 388   /* because MSN names can be 387 characters */ -#define WEBSITE "http://www.bitlee.org/" +#define WEBSITE "http://www.bitlbee.org/"  #define IM_FLAG_AWAY 0x0020  #define OPT_CONN_HTML 0x00000001  #define OPT_LOGGED_IN 0x00010000 @@ -193,11 +193,16 @@ G_MODULE_EXPORT struct prpl *find_protocol(const char *name);  G_MODULE_EXPORT void register_protocol(struct prpl *);  /* nogaim.c */ -int serv_send_im(irc_t *irc, user_t *u, char *msg, int flags); -int serv_send_chat(irc_t *irc, struct gaim_connection *gc, int id, char *msg ); +int bim_set_away( struct gaim_connection *gc, char *away ); +int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags ); +int bim_chat_msg( struct gaim_connection *gc, int id, char *msg ); + +void bim_add_allow( struct gaim_connection *gc, char *handle ); +void bim_rem_allow( struct gaim_connection *gc, char *handle ); +void bim_add_block( struct gaim_connection *gc, char *handle ); +void bim_rem_block( struct gaim_connection *gc, char *handle );  void nogaim_init(); -int proto_away( struct gaim_connection *gc, char *away );  char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value );  gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ); @@ -209,7 +214,7 @@ G_MODULE_EXPORT void destroy_gaim_conn( struct gaim_connection *gc );  G_MODULE_EXPORT void set_login_progress( struct gaim_connection *gc, int step, char *msg );  G_MODULE_EXPORT void hide_login_progress( struct gaim_connection *gc, char *msg );  G_MODULE_EXPORT void hide_login_progress_error( struct gaim_connection *gc, char *msg ); -G_MODULE_EXPORT void serv_got_crap( struct gaim_connection *gc, char *format, ... ); +G_MODULE_EXPORT void serv_got_crap( struct gaim_connection *gc, char *format, ... ) G_GNUC_PRINTF( 2, 3 );  G_MODULE_EXPORT void account_online( struct gaim_connection *gc );  G_MODULE_EXPORT void signoff( struct gaim_connection *gc ); diff --git a/protocols/oscar/aim.h b/protocols/oscar/aim.h index 24cd7730..93887103 100644 --- a/protocols/oscar/aim.h +++ b/protocols/oscar/aim.h @@ -727,8 +727,11 @@ struct aim_chat_exchangeinfo {  	char *lang2;  }; -#define AIM_CHATFLAGS_NOREFLECT 0x0001 -#define AIM_CHATFLAGS_AWAY      0x0002 +#define AIM_CHATFLAGS_NOREFLECT 	0x0001 +#define AIM_CHATFLAGS_AWAY      	0x0002 +#define AIM_CHATFLAGS_UNICODE		0x0004 +#define AIM_CHATFLAGS_ISO_8859_1	0x0008 +  int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, guint16 flags, const char *msg, int msglen);  int aim_chat_join(aim_session_t *sess, aim_conn_t *conn, guint16 exchange, const char *roomname, guint16 instance);  int aim_chat_attachname(aim_conn_t *conn, guint16 exchange, const char *roomname, guint16 instance); diff --git a/protocols/oscar/chat.c b/protocols/oscar/chat.c index 033c2577..df535c4f 100644 --- a/protocols/oscar/chat.c +++ b/protocols/oscar/chat.c @@ -158,7 +158,21 @@ int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, guint16 flags, const  	 */  	if (flags & AIM_CHATFLAGS_AWAY)  		aim_addtlvtochain_noval(&otl, 0x0007); - +	 +	/* [WvG] This wasn't there originally, but we really should send +	         the right charset flags, as we also do with normal +	         messages. Hope this will work. :-) */ +	/* +	if (flags & AIM_CHATFLAGS_UNICODE) +		aimbs_put16(&fr->data, 0x0002); +	else if (flags & AIM_CHATFLAGS_ISO_8859_1) +		aimbs_put16(&fr->data, 0x0003); +	else +		aimbs_put16(&fr->data, 0x0000); +	 +	aimbs_put16(&fr->data, 0x0000); +	*/ +	  	/*  	 * SubTLV: Type 1: Message  	 */ diff --git a/protocols/oscar/im.c b/protocols/oscar/im.c index c829d409..7cccabc7 100644 --- a/protocols/oscar/im.c +++ b/protocols/oscar/im.c @@ -1468,7 +1468,7 @@ static void incomingim_ch2_icqserverrelay(aim_session_t *sess, aim_module_t *mod              case AIM_MTYPE_AUTOFFC:  	    case 0x9c:	/* ICQ 5 seems to send this */                  aim_send_im_ch2_statusmessage(sess, userinfo->sn, args->cookie, -                        gc->away, sess->aim_icq_state, dc); +                        gc->away ? gc->away : "", sess->aim_icq_state, dc);                  break;          } diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index ca3210ef..7c76533a 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -1,6 +1,8 @@  /*   * gaim   * + * Some code copyright (C) 2002-2006, Jelmer Vernooij <jelmer@samba.org> + *                                    and the BitlBee team.   * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net>   * libfaim code copyright 1998, 1999 Adam Fritzler <afritz@auk.cx>   * @@ -135,9 +137,9 @@ static char *extract_name(const char *name) {  	char *tmp;  	int i, j;  	char *x = strchr(name, '-'); -	if (!x) return NULL; +	if (!x) return g_strdup(name);  	x = strchr(++x, '-'); -	if (!x) return NULL; +	if (!x) return g_strdup(name);  	tmp = g_strdup(++x);  	for (i = 0, j = 0; x[i]; i++) { @@ -389,7 +391,7 @@ static void oscar_login(struct aim_user *user) {  	if (g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.icq.com") != 0 &&  	    g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.oscar.aol.com") != 0) { -		serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails."); +		serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",user->proto_opt[USEROPT_AUTH]);  	}  	g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username); @@ -2516,6 +2518,7 @@ int oscar_chat_send(struct gaim_connection * gc, int id, char *message)  	struct chat_connection * ccon;  	int ret;  	guint8 len = strlen(message); +	guint16 flags;  	char *s;  	if(!(ccon = find_oscar_chat(gc, id))) @@ -2524,15 +2527,19 @@ int oscar_chat_send(struct gaim_connection * gc, int id, char *message)  	for (s = message; *s; s++)  		if (*s & 128)  			break; -	  	 +	 +	flags = AIM_CHATFLAGS_NOREFLECT; +	  	/* Message contains high ASCII chars, time for some translation! */  	if (*s) {  		s = g_malloc(BUF_LONG);  		/* Try if we can put it in an ISO8859-1 string first.  		   If we can't, fall back to UTF16. */  		if ((ret = do_iconv("UTF-8", "ISO8859-1", message, s, len, BUF_LONG)) >= 0) { +			flags |= AIM_CHATFLAGS_ISO_8859_1;  			len = ret;  		} else if ((ret = do_iconv("UTF-8", "UNICODEBIG", message, s, len, BUF_LONG)) >= 0) { +			flags |= AIM_CHATFLAGS_UNICODE;  			len = ret;  		} else {  			/* OOF, translation failed... Oh well.. */ @@ -2543,7 +2550,7 @@ int oscar_chat_send(struct gaim_connection * gc, int id, char *message)  		s = message;  	} -	ret = aim_chat_send_im(od->sess, ccon->conn, AIM_CHATFLAGS_NOREFLECT, s, len); +	ret = aim_chat_send_im(od->sess, ccon->conn, flags, s, len);  	if (s != message) {	  		g_free(s); @@ -2616,9 +2623,9 @@ int oscar_chat_open(struct gaim_connection * gc, char *who)  	struct oscar_data * od = (struct oscar_data *)gc->proto_data;  	int ret;  	static int chat_id = 0; -	char * chatname = g_new0(char, strlen(gc->username)+4); +	char * chatname; -	g_snprintf(chatname, strlen(gc->username) + 4, "%s%d", gc->username, chat_id++); +	chatname = g_strdup_printf("%s%d", gc->username, chat_id++);  	ret = oscar_chat_join(gc, chatname); diff --git a/root_commands.c b/root_commands.c index 6d9868ac..0e12e9ab 100644 --- a/root_commands.c +++ b/root_commands.c @@ -56,6 +56,10 @@ void root_command_string( irc_t *irc, user_t *u, char *command, int flags )  				cmd[k++] = s;  				s --;  			} +			else +			{ +				break; +			}  		}  		else if( *s == '\\' && ( ( !q && s[1] ) || ( q && q == s[1] ) ) )  		{ @@ -553,9 +557,9 @@ static void cmd_block( irc_t *irc, char **cmd )  	}  	else  	{ -		gc->prpl->rem_permit( gc, cmd[2] ); -		gc->prpl->add_deny( gc, cmd[2] ); -		irc_usermsg( irc, "Buddy `%s' moved from your permit- to your deny-list", cmd[2] ); +		bim_rem_allow( gc, cmd[2] ); +		bim_add_block( gc, cmd[2] ); +		irc_usermsg( irc, "Buddy `%s' moved from your allow- to your block-list", cmd[2] );  	}  } @@ -612,10 +616,10 @@ static void cmd_allow( irc_t *irc, char **cmd )  	}  	else  	{ -		gc->prpl->rem_deny( gc, cmd[2] ); -		gc->prpl->add_permit( gc, cmd[2] ); +		bim_rem_block( gc, cmd[2] ); +		bim_add_allow( gc, cmd[2] ); -		irc_usermsg( irc, "Buddy `%s' moved from your deny- to your permit-list", cmd[2] ); +		irc_usermsg( irc, "Buddy `%s' moved from your block- to your allow-list", cmd[2] );  	}  } @@ -167,8 +167,8 @@ void user_rename( irc_t *irc, char *oldnick, char *newnick )  	if( u->nick == u->realname ) u->realname = NULL;  	u->nick = g_strdup( newnick );  	if( !u->user ) u->user = u->nick; -	if( !u->host ) u->user = u->host; -	if( !u->realname ) u->user = u->realname; +	if( !u->host ) u->host = u->nick; +	if( !u->realname ) u->realname = u->nick;  	/* Remove the old reference to this user from the hash and create a  	   new one with the new nick. This is indeed a bit messy. */ @@ -38,7 +38,14 @@  #include <ctype.h>  #include <glib.h>  #include <time.h> +#ifdef GLIB2 +#define iconv_t GIConv +#define iconv_open g_iconv_open +#define iconv_close g_iconv_close +#define iconv g_iconv +#else  #include <iconv.h> +#endif  void strip_linefeed(gchar *text)  { | 
