Variable cleanup for away_*

This commit is contained in:
Berke Viktor
2012-10-22 09:53:28 +02:00
parent 0e8ac8b7a1
commit a05817c0eb
10 changed files with 61 additions and 57 deletions

View File

@@ -389,14 +389,14 @@ default_file (void)
/* Keep these sorted!! */
const struct prefs vars[] = {
{"away_auto_unmark", P_OFFINT (auto_unmark_away), TYPE_BOOL},
{"away_omit_alerts", P_OFFINT (away_omit_alerts), TYPE_BOOL},
{"away_reason", P_OFFSET (awayreason), TYPE_STR},
{"away_show_message", P_OFFINT (show_away_message), TYPE_BOOL},
{"away_show_once", P_OFFINT (show_away_once), TYPE_BOOL},
{"away_size_max", P_OFFINT (away_size_max), TYPE_INT},
{"away_timeout", P_OFFINT (away_timeout), TYPE_INT},
{"away_track", P_OFFINT (away_track), TYPE_BOOL},
{"away_auto_unmark", P_OFFINT (hex_away_auto_unmark), TYPE_BOOL},
{"away_omit_alerts", P_OFFINT (hex_away_omit_alerts), TYPE_BOOL},
{"away_reason", P_OFFSET (hex_away_reason), TYPE_STR},
{"away_show_message", P_OFFINT (hex_away_show_message), TYPE_BOOL},
{"away_show_once", P_OFFINT (hex_away_show_once), TYPE_BOOL},
{"away_size_max", P_OFFINT (hex_away_size_max), TYPE_INT},
{"away_timeout", P_OFFINT (hex_away_timeout), TYPE_INT},
{"away_track", P_OFFINT (hex_away_track), TYPE_BOOL},
{"completion_amount", P_OFFINT (completion_amount), TYPE_INT},
{"completion_auto", P_OFFINT (nickcompletion), TYPE_BOOL},
@@ -659,13 +659,13 @@ load_config (void)
prefs.show_marker = 1;
prefs.newtabstofront = 2;
prefs.completion_amount = 5;
prefs.away_timeout = 60;
prefs.away_size_max = 300;
prefs.away_track = 1;
prefs.hex_away_timeout = 60;
prefs.hex_away_size_max = 300;
prefs.hex_away_track = 1;
prefs.timestamp_logs = 1;
prefs.truncchans = 20;
prefs.autoresume = 1;
prefs.show_away_once = 1;
prefs.hex_away_show_once = 1;
prefs.indent_nicks = 1;
prefs.thin_separator = 1;
prefs.identd = 1;
@@ -776,7 +776,7 @@ load_config (void)
snprintf (prefs.dccdir, sizeof (prefs.dccdir), "%s/downloads", get_xdir_utf8 ());
#endif
strcpy (prefs.doubleclickuser, "QUOTE WHOIS %s %s");
strcpy (prefs.awayreason, _("I'm busy"));
strcpy (prefs.hex_away_reason, _("I'm busy"));
strcpy (prefs.quitreason, _("Leaving"));
strcpy (prefs.partreason, prefs.quitreason);
strcpy (prefs.font_normal, DEF_FONT);

View File

@@ -433,7 +433,7 @@ inbound_chanmsg (server *serv, session *sess, char *chan, char *from, char *text
if (fromme)
{
if (prefs.auto_unmark_away && serv->is_away)
if (prefs.hex_away_auto_unmark && serv->is_away)
sess->server->p_set_back (sess->server);
EMIT_SIGNAL (XP_TE_UCHANMSG, sess, from, text, nickchar, NULL, 0);
return;
@@ -942,7 +942,7 @@ inbound_away (server *serv, char *nick, char *msg)
if (away && !strcmp (msg, away->message)) /* Seen the msg before? */
{
if (prefs.show_away_once && !serv->inside_whois)
if (prefs.hex_away_show_once && !serv->inside_whois)
return;
} else
{

View File

@@ -378,11 +378,11 @@ cmd_away (struct session *sess, char *tbuf, char *word[], char *word_eol[])
reason = sess->server->last_away_reason;
else
/* must manage memory pointed to by random_line() */
reason = random_line (prefs.awayreason);
reason = random_line (prefs.hex_away_reason);
}
sess->server->p_set_away (sess->server, reason);
if (prefs.show_away_message)
if (prefs.hex_away_show_message)
{
snprintf (tbuf, TBUFSIZE, "me is away: %s", reason);
for (list = sess_list; list; list = list->next)
@@ -424,7 +424,7 @@ cmd_back (struct session *sess, char *tbuf, char *word[], char *word_eol[])
{
sess->server->p_set_back (sess->server);
if (prefs.show_away_message)
if (prefs.hex_away_show_message)
{
gone = time (NULL) - sess->server->away_time;
sprintf (tbuf, "me is back (gone %.2d:%.2d:%.2d)", gone / 3600,

View File

@@ -2203,9 +2203,9 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d)
case XP_TE_DPRIVMSG:
case XP_TE_PRIVACTION:
case XP_TE_DPRIVACTION:
if (chanopt_is_set_a (prefs.input_beep_priv, sess->alert_beep) && (!prefs.away_omit_alerts || !sess->server->is_away))
if (chanopt_is_set_a (prefs.input_beep_priv, sess->alert_beep) && (!prefs.hex_away_omit_alerts || !sess->server->is_away))
sound_beep (sess);
if (chanopt_is_set_a (prefs.input_flash_priv, sess->alert_taskbar) && (!prefs.away_omit_alerts || !sess->server->is_away))
if (chanopt_is_set_a (prefs.input_flash_priv, sess->alert_taskbar) && (!prefs.hex_away_omit_alerts || !sess->server->is_away))
fe_flash_window (sess);
/* why is this one different? because of plugin-tray.c's hooks! ugly */
if (sess->alert_tray == SET_ON)
@@ -2215,9 +2215,9 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d)
/* ===Highlighted message=== */
case XP_TE_HCHANACTION:
case XP_TE_HCHANMSG:
if (chanopt_is_set_a (prefs.input_beep_hilight, sess->alert_beep) && (!prefs.away_omit_alerts || !sess->server->is_away))
if (chanopt_is_set_a (prefs.input_beep_hilight, sess->alert_beep) && (!prefs.hex_away_omit_alerts || !sess->server->is_away))
sound_beep (sess);
if (chanopt_is_set_a (prefs.input_flash_hilight, sess->alert_taskbar) && (!prefs.away_omit_alerts || !sess->server->is_away))
if (chanopt_is_set_a (prefs.input_flash_hilight, sess->alert_taskbar) && (!prefs.hex_away_omit_alerts || !sess->server->is_away))
fe_flash_window (sess);
if (sess->alert_tray == SET_ON)
fe_tray_set_icon (FE_ICON_MESSAGE);
@@ -2226,9 +2226,9 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d)
/* ===Channel message=== */
case XP_TE_CHANACTION:
case XP_TE_CHANMSG:
if (chanopt_is_set_a (prefs.input_beep_chans, sess->alert_beep) && (!prefs.away_omit_alerts || !sess->server->is_away))
if (chanopt_is_set_a (prefs.input_beep_chans, sess->alert_beep) && (!prefs.hex_away_omit_alerts || !sess->server->is_away))
sound_beep (sess);
if (chanopt_is_set_a (prefs.input_flash_chans, sess->alert_taskbar) && (!prefs.away_omit_alerts || !sess->server->is_away))
if (chanopt_is_set_a (prefs.input_flash_chans, sess->alert_taskbar) && (!prefs.hex_away_omit_alerts || !sess->server->is_away))
fe_flash_window (sess);
if (sess->alert_tray == SET_ON)
fe_tray_set_icon (FE_ICON_MESSAGE);

View File

@@ -209,7 +209,7 @@ away_check (void)
GSList *list;
int full, sent, loop = 0;
if (!prefs.away_track || prefs.away_size_max < 1)
if (!prefs.hex_away_track || prefs.hex_away_size_max < 1)
return 1;
doover:
@@ -224,7 +224,7 @@ doover:
if (sess->server->connected &&
sess->type == SESS_CHANNEL &&
sess->channel[0] &&
sess->total <= prefs.away_size_max)
sess->total <= prefs.hex_away_size_max)
{
if (!sess->done_away_check)
{
@@ -325,7 +325,7 @@ irc_init (session *sess)
notify_tag = fe_timeout_add (prefs.notify_timeout * 1000,
notify_checklist, 0);
fe_timeout_add (prefs.away_timeout * 1000, away_check, 0);
fe_timeout_add (prefs.hex_away_timeout * 1000, away_check, 0);
fe_timeout_add (500, xchat_misc_checks, 0);
if (arg_url != NULL)

View File

@@ -104,13 +104,25 @@ struct nbexec
struct hexchatprefs
{
/* these are the rebranded, consistent, sorted hexchat variables */
char hex_away_reason[256];
int hex_away_size_max;
int hex_away_timeout;
unsigned int hex_away_auto_unmark;
unsigned int hex_away_omit_alerts;
unsigned int hex_away_show_message;
unsigned int hex_away_show_once;
unsigned int hex_away_track;
/* these are the legacy variables */
char nick1[NICKLEN];
char nick2[NICKLEN];
char nick3[NICKLEN];
char realname[127];
char username[127];
char nick_suffix[4]; /* Only ever holds a one-character string. */
char awayreason[256];
char quitreason[256];
char partreason[256];
char font_normal[4 * FONTNAMELEN + 1];
@@ -150,9 +162,6 @@ struct hexchatprefs
int tint_green;
int tint_blue;
int away_timeout;
int away_size_max;
int gui_pane_left_size;
int gui_pane_right_size;
int gui_pane_right_size_min;
@@ -264,11 +273,6 @@ struct hexchatprefs
unsigned int hidever;
unsigned int ip_from_server;
unsigned int raw_modes;
unsigned int show_away_once;
unsigned int show_away_message;
unsigned int auto_unmark_away;
unsigned int away_track;
unsigned int away_omit_alerts;
unsigned int userhost;
unsigned int irc_whois_front;
unsigned int use_server_tab;