Variable cleanup for dcc_*

This commit is contained in:
Berke Viktor 2012-10-22 12:10:55 +02:00
parent cf8ea26498
commit b563b93414
9 changed files with 136 additions and 134 deletions

View File

@ -388,7 +388,8 @@ default_file (void)
/* Keep these sorted!! */
const struct prefs vars[] = {
const struct prefs vars[] =
{
{"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},
@ -403,31 +404,31 @@ const struct prefs vars[] = {
{"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},
{"dcc_auto_send", P_OFFINT (autodccsend), TYPE_INT},
{"dcc_blocksize", P_OFFINT (dcc_blocksize), TYPE_INT},
{"dcc_completed_dir", P_OFFSET (dcc_completed_dir), TYPE_STR},
{"dcc_dir", P_OFFSET (dccdir), TYPE_STR},
{"dcc_auto_chat", P_OFFINT (hex_dcc_auto_chat), TYPE_BOOL},
{"dcc_auto_recv", P_OFFINT (hex_dcc_auto_recv), TYPE_INT},
{"dcc_auto_resume", P_OFFINT (hex_dcc_auto_resume), TYPE_BOOL},
{"dcc_blocksize", P_OFFINT (hex_dcc_blocksize), TYPE_INT},
{"dcc_completed_dir", P_OFFSET (hex_dcc_completed_dir), TYPE_STR},
{"dcc_dir", P_OFFSET (hex_dcc_dir), TYPE_STR},
#ifndef WIN32
{"dcc_fast_send", P_OFFINT (fastdccsend), TYPE_BOOL},
{"dcc_fast_send", P_OFFINT (hex_dcc_fast_send), TYPE_BOOL},
#endif
{"dcc_global_max_get_cps", P_OFFINT (dcc_global_max_get_cps), TYPE_INT},
{"dcc_global_max_send_cps", P_OFFINT (dcc_global_max_send_cps), TYPE_INT},
{"dcc_ip", P_OFFSET (dcc_ip_str), TYPE_STR},
{"dcc_ip_from_server", P_OFFINT (ip_from_server), TYPE_BOOL},
{"dcc_max_get_cps", P_OFFINT (dcc_max_get_cps), TYPE_INT},
{"dcc_max_send_cps", P_OFFINT (dcc_max_send_cps), TYPE_INT},
{"dcc_permissions", P_OFFINT (dccpermissions), TYPE_INT},
{"dcc_port_first", P_OFFINT (first_dcc_send_port), TYPE_INT},
{"dcc_port_last", P_OFFINT (last_dcc_send_port), TYPE_INT},
{"dcc_remove", P_OFFINT (dcc_remove), TYPE_BOOL},
{"dcc_save_nick", P_OFFINT (dccwithnick), TYPE_BOOL},
{"dcc_send_fillspaces", P_OFFINT (dcc_send_fillspaces), TYPE_BOOL},
{"dcc_stall_timeout", P_OFFINT (dccstalltimeout), TYPE_INT},
{"dcc_timeout", P_OFFINT (dcctimeout), TYPE_INT},
{"dcc_global_max_get_cps", P_OFFINT (hex_dcc_global_max_get_cps), TYPE_INT},
{"dcc_global_max_send_cps", P_OFFINT (hex_dcc_global_max_send_cps), TYPE_INT},
{"dcc_ip", P_OFFSET (hex_dcc_ip), TYPE_STR},
{"dcc_ip_from_server", P_OFFINT (hex_dcc_ip_from_server), TYPE_BOOL},
{"dcc_max_get_cps", P_OFFINT (hex_dcc_max_get_cps), TYPE_INT},
{"dcc_max_send_cps", P_OFFINT (hex_dcc_max_send_cps), TYPE_INT},
{"dcc_permissions", P_OFFINT (hex_dcc_permissions), TYPE_INT},
{"dcc_port_first", P_OFFINT (hex_dcc_port_first), TYPE_INT},
{"dcc_port_last", P_OFFINT (hex_dcc_port_last), TYPE_INT},
{"dcc_remove", P_OFFINT (hex_dcc_remove), TYPE_BOOL},
{"dcc_save_nick", P_OFFINT (hex_dcc_save_nick), TYPE_BOOL},
{"dcc_send_fillspaces", P_OFFINT (hex_dcc_send_fillspaces), TYPE_BOOL},
{"dcc_stall_timeout", P_OFFINT (hex_dcc_stall_timeout), TYPE_INT},
{"dcc_timeout", P_OFFINT (hex_dcc_timeout), TYPE_INT},
{"dnsprogram", P_OFFSET (dnsprogram), TYPE_STR},
{"dnsprogram", P_OFFSET (hex_dnsprogram), TYPE_STR},
{"flood_ctcp_num", P_OFFINT (ctcp_number_limit), TYPE_INT},
{"flood_ctcp_time", P_OFFINT (ctcp_time_limit), TYPE_INT},
@ -664,13 +665,13 @@ load_config (void)
prefs.hex_away_track = 1;
prefs.timestamp_logs = 1;
prefs.truncchans = 20;
prefs.autoresume = 1;
prefs.hex_dcc_auto_resume = 1;
prefs.hex_away_show_once = 1;
prefs.indent_nicks = 1;
prefs.thin_separator = 1;
prefs.identd = 1;
#ifndef WIN32
prefs.fastdccsend = 1;
prefs.hex_dcc_fast_send = 1;
#endif
prefs.wordwrap = 1;
prefs.autodialog = 1;
@ -693,7 +694,7 @@ load_config (void)
/* prefs.colorednicks = 1; */
prefs.style_inputbox = 1;
prefs.style_namelistgad = 1;
prefs.dccpermissions = 0600;
prefs.hex_dcc_permissions = 0600;
prefs.max_lines = 500;
prefs.mainwindow_width = 640;
prefs.mainwindow_height = 400;
@ -701,8 +702,8 @@ load_config (void)
prefs.dialog_height = 256;
prefs.gui_join_dialog = 1;
prefs.gui_quit_dialog = 1;
prefs.dcctimeout = 180;
prefs.dccstalltimeout = 60;
prefs.hex_dcc_timeout = 180;
prefs.hex_dcc_stall_timeout = 60;
prefs.notify_timeout = 15;
prefs.tint_red =
prefs.tint_green =
@ -710,7 +711,7 @@ load_config (void)
prefs.auto_indent = 1;
prefs.max_auto_indent = 256;
prefs.show_separator = 1;
prefs.dcc_blocksize = 1024;
prefs.hex_dcc_blocksize = 1024;
prefs.throttle = 1;
/*FIXME*/ prefs.msg_time_limit = 30;
prefs.msg_number_limit = 5;
@ -739,7 +740,7 @@ load_config (void)
prefs.input_balloon_time = 20;
prefs.input_flash_priv = prefs.input_flash_hilight = 1;
prefs.input_tray_priv = prefs.input_tray_hilight = 1;
prefs.autodccsend = 2; /* browse mode */
prefs.hex_dcc_auto_recv = 2; /* browse mode */
prefs.url_grabber = 1;
prefs.url_grabber_limit = 100; /* 0 means unlimited */
prefs.text_search_follow = 1;
@ -764,16 +765,16 @@ load_config (void)
if (portable_mode () || !get_reg_str ("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Personal", out, sizeof (out)))
{
snprintf (prefs.dccdir, sizeof (prefs.dccdir), "%s\\downloads", get_xdir_utf8 ());
snprintf (prefs.hex_dcc_dir, sizeof (prefs.hex_dcc_dir), "%s\\downloads", get_xdir_utf8 ());
}
else
{
snprintf (prefs.dccdir, sizeof (prefs.dccdir), "%s\\Downloads", out);
snprintf (prefs.hex_dcc_dir, sizeof (prefs.hex_dcc_dir), "%s\\Downloads", out);
}
}
#else
snprintf (prefs.sounddir, sizeof (prefs.sounddir), "%s/sounds", get_xdir_utf8 ());
snprintf (prefs.dccdir, sizeof (prefs.dccdir), "%s/downloads", get_xdir_utf8 ());
snprintf (prefs.hex_dcc_dir, sizeof (prefs.hex_dcc_dir), "%s/downloads", get_xdir_utf8 ());
#endif
strcpy (prefs.doubleclickuser, "QUOTE WHOIS %s %s");
strcpy (prefs.hex_away_reason, _("I'm busy"));
@ -782,7 +783,7 @@ load_config (void)
strcpy (prefs.font_normal, DEF_FONT);
strcpy (prefs.font_main, DEF_FONT);
strcpy (prefs.font_alternative, DEF_FONT_ALTER);
strcpy (prefs.dnsprogram, "host");
strcpy (prefs.hex_dnsprogram, "host");
strcpy (prefs.irc_no_hilight, "NickServ,ChanServ,InfoServ,N,Q");
g_free ((char *)username);
@ -831,8 +832,8 @@ load_config (void)
#endif
#endif /* !WIN32 */
mkdir_utf8 (prefs.dccdir);
mkdir_utf8 (prefs.dcc_completed_dir);
mkdir_utf8 (prefs.hex_dcc_dir);
mkdir_utf8 (prefs.hex_dcc_completed_dir);
}
if (prefs.mainwindow_height < 138)
prefs.mainwindow_height = 138;

View File

@ -143,14 +143,14 @@ dcc_calc_cps (struct DCC *dcc)
pos = dcc->pos - ((dcc->pos - dcc->ack) / 2);
glob_throttle_bit = 0x1;
cpssum = &dcc_sendcpssum;
glob_limit = prefs.dcc_global_max_send_cps;
glob_limit = prefs.hex_dcc_global_max_send_cps;
}
else
{
pos = dcc->pos;
glob_throttle_bit = 0x2;
cpssum = &dcc_getcpssum;
glob_limit = prefs.dcc_global_max_get_cps;
glob_limit = prefs.hex_dcc_global_max_get_cps;
}
if (!dcc->firstcpstv.tv_sec && !dcc->firstcpstv.tv_usec)
@ -249,10 +249,10 @@ dcc_check_timeouts (void)
if (dcc->type == TYPE_SEND || dcc->type == TYPE_RECV)
{
if (prefs.dccstalltimeout > 0)
if (prefs.hex_dcc_stall_timeout > 0)
{
if (!dcc->throttled
&& tim - dcc->lasttime > prefs.dccstalltimeout)
&& tim - dcc->lasttime > prefs.hex_dcc_stall_timeout)
{
EMIT_SIGNAL (XP_TE_DCCSTALL, dcc->serv->front_session,
dcctypes[dcc->type],
@ -265,9 +265,9 @@ dcc_check_timeouts (void)
case STAT_QUEUED:
if (dcc->type == TYPE_SEND || dcc->type == TYPE_CHATSEND)
{
if (tim - dcc->offertime > prefs.dcctimeout)
if (tim - dcc->offertime > prefs.hex_dcc_timeout)
{
if (prefs.dcctimeout > 0)
if (prefs.hex_dcc_timeout > 0)
{
EMIT_SIGNAL (XP_TE_DCCTOUT, dcc->serv->front_session,
dcctypes[dcc->type],
@ -280,7 +280,7 @@ dcc_check_timeouts (void)
case STAT_DONE:
case STAT_FAILED:
case STAT_ABORTED:
if (prefs.dcc_remove)
if (prefs.hex_dcc_remove)
dcc_close (dcc, 0, TRUE);
break;
}
@ -389,9 +389,9 @@ dcc_close (struct DCC *dcc, int dccstat, int destroy)
if(dcc->type == TYPE_RECV)
{
/* mgl: change this to use destfile_fs for correctness and to */
/* handle the case where dccwithnick is set */
move_file_utf8 (prefs.dccdir, prefs.dcc_completed_dir,
file_part (dcc->destfile), prefs.dccpermissions);
/* handle the case where hex_dcc_save_nick is set */
move_file_utf8 (prefs.hex_dcc_dir, prefs.hex_dcc_completed_dir,
file_part (dcc->destfile), prefs.hex_dcc_permissions);
}
}
@ -687,7 +687,7 @@ dcc_read (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
{
/* try to create the download dir (even if it exists, no harm) */
mkdir_utf8 (prefs.dccdir);
mkdir_utf8 (prefs.hex_dcc_dir);
if (dcc->resumable)
{
@ -718,7 +718,7 @@ dcc_read (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
}
dcc->fp =
open (dcc->destfile_fs, OFLAGS | O_TRUNC | O_WRONLY | O_CREAT,
prefs.dccpermissions);
prefs.hex_dcc_permissions);
}
}
if (dcc->fp == -1)
@ -874,7 +874,7 @@ dcc_connect_finished (GIOChannel *source, GIOCondition condition, struct DCC *dc
break;
case TYPE_SEND:
/* passive send */
dcc->fastsend = prefs.fastdccsend;
dcc->fastsend = prefs.hex_dcc_fast_send;
if (dcc->fastsend)
dcc->wiotag = fe_input_add (dcc->sok, FIA_WRITE, dcc_send_data, dcc);
dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX, dcc_read_ack, dcc);
@ -1441,11 +1441,11 @@ dcc_send_data (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
char *buf;
int len, sent, sok = dcc->sok;
if (prefs.dcc_blocksize < 1) /* this is too little! */
prefs.dcc_blocksize = 1024;
if (prefs.hex_dcc_blocksize < 1) /* this is too little! */
prefs.hex_dcc_blocksize = 1024;
if (prefs.dcc_blocksize > 102400) /* this is too much! */
prefs.dcc_blocksize = 102400;
if (prefs.hex_dcc_blocksize > 102400) /* this is too much! */
prefs.hex_dcc_blocksize = 102400;
if (dcc->throttled)
{
@ -1462,12 +1462,12 @@ dcc_send_data (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
else if (!dcc->wiotag)
dcc->wiotag = fe_input_add (sok, FIA_WRITE, dcc_send_data, dcc);
buf = malloc (prefs.dcc_blocksize);
buf = malloc (prefs.hex_dcc_blocksize);
if (!buf)
return TRUE;
lseek (dcc->fp, dcc->pos, SEEK_SET);
len = read (dcc->fp, buf, prefs.dcc_blocksize);
len = read (dcc->fp, buf, prefs.hex_dcc_blocksize);
if (len < 1)
goto abortit;
sent = send (sok, buf, len, 0);
@ -1612,7 +1612,7 @@ dcc_accept (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
dcc->dccstat = STAT_ACTIVE;
dcc->lasttime = dcc->starttime = time (0);
dcc->fastsend = prefs.fastdccsend;
dcc->fastsend = prefs.hex_dcc_fast_send;
snprintf (host, sizeof (host), "%s:%d", net_ip (dcc->addr), dcc->port);
@ -1648,11 +1648,11 @@ dcc_get_my_address (void) /* the address we'll tell the other person */
struct hostent *dns_query;
guint32 addr = 0;
if (prefs.ip_from_server && prefs.dcc_ip)
if (prefs.hex_dcc_ip_from_server && prefs.dcc_ip)
addr = prefs.dcc_ip;
else if (prefs.dcc_ip_str[0])
else if (prefs.hex_dcc_ip[0])
{
dns_query = gethostbyname ((const char *) prefs.dcc_ip_str);
dns_query = gethostbyname ((const char *) prefs.hex_dcc_ip);
if (dns_query != NULL &&
dns_query->h_length == 4 &&
@ -1696,14 +1696,14 @@ dcc_listen_init (struct DCC *dcc, session *sess)
my_addr = SAddr.sin_addr.s_addr;
/*if we have a valid portrange try to use that*/
if (prefs.first_dcc_send_port > 0)
if (prefs.hex_dcc_port_first > 0)
{
SAddr.sin_port = 0;
i = 0;
while ((prefs.last_dcc_send_port > ntohs(SAddr.sin_port)) &&
while ((prefs.hex_dcc_port_last > ntohs(SAddr.sin_port)) &&
(bindretval == -1))
{
SAddr.sin_port = htons (prefs.first_dcc_send_port + i);
SAddr.sin_port = htons (prefs.hex_dcc_port_first + i);
i++;
/*printf("Trying to bind against port: %d\n",ntohs(SAddr.sin_port));*/
bindretval = bind (dcc->sok, (struct sockaddr *) &SAddr, sizeof (SAddr));
@ -1733,7 +1733,7 @@ dcc_listen_init (struct DCC *dcc, session *sess)
dcc->port = ntohs (SAddr.sin_port);
/*if we have a dcc_ip, we use that, so the remote client can connect*/
/*else we try to take an address from dcc_ip_str*/
/*else we try to take an address from hex_dcc_ip*/
/*if something goes wrong we tell the client to connect to our LAN ip*/
dcc->addr = dcc_get_my_address ();
@ -1847,7 +1847,7 @@ dcc_send (struct session *sess, char *to, char *file, int maxcps, int passive)
{
if (*file == ' ')
{
if (prefs.dcc_send_fillspaces)
if (prefs.hex_dcc_send_fillspaces)
*file = '_';
else
havespaces = 1;
@ -2074,7 +2074,7 @@ dcc_get (struct DCC *dcc)
case STAT_QUEUED:
if (dcc->type != TYPE_CHATSEND)
{
if (dcc->type == TYPE_RECV && prefs.autoresume && dcc->resumable)
if (dcc->type == TYPE_RECV && prefs.hex_dcc_auto_resume && dcc->resumable)
{
dcc_resume (dcc);
}
@ -2307,9 +2307,11 @@ dcc_add_chat (session *sess, char *nick, int port, guint32 addr, int pasvid)
} else
fe_dcc_add (dcc);
if (prefs.autodccchat == 1)
if (prefs.hex_dcc_auto_chat)
{
dcc_connect (dcc);
else if (prefs.autodccchat == 2)
}
else
{
char buff[128];
snprintf (buff, sizeof (buff), "%s is offering DCC Chat. Do you want to accept?", nick);
@ -2331,13 +2333,13 @@ dcc_add_file (session *sess, char *file, DCC_SIZE size, int port, char *nick, gu
{
dcc->file = strdup (file);
dcc->destfile = g_malloc (strlen (prefs.dccdir) + strlen (nick) +
dcc->destfile = g_malloc (strlen (prefs.hex_dcc_dir) + strlen (nick) +
strlen (file) + 4);
strcpy (dcc->destfile, prefs.dccdir);
if (prefs.dccdir[strlen (prefs.dccdir) - 1] != '/')
strcpy (dcc->destfile, prefs.hex_dcc_dir);
if (prefs.hex_dcc_dir[strlen (prefs.hex_dcc_dir) - 1] != '/')
strcat (dcc->destfile, "/");
if (prefs.dccwithnick)
if (prefs.hex_dcc_save_nick)
{
#ifdef WIN32
char *t = strlen (dcc->destfile) + dcc->destfile;
@ -2368,21 +2370,19 @@ dcc_add_file (session *sess, char *file, DCC_SIZE size, int port, char *nick, gu
dcc->pasvid = pasvid;
dcc->size = size;
dcc->nick = strdup (nick);
dcc->maxcps = prefs.dcc_max_get_cps;
dcc->maxcps = prefs.hex_dcc_max_get_cps;
is_resumable (dcc);
/* autodccsend is really autodccrecv.. right? */
if (prefs.autodccsend == 1)
{
dcc_get (dcc);
}
else if (prefs.autodccsend == 2)
if (prefs.hex_dcc_auto_recv == 1)
{
snprintf (tbuf, sizeof (tbuf), _("%s is offering \"%s\". Do you want to accept?"), nick, file);
fe_confirm (tbuf, dcc_confirm_send, dcc_deny_send, dcc);
}
else if (prefs.hex_dcc_auto_recv == 2)
{
dcc_get (dcc);
}
if (prefs.autoopendccrecvwindow)
{
if (fe_dcc_open_recv_win (TRUE)) /* was already open? just add*/

View File

@ -1109,7 +1109,7 @@ do_dns (session *sess, char *nick, char *host)
if (po)
host = po + 1;
EMIT_SIGNAL (XP_TE_RESOLVINGUSER, sess, nick, host, NULL, NULL, 0);
snprintf (tbuf, sizeof (tbuf), "exec -d %s %s", prefs.dnsprogram, host);
snprintf (tbuf, sizeof (tbuf), "exec -d %s %s", prefs.hex_dnsprogram, host);
handle_command (sess, tbuf, FALSE);
}
@ -1301,7 +1301,7 @@ inbound_login_end (session *sess, char *text)
if (!serv->end_of_motd)
{
if (prefs.ip_from_server && serv->use_who)
if (prefs.hex_dcc_ip_from_server && serv->use_who)
{
serv->skip_next_userhost = TRUE;
serv->p_get_ip_uh (serv, serv->nick); /* sends USERHOST mynick */

View File

@ -865,7 +865,7 @@ cmd_dcc (struct session *sess, char *tbuf, char *word[], char *word_eol[])
if (!*nick)
return FALSE;
maxcps = prefs.dcc_max_send_cps;
maxcps = prefs.hex_dcc_max_send_cps;
if (!g_ascii_strncasecmp(nick, "-maxcps=", 8))
{
maxcps = atoi(nick + 8);
@ -1450,7 +1450,7 @@ cmd_dns (struct session *sess, char *tbuf, char *word[], char *word_eol[])
}
} else
{
snprintf (tbuf, TBUFSIZE, "exec -d %s %s", prefs.dnsprogram, nick);
snprintf (tbuf, TBUFSIZE, "exec -d %s %s", prefs.hex_dnsprogram, nick);
handle_command (sess, tbuf, FALSE);
}
return TRUE;

View File

@ -471,7 +471,7 @@ process_numeric (session * sess, int n,
(strrchr(word[10], '@') != NULL))
{
serv->use_who = FALSE;
if (prefs.ip_from_server)
if (prefs.hex_dcc_ip_from_server)
inbound_foundip (sess, strrchr(word[10], '@')+1);
}

View File

@ -105,13 +105,29 @@ struct nbexec
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. */
char hex_dcc_completed_dir[PATHLEN + 1];
char hex_dcc_dir[PATHLEN + 1];
char hex_dcc_ip[DOMAINLEN + 1];
char hex_dnsprogram[72];
int hex_away_size_max;
int hex_away_timeout;
int hex_completion_amount;
int hex_completion_sort;
int hex_dcc_auto_recv;
int hex_dcc_blocksize;
int hex_dcc_global_max_get_cps;
int hex_dcc_global_max_send_cps;
int hex_dcc_max_get_cps;
int hex_dcc_max_send_cps;
int hex_dcc_permissions;
int hex_dcc_port_first;
int hex_dcc_port_last;
int hex_dcc_stall_timeout;
int hex_dcc_timeout;
unsigned int hex_away_auto_unmark;
unsigned int hex_away_omit_alerts;
@ -119,8 +135,16 @@ struct hexchatprefs
unsigned int hex_away_show_once;
unsigned int hex_away_track;
unsigned int hex_completion_auto;
unsigned int hex_dcc_auto_chat;
unsigned int hex_dcc_auto_resume;
unsigned int hex_dcc_fast_send;
unsigned int hex_dcc_ip_from_server;
unsigned int hex_dcc_remove;
unsigned int hex_dcc_save_nick;
unsigned int hex_dcc_send_fillspaces;
/* these are the legacy variables */
char nick1[NICKLEN];
char nick2[NICKLEN];
char nick3[NICKLEN];
@ -136,12 +160,9 @@ struct hexchatprefs
char sounddir[PATHLEN + 1];
char soundcmd[PATHLEN + 1];
char background[PATHLEN + 1];
char dccdir[PATHLEN + 1];
char dcc_completed_dir[PATHLEN + 1];
char irc_extra_hilight[300];
char irc_no_hilight[300];
char irc_nick_hilight[300];
char dnsprogram[72];
char hostname[127];
char cmdchar[4];
char logmask[256];
@ -158,9 +179,6 @@ struct hexchatprefs
char proxy_user[32];
char proxy_pass[32];
int first_dcc_send_port;
int last_dcc_send_port;
int tint_red;
int tint_green;
int tint_blue;
@ -176,15 +194,8 @@ struct hexchatprefs
int tab_layout;
int max_auto_indent;
int dcc_blocksize;
int max_lines;
int notify_timeout;
int dcctimeout;
int dccstalltimeout;
int dcc_global_max_get_cps;
int dcc_global_max_send_cps;
int dcc_max_get_cps;
int dcc_max_send_cps;
int mainwindow_left;
int mainwindow_top;
int mainwindow_width;
@ -196,13 +207,11 @@ struct hexchatprefs
int dialog_top;
int dialog_width;
int dialog_height;
int dccpermissions;
int recon_delay;
int bantype;
int userlist_sort;
guint32 local_ip;
guint32 dcc_ip;
char dcc_ip_str[DOMAINLEN + 1];
unsigned int tab_small;
unsigned int tab_icons;
@ -227,9 +236,6 @@ struct hexchatprefs
unsigned int showhostname_in_userlist;
unsigned int tabchannels;
unsigned int paned_userlist;
unsigned int autodccchat;
unsigned int autodccsend;
unsigned int autoresume;
unsigned int autoopendccsendwindow;
unsigned int autoopendccrecvwindow;
unsigned int autoopendccchatwindow;
@ -238,9 +244,6 @@ struct hexchatprefs
unsigned int text_stripcolor_replay;
unsigned int text_stripcolor_topic;
unsigned int timestamp;
unsigned int fastdccsend;
unsigned int dcc_send_fillspaces;
unsigned int dcc_remove;
unsigned int slist_fav;
unsigned int slist_skip;
unsigned int slist_select;
@ -269,9 +272,7 @@ struct hexchatprefs
unsigned int logging;
unsigned int timestamp_logs;
unsigned int newtabstofront;
unsigned int dccwithnick;
unsigned int hidever;
unsigned int ip_from_server;
unsigned int raw_modes;
unsigned int userhost;
unsigned int irc_whois_front;

View File

@ -165,7 +165,7 @@ fe_dcc_send_filereq (struct session *sess, char *nick, int maxcps, int passive)
mdc->passive = passive;
snprintf (tbuf, sizeof tbuf, _("Send file to %s"), nick);
gtkutil_file_req (tbuf, dcc_send_filereq_file, mdc, prefs.dccdir, NULL, FRF_MULTIPLE|FRF_FILTERISINITIAL);
gtkutil_file_req (tbuf, dcc_send_filereq_file, mdc, prefs.hex_dcc_dir, NULL, FRF_MULTIPLE|FRF_FILTERISINITIAL);
}
static void
@ -562,10 +562,10 @@ browse_folder (char *dir)
static void
browse_dcc_folder (void)
{
if (prefs.dcc_completed_dir[0])
browse_folder (prefs.dcc_completed_dir);
if (prefs.hex_dcc_completed_dir[0])
browse_folder (prefs.hex_dcc_completed_dir);
else
browse_folder (prefs.dccdir);
browse_folder (prefs.hex_dcc_dir);
}
static void

View File

@ -1697,7 +1697,7 @@ mg_dnd_drop_file (session *sess, char *target, char *uri)
p = xchat_filename_to_utf8 (fname, -1, 0, 0, 0);
if (p)
{
dcc_send (sess, target, p, prefs.dcc_max_send_cps, 0);
dcc_send (sess, target, p, prefs.hex_dcc_max_send_cps, 0);
g_free (p);
}
g_free (fname);

View File

@ -363,37 +363,37 @@ static const setting color_settings[] =
static const char *const dccaccept[] =
{
N_("No"),
N_("Yes"),
N_("Browse for save folder every time"),
N_("Ask for confirmation"),
N_("Ask for download folder"),
N_("Save without interaction"),
NULL
};
static const setting filexfer_settings[] =
{
{ST_HEADER, N_("Files and Directories"), 0, 0, 0},
{ST_MENU, N_("Auto accept file offers:"), P_OFFINTNL(autodccsend), 0, dccaccept, 0},
{ST_EFOLDER,N_("Download files to:"), P_OFFSETNL(dccdir), 0, 0, sizeof prefs.dccdir},
{ST_EFOLDER,N_("Move completed files to:"), P_OFFSETNL(dcc_completed_dir), 0, 0, sizeof prefs.dcc_completed_dir},
{ST_TOGGLE, N_("Save nick name in filenames"), P_OFFINTNL(dccwithnick), 0, 0, 0},
{ST_MENU, N_("Auto accept file offers:"), P_OFFINTNL(hex_dcc_auto_recv), 0, dccaccept, 0},
{ST_EFOLDER,N_("Download files to:"), P_OFFSETNL(hex_dcc_dir), 0, 0, sizeof prefs.hex_dcc_dir},
{ST_EFOLDER,N_("Move completed files to:"), P_OFFSETNL(hex_dcc_completed_dir), 0, 0, sizeof prefs.hex_dcc_completed_dir},
{ST_TOGGLE, N_("Save nick name in filenames"), P_OFFINTNL(hex_dcc_save_nick), 0, 0, 0},
{ST_HEADER, N_("Network Settings"), 0, 0, 0},
{ST_TOGGLE, N_("Get my address from the IRC server"), P_OFFINTNL(ip_from_server),
{ST_TOGGLE, N_("Get my address from the IRC server"), P_OFFINTNL(hex_dcc_ip_from_server),
N_("Asks the IRC server for your real address. Use this if you have a 192.168.*.* address!"), 0, 0},
{ST_ENTRY, N_("DCC IP address:"), P_OFFSETNL(dcc_ip_str),
N_("Claim you are at this address when offering files."), 0, sizeof prefs.dcc_ip_str},
{ST_NUMBER, N_("First DCC send port:"), P_OFFINTNL(first_dcc_send_port), 0, 0, 65535},
{ST_NUMBER, N_("Last DCC send port:"), P_OFFINTNL(last_dcc_send_port), 0,
{ST_ENTRY, N_("DCC IP address:"), P_OFFSETNL(hex_dcc_ip),
N_("Claim you are at this address when offering files."), 0, sizeof prefs.hex_dcc_ip},
{ST_NUMBER, N_("First DCC send port:"), P_OFFINTNL(hex_dcc_port_first), 0, 0, 65535},
{ST_NUMBER, N_("Last DCC send port:"), P_OFFINTNL(hex_dcc_port_last), 0,
(const char **)N_("!Leave ports at zero for full range."), 65535},
{ST_HEADER, N_("Maximum File Transfer Speeds (bytes per second)"), 0, 0, 0},
{ST_NUMBER, N_("One upload:"), P_OFFINTNL(dcc_max_send_cps),
{ST_NUMBER, N_("One upload:"), P_OFFINTNL(hex_dcc_max_send_cps),
N_("Maximum speed for one transfer"), 0, 1000000},
{ST_NUMBER, N_("One download:"), P_OFFINTNL(dcc_max_get_cps),
{ST_NUMBER, N_("One download:"), P_OFFINTNL(hex_dcc_max_get_cps),
N_("Maximum speed for one transfer"), 0, 1000000},
{ST_NUMBER, N_("All uploads combined:"), P_OFFINTNL(dcc_global_max_send_cps),
{ST_NUMBER, N_("All uploads combined:"), P_OFFINTNL(hex_dcc_global_max_send_cps),
N_("Maximum speed for all files"), 0, 1000000},
{ST_NUMBER, N_("All downloads combined:"), P_OFFINTNL(dcc_global_max_get_cps),
{ST_NUMBER, N_("All downloads combined:"), P_OFFINTNL(hex_dcc_global_max_get_cps),
N_("Maximum speed for all files"), 0, 1000000},
{ST_END, 0, 0, 0, 0, 0}
@ -2134,11 +2134,11 @@ setup_apply_real (int new_pix, int do_ulist, int do_layout)
int done_main = FALSE;
/* remove trailing slashes */
unslash (prefs.dccdir);
unslash (prefs.dcc_completed_dir);
unslash (prefs.hex_dcc_dir);
unslash (prefs.hex_dcc_completed_dir);
mkdir_utf8 (prefs.dccdir);
mkdir_utf8 (prefs.dcc_completed_dir);
mkdir_utf8 (prefs.hex_dcc_dir);
mkdir_utf8 (prefs.hex_dcc_completed_dir);
if (new_pix)
{
@ -2277,9 +2277,9 @@ setup_apply (struct hexchatprefs *pr)
" restart to take full effect."), FE_MSG_WARN);
#ifndef WIN32
if (prefs.autodccsend == 1)
if (prefs.hex_dcc_auto_recv)
{
if (!strcmp ((char *)g_get_home_dir (), prefs.dccdir))
if (!strcmp ((char *)g_get_home_dir (), prefs.hex_dcc_dir))
{
fe_message (_("*WARNING*\n"
"Auto accepting DCC to your home directory\n"