1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-11-26 19:22:22 -05:00

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;

View File

@ -587,7 +587,7 @@ fe_set_hilight (struct session *sess)
if (sess->gui->is_tab)
fe_set_tab_color (sess, 3); /* set tab to blue */
if (prefs.input_flash_hilight && (!prefs.away_omit_alerts || !sess->server->is_away))
if (prefs.input_flash_hilight && (!prefs.hex_away_omit_alerts || !sess->server->is_away))
fe_flash_window (sess); /* taskbar flash */
}

View File

@ -578,7 +578,7 @@ tray_hilight_cb (char *word[], void *userdata)
/*if (tray_status == TS_HIGHLIGHT)
return XCHAT_EAT_NONE;*/
if (prefs.input_tray_hilight && (!prefs.away_omit_alerts || tray_find_away_status () != 1))
if (prefs.input_tray_hilight && (!prefs.hex_away_omit_alerts || tray_find_away_status () != 1))
{
tray_set_flash (ICON_HILIGHT);
@ -592,7 +592,7 @@ tray_hilight_cb (char *word[], void *userdata)
tray_hilight_count, word[1], xchat_get_info (ph, "channel"));
}
if (prefs.input_balloon_hilight && (!prefs.away_omit_alerts || tray_find_away_status () != 1))
if (prefs.input_balloon_hilight && (!prefs.hex_away_omit_alerts || tray_find_away_status () != 1))
tray_set_balloonf (word[2], _(DISPLAY_NAME": Highlighted message from: %s (%s)"),
word[1], xchat_get_info (ph, "channel"));
@ -605,7 +605,7 @@ tray_message_cb (char *word[], void *userdata)
if (/*tray_status == TS_MESSAGE ||*/ tray_status == TS_HIGHLIGHT)
return XCHAT_EAT_NONE;
if (prefs.input_tray_chans && (!prefs.away_omit_alerts || tray_find_away_status () != 1))
if (prefs.input_tray_chans && (!prefs.hex_away_omit_alerts || tray_find_away_status () != 1))
{
tray_set_flash (ICON_MSG);
@ -617,7 +617,7 @@ tray_message_cb (char *word[], void *userdata)
tray_set_tipf (_(DISPLAY_NAME": %u new public messages."), tray_pub_count);
}
if (prefs.input_balloon_chans && (!prefs.away_omit_alerts || tray_find_away_status () != 1))
if (prefs.input_balloon_chans && (!prefs.hex_away_omit_alerts || tray_find_away_status () != 1))
tray_set_balloonf (word[2], _(DISPLAY_NAME": New public message from: %s (%s)"),
word[1], xchat_get_info (ph, "channel"));
@ -646,7 +646,7 @@ tray_priv (char *from, char *text)
tray_set_tipf (_(DISPLAY_NAME": %u private messages, latest from: %s (%s)"),
tray_priv_count, from, network);
if (prefs.input_balloon_priv && (!prefs.away_omit_alerts || tray_find_away_status () != 1))
if (prefs.input_balloon_priv && (!prefs.hex_away_omit_alerts || tray_find_away_status () != 1))
tray_set_balloonf (text, _(DISPLAY_NAME": Private message from: %s (%s)"),
from, network);
}
@ -657,7 +657,7 @@ tray_priv_cb (char *word[], void *userdata)
/*if (tray_status == TS_HIGHLIGHT)
return XCHAT_EAT_NONE;*/
if (prefs.input_tray_priv && (!prefs.away_omit_alerts || tray_find_away_status () != 1))
if (prefs.input_tray_priv && (!prefs.hex_away_omit_alerts || tray_find_away_status () != 1))
tray_priv (word[1], word[2]);
return XCHAT_EAT_NONE;
@ -669,7 +669,7 @@ tray_invited_cb (char *word[], void *userdata)
/*if (tray_status == TS_HIGHLIGHT)
return XCHAT_EAT_NONE;*/
if (prefs.input_tray_priv && (!prefs.away_omit_alerts || tray_find_away_status () != 1))
if (prefs.input_tray_priv && (!prefs.hex_away_omit_alerts || tray_find_away_status () != 1))
tray_priv (word[2], "Invited");
return XCHAT_EAT_NONE;
@ -687,7 +687,7 @@ tray_dcc_cb (char *word[], void *userdata)
if (!network)
network = xchat_get_info (ph, "server");
if (prefs.input_tray_priv && (!prefs.away_omit_alerts || tray_find_away_status () != 1))
if (prefs.input_tray_priv && (!prefs.hex_away_omit_alerts || tray_find_away_status () != 1))
{
tray_set_flash (ICON_FILE);
@ -700,7 +700,7 @@ tray_dcc_cb (char *word[], void *userdata)
tray_file_count, word[1], network);
}
if (prefs.input_balloon_priv && (!prefs.away_omit_alerts || tray_find_away_status () != 1))
if (prefs.input_balloon_priv && (!prefs.hex_away_omit_alerts || tray_find_away_status () != 1))
tray_set_balloonf ("", _(DISPLAY_NAME": File offer from: %s (%s)"),
word[1], network);

View File

@ -289,8 +289,8 @@ static const setting userlist_settings[] =
{ST_MENU, N_("Show user list at:"), P_OFFINTNL(gui_ulist_pos), 0, ulpos, 1},
{ST_HEADER, N_("Away Tracking"),0,0,0},
{ST_TOGGLE, N_("Track the Away status of users and mark them in a different color"), P_OFFINTNL(away_track),0,0,2},
{ST_NUMBER, N_("On channels smaller than:"), P_OFFINTNL(away_size_max),0,0,10000},
{ST_TOGGLE, N_("Track the Away status of users and mark them in a different color"), P_OFFINTNL(hex_away_track),0,0,2},
{ST_NUMBER, N_("On channels smaller than:"), P_OFFINTNL(hex_away_size_max),0,0,10000},
{ST_HEADER, N_("Action Upon Double Click"),0,0,0},
{ST_ENTRY, N_("Execute command:"), P_OFFSETNL(doubleclickuser), 0, 0, sizeof prefs.doubleclickuser},
@ -432,7 +432,7 @@ static const setting alert_settings[] =
{ST_3OGGLE, N_("Make a beep sound on:"), 0, 0, (void *)beeplist, 0},
{ST_TOGGLE, N_("Enable system tray icon"), P_OFFINTNL(gui_tray), 0, 0, 0},
{ST_TOGGLE, N_("Omit alerts when marked as being away"), P_OFFINTNL(away_omit_alerts), 0, 0, 0},
{ST_TOGGLE, N_("Omit alerts when marked as being away"), P_OFFINTNL(hex_away_omit_alerts), 0, 0, 0},
{ST_HEADER, N_("Highlighted Messages"),0,0,0},
{ST_LABEL, N_("Highlighted messages are ones where your nickname is mentioned, but also:"), 0, 0, 0, 1},
@ -453,7 +453,7 @@ static const setting alert_settings_hextray[] =
{ST_3OGGLE, N_("Blink task bar on:"), 0, 0, (void *)taskbarlist, 0},
{ST_3OGGLE, N_("Make a beep sound on:"), 0, 0, (void *)beeplist, 0},
{ST_TOGGLE, N_("Omit alerts when marked as being away"), P_OFFINTNL(away_omit_alerts), 0, 0, 0},
{ST_TOGGLE, N_("Omit alerts when marked as being away"), P_OFFINTNL(hex_away_omit_alerts), 0, 0, 0},
{ST_HEADER, N_("Highlighted Messages"),0,0,0},
{ST_LABEL, N_("Highlighted messages are ones where your nickname is mentioned, but also:"), 0, 0, 0, 1},
@ -471,13 +471,13 @@ static const setting general_settings[] =
{ST_HEADER, N_("Default Messages"),0,0,0},
{ST_ENTRY, N_("Quit:"), P_OFFSETNL(quitreason), 0, 0, sizeof prefs.quitreason},
{ST_ENTRY, N_("Leave channel:"), P_OFFSETNL(partreason), 0, 0, sizeof prefs.partreason},
{ST_ENTRY, N_("Away:"), P_OFFSETNL(awayreason), 0, 0, sizeof prefs.awayreason},
{ST_ENTRY, N_("Away:"), P_OFFSETNL(hex_away_reason), 0, 0, sizeof prefs.hex_away_reason},
{ST_HEADER, N_("Away"),0,0,0},
{ST_TOGGLE, N_("Announce away messages"), P_OFFINTNL(show_away_message),
{ST_TOGGLE, N_("Announce away messages"), P_OFFINTNL(hex_away_show_message),
N_("Announce your away messages to all channels"), 0, 0},
{ST_TOGGLE, N_("Show away once"), P_OFFINTNL(show_away_once), N_("Show identical away messages only once"), 0, 0},
{ST_TOGGLE, N_("Automatically unmark away"), P_OFFINTNL(auto_unmark_away), N_("Unmark yourself as away before sending messages"), 0, 0},
{ST_TOGGLE, N_("Show away once"), P_OFFINTNL(hex_away_show_once), N_("Show identical away messages only once"), 0, 0},
{ST_TOGGLE, N_("Automatically unmark away"), P_OFFINTNL(hex_away_auto_unmark), N_("Unmark yourself as away before sending messages"), 0, 0},
{ST_END, 0, 0, 0, 0, 0}
};
@ -2234,7 +2234,7 @@ setup_apply (struct hexchatprefs *pr)
if (DIFF (tab_layout))
do_layout = TRUE;
if (color_change || (DIFF (away_size_max)) || (DIFF (away_track)))
if (color_change || (DIFF (hex_away_size_max)) || (DIFF (hex_away_track)))
do_ulist = TRUE;
if ((pr->tab_pos == 5 || pr->tab_pos == 6) &&

View File

@ -333,7 +333,7 @@ fe_userlist_rehash (session *sess, struct User *user)
if (!iter)
return;
if (prefs.away_size_max < 1 || !prefs.away_track)
if (prefs.hex_away_size_max < 1 || !prefs.hex_away_track)
do_away = FALSE;
gtk_list_store_set (GTK_LIST_STORE (sess->res->user_model), iter,
@ -353,7 +353,7 @@ fe_userlist_insert (session *sess, struct User *newuser, int row, int sel)
int do_away = TRUE;
char *nick;
if (prefs.away_size_max < 1 || !prefs.away_track)
if (prefs.hex_away_size_max < 1 || !prefs.hex_away_track)
do_away = FALSE;
nick = newuser->nick;