mirror of
https://github.com/moparisthebest/hexchat
synced 2024-12-23 08:08:54 -05:00
Variable cleanup for completion_*
This commit is contained in:
parent
a05817c0eb
commit
cf8ea26498
@ -398,10 +398,10 @@ const struct prefs vars[] = {
|
||||
{"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},
|
||||
{"completion_sort", P_OFFINT (completion_sort), TYPE_INT},
|
||||
{"completion_suffix", P_OFFSET (nick_suffix), TYPE_STR},
|
||||
{"completion_amount", P_OFFINT (hex_completion_amount), TYPE_INT},
|
||||
{"completion_auto", P_OFFINT (hex_completion_auto), TYPE_BOOL},
|
||||
{"completion_sort", P_OFFINT (hex_completion_sort), TYPE_INT},
|
||||
{"completion_suffix", P_OFFSET (hex_completion_suffix), TYPE_STR},
|
||||
|
||||
{"dcc_auto_chat", P_OFFINT (autodccchat), TYPE_INT},
|
||||
{"dcc_auto_resume", P_OFFINT (autoresume), TYPE_BOOL},
|
||||
@ -658,7 +658,7 @@ load_config (void)
|
||||
prefs.irc_join_delay = 3;
|
||||
prefs.show_marker = 1;
|
||||
prefs.newtabstofront = 2;
|
||||
prefs.completion_amount = 5;
|
||||
prefs.hex_completion_amount = 5;
|
||||
prefs.hex_away_timeout = 60;
|
||||
prefs.hex_away_size_max = 300;
|
||||
prefs.hex_away_track = 1;
|
||||
@ -748,7 +748,7 @@ load_config (void)
|
||||
strcpy (prefs.stamp_format, "[%H:%M:%S] ");
|
||||
strcpy (prefs.timestamp_log_format, "%b %d %H:%M:%S ");
|
||||
strcpy (prefs.logmask, "%n-%c.log");
|
||||
strcpy (prefs.nick_suffix, ",");
|
||||
strcpy (prefs.hex_completion_suffix, ",");
|
||||
strcpy (prefs.cmdchar, "/");
|
||||
strcpy (prefs.nick1, username);
|
||||
strcpy (prefs.nick2, username);
|
||||
|
@ -1725,10 +1725,10 @@ exec_data (GIOChannel *source, GIOCondition condition, struct nbexec *s)
|
||||
if (s->tochannel)
|
||||
{
|
||||
/* must turn off auto-completion temporarily */
|
||||
unsigned int old = prefs.nickcompletion;
|
||||
prefs.nickcompletion = 0;
|
||||
unsigned int old = prefs.hex_completion_auto;
|
||||
prefs.hex_completion_auto = 0;
|
||||
handle_multiline (s->sess, buf, FALSE, TRUE);
|
||||
prefs.nickcompletion = old;
|
||||
prefs.hex_completion_auto = old;
|
||||
}
|
||||
else
|
||||
PrintText (s->sess, buf);
|
||||
@ -4074,7 +4074,7 @@ perform_nick_completion (struct session *sess, char *cmd, char *tbuf)
|
||||
char *space = strchr (cmd, ' ');
|
||||
if (space && space != cmd)
|
||||
{
|
||||
if (space[-1] == prefs.nick_suffix[0] && space - 1 != cmd)
|
||||
if (space[-1] == prefs.hex_completion_suffix[0] && space - 1 != cmd)
|
||||
{
|
||||
len = space - cmd - 1;
|
||||
if (len < NICKLEN)
|
||||
@ -4175,7 +4175,7 @@ handle_say (session *sess, char *text, int check_spch)
|
||||
goto xit;
|
||||
}
|
||||
|
||||
if (prefs.nickcompletion)
|
||||
if (prefs.hex_completion_auto)
|
||||
perform_nick_completion (sess, text, newcmd);
|
||||
else
|
||||
safe_strcpy (newcmd, text, newcmdlen);
|
||||
|
@ -106,15 +106,19 @@ struct hexchatprefs
|
||||
{
|
||||
/* these are the rebranded, consistent, sorted hexchat variables */
|
||||
char hex_away_reason[256];
|
||||
char hex_completion_suffix[4]; /* Only ever holds a one-character string. */
|
||||
|
||||
int hex_away_size_max;
|
||||
int hex_away_timeout;
|
||||
int hex_completion_amount;
|
||||
int hex_completion_sort;
|
||||
|
||||
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;
|
||||
unsigned int hex_completion_auto;
|
||||
|
||||
/* these are the legacy variables */
|
||||
char nick1[NICKLEN];
|
||||
@ -122,7 +126,6 @@ struct hexchatprefs
|
||||
char nick3[NICKLEN];
|
||||
char realname[127];
|
||||
char username[127];
|
||||
char nick_suffix[4]; /* Only ever holds a one-character string. */
|
||||
char quitreason[256];
|
||||
char partreason[256];
|
||||
char font_normal[4 * FONTNAMELEN + 1];
|
||||
@ -186,7 +189,6 @@ struct hexchatprefs
|
||||
int mainwindow_top;
|
||||
int mainwindow_width;
|
||||
int mainwindow_height;
|
||||
int completion_sort;
|
||||
int gui_win_state;
|
||||
int gui_url_mod;
|
||||
int gui_lang;
|
||||
@ -223,8 +225,6 @@ struct hexchatprefs
|
||||
unsigned int chanmodebuttons;
|
||||
unsigned int userlistbuttons;
|
||||
unsigned int showhostname_in_userlist;
|
||||
unsigned int nickcompletion;
|
||||
unsigned int completion_amount;
|
||||
unsigned int tabchannels;
|
||||
unsigned int paned_userlist;
|
||||
unsigned int autodccchat;
|
||||
|
@ -1458,7 +1458,7 @@ key_action_tab_comp (GtkWidget *t, GdkEventKey *entry, char *d1, char *d2,
|
||||
cursor_pos = g_utf8_pointer_to_offset(text, ch);
|
||||
if (cursor_pos && (g_utf8_get_char_validated(ch, -1) == ':' ||
|
||||
g_utf8_get_char_validated(ch, -1) == ',' ||
|
||||
g_utf8_get_char_validated(ch, -1) == prefs.nick_suffix[0]))
|
||||
g_utf8_get_char_validated(ch, -1) == prefs.hex_completion_suffix[0]))
|
||||
{
|
||||
skip_len++;
|
||||
}
|
||||
@ -1511,7 +1511,7 @@ key_action_tab_comp (GtkWidget *t, GdkEventKey *entry, char *d1, char *d2,
|
||||
{
|
||||
gcomp = g_completion_new((GCompletionFunc)gcomp_nick_func);
|
||||
tmp_list = userlist_double_list(sess); /* create a temp list so we can free the memory */
|
||||
if (prefs.completion_sort == 1) /* sort in last-talk order? */
|
||||
if (prefs.hex_completion_sort == 1) /* sort in last-talk order? */
|
||||
tmp_list = g_list_sort (tmp_list, (void *)talked_recent_cmp);
|
||||
}
|
||||
else
|
||||
@ -1595,7 +1595,7 @@ key_action_tab_comp (GtkWidget *t, GdkEventKey *entry, char *d1, char *d2,
|
||||
old_gcomp.elen = elen;
|
||||
|
||||
/* Get the first nick and put out the data for future nickcompletes */
|
||||
if (prefs.completion_amount && g_list_length (list) <= prefs.completion_amount)
|
||||
if (prefs.hex_completion_amount && g_list_length (list) <= prefs.hex_completion_amount)
|
||||
{
|
||||
g_free(result);
|
||||
result = (char*)list->data;
|
||||
@ -1658,7 +1658,7 @@ key_action_tab_comp (GtkWidget *t, GdkEventKey *entry, char *d1, char *d2,
|
||||
g_utf8_strncpy(buf, text, prefix_len);
|
||||
strncat (buf, result, COMP_BUF - (prefix_len + 3)); /* make sure nicksuffix and space fits */
|
||||
if(!prefix_len && is_nick)
|
||||
strcat (buf, &prefs.nick_suffix[0]);
|
||||
strcat (buf, &prefs.hex_completion_suffix[0]);
|
||||
strcat (buf, " ");
|
||||
cursor_pos = strlen (buf);
|
||||
if (postfix)
|
||||
|
@ -224,10 +224,10 @@ static const setting inputbox_settings[] =
|
||||
#endif
|
||||
|
||||
{ST_HEADER, N_("Nick Completion"),0,0,0},
|
||||
{ST_TOGGLE, N_("Automatic nick completion (without TAB key)"), P_OFFINTNL(nickcompletion),
|
||||
{ST_TOGGLE, N_("Automatic nick completion (without TAB key)"), P_OFFINTNL(hex_completion_auto),
|
||||
0,0,0},
|
||||
{ST_ENTRY, N_("Nick completion suffix:"), P_OFFSETNL(nick_suffix),0,0,sizeof prefs.nick_suffix},
|
||||
{ST_MENU, N_("Nick completion sorted:"), P_OFFINTNL(completion_sort), 0, tabcompmenu, 0},
|
||||
{ST_ENTRY, N_("Nick completion suffix:"), P_OFFSETNL(hex_completion_suffix),0,0,sizeof prefs.hex_completion_suffix},
|
||||
{ST_MENU, N_("Nick completion sorted:"), P_OFFINTNL(hex_completion_sort), 0, tabcompmenu, 0},
|
||||
|
||||
#if 0 /* obsolete */
|
||||
{ST_HEADER, N_("Input Box Codes"),0,0,0},
|
||||
|
Loading…
Reference in New Issue
Block a user