diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-07-19 00:50:27 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-07-19 00:50:27 +0100 |
commit | 6d8cc053c4b247ad721a0760b13cd383d758c2c5 (patch) | |
tree | d51e026a88583e877787dc22f5231e028e335a7e | |
parent | 94d5da9cc78a89b6292d53c7784a3076500d67e2 (diff) |
Adding easy migration from old show_offline/away_devoice settings, and
documentation.
-rw-r--r-- | doc/user-guide/commands.xml | 30 | ||||
-rw-r--r-- | irc.c | 34 | ||||
-rw-r--r-- | protocols/nogaim.h | 1 |
3 files changed, 54 insertions, 11 deletions
diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml index ae2d76fb..4413ce49 100644 --- a/doc/user-guide/commands.xml +++ b/doc/user-guide/commands.xml @@ -517,6 +517,10 @@ <para> With this option enabled, the root user devoices people when they go away (just away, not offline) and gives the voice back when they come back. You might dislike the voice-floods you'll get if your contact list is huge, so this option can be disabled. </para> + + <para> + Replaced with the <emphasis>show_users</emphasis> setting. See <emphasis>help show_users</emphasis>. + </para> </description> </bitlbee-setting> @@ -1040,6 +1044,32 @@ <para> If enabled causes BitlBee to also show offline users in Channel. Online-users will get op, away-users voice and offline users none of both. This option takes effect as soon as you reconnect. </para> + + <para> + Replaced with the <emphasis>show_users</emphasis> setting. See <emphasis>help show_users</emphasis>. + </para> + </description> + </bitlbee-setting> + + <bitlbee-setting name="show_users" type="string" scope="channel"> + <default>online+,away</default> + + <description> + <para> + Comma-separated list of statuses of users you want in the channel, + and any modes they should have. The following statuses are currently + recognised: <emphasis>online</emphasis> (i.e. available, not + away), <emphasis>away</emphasis>, and <emphasis>offline</emphasis>. + </para> + + <para> + If a status is followed by a valid channel mode character + (@, % or +), it will be given to users with that status. + For example, <emphasis>online@,away+,offline</emphasis> will + show all users in the channel. Online people will + have +o, people who are online but away will have +v, + and others will have no special modes. + </para> </description> </bitlbee-setting> @@ -32,6 +32,7 @@ GSList *irc_connection_list; static gboolean irc_userping( gpointer _irc, gint fd, b_input_condition cond ); static char *set_eval_charset( set_t *set, char *value ); static char *set_eval_password( set_t *set, char *value ); +static char *set_eval_bw_compat( set_t *set, char *value ); irc_t *irc_new( int fd ) { @@ -100,7 +101,7 @@ irc_t *irc_new( int fd ) b->ui = &irc_ui_funcs; s = set_add( &b->set, "allow_takeover", "true", set_eval_bool, irc ); - s = set_add( &b->set, "away_devoice", "true", set_eval_away_devoice, irc ); + s = set_add( &b->set, "away_devoice", "true", set_eval_bw_compat, irc ); s = set_add( &b->set, "away_reply_timeout", "3600", set_eval_int, irc ); s = set_add( &b->set, "charset", "utf-8", set_eval_charset, irc ); s = set_add( &b->set, "default_target", "root", NULL, irc ); @@ -120,6 +121,7 @@ irc_t *irc_new( int fd ) s = set_add( &b->set, "private", "true", set_eval_bool, irc ); s = set_add( &b->set, "query_order", "lifo", NULL, irc ); s = set_add( &b->set, "root_nick", ROOT_NICK, set_eval_root_nick, irc ); + s = set_add( &b->set, "show_offline", "false", set_eval_bw_compat, irc ); s = set_add( &b->set, "simulate_netsplit", "true", set_eval_bool, irc ); s = set_add( &b->set, "timezone", "local", set_eval_timezone, irc ); s = set_add( &b->set, "to_char", ": ", set_eval_to_char, irc ); @@ -900,19 +902,31 @@ static char *set_eval_charset( set_t *set, char *value ) return value; } -char *set_eval_away_devoice( set_t *set, char *value ) +/* Mostly meant for upgrades. If one of these is set to the non-default, + set show_users of all channels to something with the same effect. */ +static char *set_eval_bw_compat( set_t *set, char *value ) { irc_t *irc = set->data; + char *val; + GSList *l; - if( !is_bool( value ) ) - return SET_INVALID; + irc_usermsg( irc, "Setting `%s' is obsolete, use the `show_users' " + "channel setting instead.", set->key ); - /* The usual problem: The setting isn't actually changed at this - point and we need it to be, so do it by hand. */ - g_free( set->value ); - set->value = g_strdup( value ); + if( strcmp( set->key, "away_devoice" ) == 0 && !bool2int( value ) ) + val = "online,away"; + else if( strcmp( set->key, "show_offline" ) == 0 && bool2int( value ) ) + val = "online@,away+,offline"; + else + return SET_INVALID; - bee_irc_channel_update( irc, NULL, NULL ); + for( l = irc->channels; l; l = l->next ) + { + irc_channel_t *ic = l->data; + /* No need to check channel type, if the setting doesn't exist it + will just be ignored. */ + set_setstr( &ic->set, "show_users", val ); + } - return value; + return SET_INVALID; } diff --git a/protocols/nogaim.h b/protocols/nogaim.h index e2933e4a..1d9ac71e 100644 --- a/protocols/nogaim.h +++ b/protocols/nogaim.h @@ -323,7 +323,6 @@ void imc_rem_block( struct im_connection *ic, char *handle ); /* Misc. stuff */ char *set_eval_timezone( set_t *set, char *value ); -char *set_eval_away_devoice( set_t *set, char *value ); gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ); void cancel_auto_reconnect( struct account *a ); |