diff options
Diffstat (limited to 'protocols/nogaim.c')
| -rw-r--r-- | protocols/nogaim.c | 50 | 
1 files changed, 40 insertions, 10 deletions
| diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 1f46926a..96c2f512 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -97,7 +97,19 @@ GList *protocols = NULL;  void register_protocol (struct prpl *p)  { -	protocols = g_list_append(protocols, p); +	int i; +	gboolean refused = global.conf->protocols != NULL; +  +	for (i = 0; global.conf->protocols && global.conf->protocols[i]; i++) + 	{ + 		if (g_strcasecmp(p->name, global.conf->protocols[i]) == 0) +			refused = FALSE; + 	} + +	if (refused) +		log_message(LOGLVL_WARNING, "Protocol %s disabled\n", p->name); +	else +		protocols = g_list_append(protocols, p);  }  struct prpl *find_protocol(const char *name) @@ -378,7 +390,7 @@ void imcb_ask( struct im_connection *ic, char *msg, void *data,  /* list.c */ -void imcb_add_buddy( struct im_connection *ic, char *handle, char *group ) +void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *group )  {  	user_t *u;  	char nick[MAX_NICK_LENGTH+1], *s; @@ -452,9 +464,10 @@ struct buddy *imcb_find_buddy( struct im_connection *ic, char *handle )  	return( b );  } -void imcb_rename_buddy( struct im_connection *ic, char *handle, char *realname ) +void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char *realname )  {  	user_t *u = user_findhandle( ic, handle ); +	char *set;  	if( !u || !realname ) return; @@ -467,9 +480,26 @@ void imcb_rename_buddy( struct im_connection *ic, char *handle, char *realname )  		if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->irc->set, "display_namechanges" ) )  			imcb_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname );  	} +	 +	set = set_getstr( &ic->acc->set, "nick_source" ); +	if( strcmp( set, "handle" ) != 0 ) +	{ +		char *name = g_strdup( realname ); +		 +		if( strcmp( set, "first_name" ) == 0 ) +		{ +			int i; +			for( i = 0; name[i] && !isspace( name[i] ); i ++ ) {} +			name[i] = '\0'; +		} +		 +		imcb_buddy_nick_hint( ic, handle, name ); +		 +		g_free( name ); +	}  } -void imcb_remove_buddy( struct im_connection *ic, char *handle, char *group ) +void imcb_remove_buddy( struct im_connection *ic, const char *handle, char *group )  {  	user_t *u; @@ -479,7 +509,7 @@ void imcb_remove_buddy( struct im_connection *ic, char *handle, char *group )  /* Mainly meant for ICQ (and now also for Jabber conferences) to allow IM     modules to suggest a nickname for a handle. */ -void imcb_buddy_nick_hint( struct im_connection *ic, char *handle, char *nick ) +void imcb_buddy_nick_hint( struct im_connection *ic, const char *handle, const char *nick )  {  	user_t *u = user_findhandle( ic, handle );  	char newnick[MAX_NICK_LENGTH+1], *orig_nick; @@ -691,7 +721,7 @@ void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags,  	}  } -void imcb_buddy_msg( struct im_connection *ic, char *handle, char *msg, uint32_t flags, time_t sent_at ) +void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at )  {  	irc_t *irc = ic->irc;  	char *wrapped; @@ -824,7 +854,7 @@ void imcb_chat_free( struct groupchat *c )  	}  } -void imcb_chat_msg( struct groupchat *c, char *who, char *msg, uint32_t flags, time_t sent_at ) +void imcb_chat_msg( struct groupchat *c, const char *who, char *msg, uint32_t flags, time_t sent_at )  {  	struct im_connection *ic = c->ic;  	char *wrapped; @@ -896,7 +926,7 @@ void imcb_chat_topic( struct groupchat *c, char *who, char *topic, time_t set_at  /* buddy_chat.c */ -void imcb_chat_add_buddy( struct groupchat *b, char *handle ) +void imcb_chat_add_buddy( struct groupchat *b, const char *handle )  {  	user_t *u = user_findhandle( b->ic, handle );  	int me = 0; @@ -931,7 +961,7 @@ void imcb_chat_add_buddy( struct groupchat *b, char *handle )  }  /* This function is one BIG hack... :-( EREWRITE */ -void imcb_chat_remove_buddy( struct groupchat *b, char *handle, char *reason ) +void imcb_chat_remove_buddy( struct groupchat *b, const char *handle, const char *reason )  {  	user_t *u;  	int me = 0; @@ -1080,7 +1110,7 @@ static char *imc_away_state_find( GList *gcm, char *away, char **message );  int imc_away_send_update( struct im_connection *ic )  { -	char *away, *msg; +	char *away, *msg = NULL;  	away = set_getstr( &ic->acc->set, "away" ) ?  	     : set_getstr( &ic->irc->set, "away" ); | 
