mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-12 16:50:19 +00:00
Fix building as c89
This commit is contained in:
@@ -220,7 +220,7 @@ cfg_put_str (int fh, char *var, char *value)
|
||||
char buf[512];
|
||||
int len;
|
||||
|
||||
snprintf (buf, sizeof buf, "%s = %s\n", var, value);
|
||||
g_snprintf (buf, sizeof buf, "%s = %s\n", var, value);
|
||||
len = strlen (buf);
|
||||
return (write (fh, buf, len) == len);
|
||||
}
|
||||
@@ -231,7 +231,7 @@ cfg_put_color (int fh, int r, int g, int b, char *var)
|
||||
char buf[400];
|
||||
int len;
|
||||
|
||||
snprintf (buf, sizeof buf, "%s = %04x %04x %04x\n", var, r, g, b);
|
||||
g_snprintf (buf, sizeof buf, "%s = %04x %04x %04x\n", var, r, g, b);
|
||||
len = strlen (buf);
|
||||
return (write (fh, buf, len) == len);
|
||||
}
|
||||
@@ -245,7 +245,7 @@ cfg_put_int (int fh, int value, char *var)
|
||||
if (value == -1)
|
||||
value = 1;
|
||||
|
||||
snprintf (buf, sizeof buf, "%s = %d\n", var, value);
|
||||
g_snprintf (buf, sizeof buf, "%s = %d\n", var, value);
|
||||
len = strlen (buf);
|
||||
return (write (fh, buf, len) == len);
|
||||
}
|
||||
@@ -843,7 +843,7 @@ load_default_config(void)
|
||||
#ifdef WIN32
|
||||
if (portable_mode () || SHGetKnownFolderPath (&FOLDERID_Downloads, 0, NULL, &roaming_path_wide) != S_OK)
|
||||
{
|
||||
snprintf (prefs.hex_dcc_dir, sizeof (prefs.hex_dcc_dir), "%s\\downloads", get_xdir ());
|
||||
g_snprintf (prefs.hex_dcc_dir, sizeof (prefs.hex_dcc_dir), "%s\\downloads", get_xdir ());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -368,10 +368,10 @@ chanopt_save_one_channel (chanopt_in_memory *co, int fh)
|
||||
char buf[256];
|
||||
guint8 val;
|
||||
|
||||
snprintf (buf, sizeof (buf), "%s = %s\n", "network", co->network);
|
||||
g_snprintf (buf, sizeof (buf), "%s = %s\n", "network", co->network);
|
||||
write (fh, buf, strlen (buf));
|
||||
|
||||
snprintf (buf, sizeof (buf), "%s = %s\n", "channel", co->channel);
|
||||
g_snprintf (buf, sizeof (buf), "%s = %s\n", "channel", co->channel);
|
||||
write (fh, buf, strlen (buf));
|
||||
|
||||
i = 0;
|
||||
@@ -380,7 +380,7 @@ chanopt_save_one_channel (chanopt_in_memory *co, int fh)
|
||||
val = G_STRUCT_MEMBER (guint8, co, chanopt[i].offset);
|
||||
if (val != SET_DEFAULT)
|
||||
{
|
||||
snprintf (buf, sizeof (buf), "%s = %d\n", chanopt[i].name, val);
|
||||
g_snprintf (buf, sizeof (buf), "%s = %d\n", chanopt[i].name, val);
|
||||
write (fh, buf, strlen (buf));
|
||||
}
|
||||
i++;
|
||||
|
||||
@@ -139,10 +139,10 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip,
|
||||
if (!g_ascii_strcasecmp (msg, "VERSION") && !prefs.hex_irc_hide_version)
|
||||
{
|
||||
#ifdef WIN32
|
||||
snprintf (outbuf, sizeof (outbuf), "VERSION HexChat "PACKAGE_VERSION" [x%d] / %s",
|
||||
g_snprintf (outbuf, sizeof (outbuf), "VERSION HexChat "PACKAGE_VERSION" [x%d] / %s",
|
||||
get_cpu_arch (), get_sys_str (1));
|
||||
#else
|
||||
snprintf (outbuf, sizeof (outbuf), "VERSION HexChat "PACKAGE_VERSION" / %s",
|
||||
g_snprintf (outbuf, sizeof (outbuf), "VERSION HexChat "PACKAGE_VERSION" / %s",
|
||||
get_sys_str (1));
|
||||
#endif
|
||||
serv->p_nctcp (serv, nick, outbuf);
|
||||
|
||||
@@ -93,7 +93,7 @@ hexchat_remote (void)
|
||||
g_object_unref (dbus);
|
||||
|
||||
if (!hexchat_running) {
|
||||
//dbus_g_connection_unref (connection);
|
||||
/* dbus_g_connection_unref (connection); */
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -705,7 +705,7 @@ dcc_read (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
|
||||
do
|
||||
{
|
||||
n++;
|
||||
snprintf (buf, sizeof (buf), "%s.%d", dcc->destfile, n);
|
||||
g_snprintf (buf, sizeof (buf), "%s.%d", dcc->destfile, n);
|
||||
}
|
||||
while (g_access (buf, F_OK) == 0);
|
||||
|
||||
@@ -865,7 +865,7 @@ dcc_connect_finished (GIOChannel *source, GIOCondition condition, struct DCC *dc
|
||||
return TRUE;
|
||||
|
||||
dcc->dccstat = STAT_ACTIVE;
|
||||
snprintf (host, sizeof host, "%s:%d", net_ip (dcc->addr), dcc->port);
|
||||
g_snprintf (host, sizeof host, "%s:%d", net_ip (dcc->addr), dcc->port);
|
||||
|
||||
switch (dcc->type)
|
||||
{
|
||||
@@ -984,7 +984,7 @@ dcc_wingate_proxy_traverse (GIOChannel *source, GIOCondition condition, struct D
|
||||
struct proxy_state *proxy = dcc->proxy;
|
||||
if (proxy->phase == 0)
|
||||
{
|
||||
proxy->buffersize = snprintf ((char*) proxy->buffer, MAX_PROXY_BUFFER,
|
||||
proxy->buffersize = g_snprintf ((char*) proxy->buffer, MAX_PROXY_BUFFER,
|
||||
"%s %d\r\n", net_ip(dcc->addr),
|
||||
dcc->port);
|
||||
proxy->bufferused = 0;
|
||||
@@ -1282,16 +1282,16 @@ dcc_http_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DCC
|
||||
char auth_data2[68];
|
||||
int n, n2;
|
||||
|
||||
n = snprintf (buf, sizeof (buf), "CONNECT %s:%d HTTP/1.0\r\n",
|
||||
n = g_snprintf (buf, sizeof (buf), "CONNECT %s:%d HTTP/1.0\r\n",
|
||||
net_ip(dcc->addr), dcc->port);
|
||||
if (prefs.hex_net_proxy_auth)
|
||||
{
|
||||
n2 = snprintf (auth_data2, sizeof (auth_data2), "%s:%s",
|
||||
n2 = g_snprintf (auth_data2, sizeof (auth_data2), "%s:%s",
|
||||
prefs.hex_net_proxy_user, prefs.hex_net_proxy_pass);
|
||||
base64_encode (auth_data, auth_data2, n2);
|
||||
n += snprintf (buf+n, sizeof (buf)-n, "Proxy-Authorization: Basic %s\r\n", auth_data);
|
||||
n += g_snprintf (buf+n, sizeof (buf)-n, "Proxy-Authorization: Basic %s\r\n", auth_data);
|
||||
}
|
||||
n += snprintf (buf+n, sizeof (buf)-n, "\r\n");
|
||||
n += g_snprintf (buf+n, sizeof (buf)-n, "\r\n");
|
||||
proxy->buffersize = n;
|
||||
proxy->bufferused = 0;
|
||||
memcpy (proxy->buffer, buf, proxy->buffersize);
|
||||
@@ -1402,12 +1402,12 @@ dcc_connect (struct DCC *dcc)
|
||||
}
|
||||
/* possible problems with filenames containing spaces? */
|
||||
if (dcc->type == TYPE_RECV)
|
||||
snprintf (tbuf, sizeof (tbuf), strchr (dcc->file, ' ') ?
|
||||
g_snprintf (tbuf, sizeof (tbuf), strchr (dcc->file, ' ') ?
|
||||
"DCC SEND \"%s\" %u %d %" G_GUINT64_FORMAT " %d" :
|
||||
"DCC SEND %s %u %d %" G_GUINT64_FORMAT " %d", dcc->file,
|
||||
dcc->addr, dcc->port, dcc->size, dcc->pasvid);
|
||||
else
|
||||
snprintf (tbuf, sizeof (tbuf), "DCC CHAT chat %u %d %d",
|
||||
g_snprintf (tbuf, sizeof (tbuf), "DCC CHAT chat %u %d %d",
|
||||
dcc->addr, dcc->port, dcc->pasvid);
|
||||
dcc->serv->p_ctcp (dcc->serv, dcc->nick, tbuf);
|
||||
}
|
||||
@@ -1605,7 +1605,7 @@ dcc_accept (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
|
||||
dcc->lasttime = dcc->starttime = time (0);
|
||||
dcc->fastsend = prefs.hex_dcc_fast_send;
|
||||
|
||||
snprintf (host, sizeof (host), "%s:%d", net_ip (dcc->addr), dcc->port);
|
||||
g_snprintf (host, sizeof (host), "%s:%d", net_ip (dcc->addr), dcc->port);
|
||||
|
||||
switch (dcc->type)
|
||||
{
|
||||
@@ -1898,7 +1898,7 @@ dcc_send (struct session *sess, char *to, char *filename, gint64 maxcps, int pas
|
||||
if (passive)
|
||||
{
|
||||
dcc->pasvid = new_id();
|
||||
snprintf (outbuf, sizeof (outbuf), (havespaces) ?
|
||||
g_snprintf (outbuf, sizeof (outbuf), (havespaces) ?
|
||||
"DCC SEND \"%s\" 199 0 %" G_GUINT64_FORMAT " %d" :
|
||||
"DCC SEND %s 199 0 %" G_GUINT64_FORMAT " %d",
|
||||
file_part (dcc->file),
|
||||
@@ -1906,7 +1906,7 @@ dcc_send (struct session *sess, char *to, char *filename, gint64 maxcps, int pas
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf (outbuf, sizeof (outbuf), (havespaces) ?
|
||||
g_snprintf (outbuf, sizeof (outbuf), (havespaces) ?
|
||||
"DCC SEND \"%s\" %u %d %" G_GUINT64_FORMAT :
|
||||
"DCC SEND %s %u %d %" G_GUINT64_FORMAT,
|
||||
file_part (dcc->file), dcc->addr,
|
||||
@@ -2309,11 +2309,11 @@ dcc_chat (struct session *sess, char *nick, int passive)
|
||||
if (passive)
|
||||
{
|
||||
dcc->pasvid = new_id ();
|
||||
snprintf (outbuf, sizeof (outbuf), "DCC CHAT chat 199 %d %d",
|
||||
g_snprintf (outbuf, sizeof (outbuf), "DCC CHAT chat 199 %d %d",
|
||||
dcc->port, dcc->pasvid);
|
||||
} else
|
||||
{
|
||||
snprintf (outbuf, sizeof (outbuf), "DCC CHAT chat %u %d",
|
||||
g_snprintf (outbuf, sizeof (outbuf), "DCC CHAT chat %u %d",
|
||||
dcc->addr, dcc->port);
|
||||
}
|
||||
dcc->serv->p_ctcp (dcc->serv, nick, outbuf);
|
||||
@@ -2339,7 +2339,7 @@ dcc_resume (struct DCC *dcc)
|
||||
{
|
||||
dcc->resume_sent = 1;
|
||||
/* filename contains spaces? Quote them! */
|
||||
snprintf (tbuf, sizeof (tbuf) - 10, strchr (dcc->file, ' ') ?
|
||||
g_snprintf (tbuf, sizeof (tbuf) - 10, strchr (dcc->file, ' ') ?
|
||||
"DCC RESUME \"%s\" %d %" G_GUINT64_FORMAT :
|
||||
"DCC RESUME %s %d %" G_GUINT64_FORMAT,
|
||||
dcc->file, dcc->port, dcc->resumable);
|
||||
@@ -2416,7 +2416,7 @@ dcc_add_chat (session *sess, char *nick, int port, guint32 addr, int pasvid)
|
||||
else
|
||||
{
|
||||
char buff[128];
|
||||
snprintf (buff, sizeof (buff), "%s is offering DCC Chat. Do you want to accept?", nick);
|
||||
g_snprintf (buff, sizeof (buff), "%s is offering DCC Chat. Do you want to accept?", nick);
|
||||
fe_confirm (buff, dcc_confirm_chat, dcc_deny_chat, dcc);
|
||||
}
|
||||
}
|
||||
@@ -2475,7 +2475,7 @@ dcc_add_file (session *sess, char *file, guint64 size, int port, char *nick, gui
|
||||
|
||||
if (prefs.hex_dcc_auto_recv == 1)
|
||||
{
|
||||
snprintf (tbuf, sizeof (tbuf), _("%s is offering \"%s\". Do you want to accept?"), nick, file);
|
||||
g_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)
|
||||
@@ -2490,7 +2490,7 @@ dcc_add_file (session *sess, char *file, guint64 size, int port, char *nick, gui
|
||||
fe_dcc_add (dcc);
|
||||
}
|
||||
sprintf (tbuf, "%" G_GUINT64_FORMAT, size);
|
||||
snprintf (tbuf + 24, 300, "%s:%d", net_ip (addr), port);
|
||||
g_snprintf (tbuf + 24, 300, "%s:%d", net_ip (addr), port);
|
||||
EMIT_SIGNAL (XP_TE_DCCSENDOFFER, sess->server->front_session, nick,
|
||||
file, tbuf, tbuf + 24, 0);
|
||||
|
||||
@@ -2582,12 +2582,12 @@ handle_dcc (struct session *sess, char *nick, char *word[], char *word_eol[],
|
||||
|
||||
/* Checking if dcc is passive and if filename contains spaces */
|
||||
if (dcc->pasvid)
|
||||
snprintf (tbuf, sizeof (tbuf), strchr (file_part (dcc->file), ' ') ?
|
||||
g_snprintf (tbuf, sizeof (tbuf), strchr (file_part (dcc->file), ' ') ?
|
||||
"DCC ACCEPT \"%s\" %d %" G_GUINT64_FORMAT " %d" :
|
||||
"DCC ACCEPT %s %d %" G_GUINT64_FORMAT " %d",
|
||||
file_part (dcc->file), port, dcc->resumable, dcc->pasvid);
|
||||
else
|
||||
snprintf (tbuf, sizeof (tbuf), strchr (file_part (dcc->file), ' ') ?
|
||||
g_snprintf (tbuf, sizeof (tbuf), strchr (file_part (dcc->file), ' ') ?
|
||||
"DCC ACCEPT \"%s\" %d %" G_GUINT64_FORMAT :
|
||||
"DCC ACCEPT %s %d %" G_GUINT64_FORMAT,
|
||||
file_part (dcc->file), port, dcc->resumable);
|
||||
|
||||
@@ -280,7 +280,7 @@ lag_check (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf (tbuf, sizeof (tbuf), "LAG%lu", tim);
|
||||
g_snprintf (tbuf, sizeof (tbuf), "LAG%lu", tim);
|
||||
serv->p_ping (serv, "", tbuf);
|
||||
|
||||
if (!serv->lag_sent)
|
||||
@@ -821,7 +821,7 @@ xchat_init (void)
|
||||
notify_load ();
|
||||
ignore_load ();
|
||||
|
||||
snprintf (buf, sizeof (buf),
|
||||
g_snprintf (buf, sizeof (buf),
|
||||
"NAME %s~%s~\n" "CMD query %%s\n\n"\
|
||||
"NAME %s~%s~\n" "CMD send %%s\n\n"\
|
||||
"NAME %s~%s~\n" "CMD whois %%s %%s\n\n"\
|
||||
@@ -877,7 +877,7 @@ xchat_init (void)
|
||||
|
||||
list_loadconf ("popup.conf", &popup_list, buf);
|
||||
|
||||
snprintf (buf, sizeof (buf),
|
||||
g_snprintf (buf, sizeof (buf),
|
||||
"NAME %s\n" "CMD part\n\n"
|
||||
"NAME %s\n" "CMD getstr # join \"%s\"\n\n"
|
||||
"NAME %s\n" "CMD quote LINKS\n\n"
|
||||
@@ -891,7 +891,7 @@ xchat_init (void)
|
||||
_("Hide Version"));
|
||||
list_loadconf ("usermenu.conf", &usermenu_list, buf);
|
||||
|
||||
snprintf (buf, sizeof (buf),
|
||||
g_snprintf (buf, sizeof (buf),
|
||||
"NAME %s\n" "CMD op %%a\n\n"
|
||||
"NAME %s\n" "CMD deop %%a\n\n"
|
||||
"NAME %s\n" "CMD ban %%s\n\n"
|
||||
@@ -908,7 +908,7 @@ xchat_init (void)
|
||||
_("Dialog"));
|
||||
list_loadconf ("buttons.conf", &button_list, buf);
|
||||
|
||||
snprintf (buf, sizeof (buf),
|
||||
g_snprintf (buf, sizeof (buf),
|
||||
"NAME %s\n" "CMD whois %%s %%s\n\n"
|
||||
"NAME %s\n" "CMD send %%s\n\n"
|
||||
"NAME %s\n" "CMD dcc chat %%s\n\n"
|
||||
|
||||
@@ -38,14 +38,6 @@
|
||||
|
||||
#include "history.h"
|
||||
|
||||
#ifndef HAVE_SNPRINTF
|
||||
#define snprintf g_snprintf
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
|
||||
#ifdef SOCKS
|
||||
#ifdef __sgi
|
||||
#include <sys/time.h>
|
||||
|
||||
@@ -82,7 +82,7 @@ identd (char *username)
|
||||
EMIT_SIGNAL (XP_TE_IDENTD, current_sess, inet_ntoa (addr.sin_addr), username, NULL, NULL, 0);
|
||||
#endif
|
||||
inet_ntop (AF_INET, &addr.sin_addr, ipbuf, sizeof (ipbuf));
|
||||
snprintf (outbuf, sizeof (outbuf), "*\tServicing ident request from %s as %s\n", ipbuf, username);
|
||||
g_snprintf (outbuf, sizeof (outbuf), "*\tServicing ident request from %s as %s\n", ipbuf, username);
|
||||
PrintText (current_sess, outbuf);
|
||||
|
||||
recv (read_sok, buf, sizeof (buf) - 1, 0);
|
||||
@@ -91,7 +91,7 @@ identd (char *username)
|
||||
p = strchr (buf, ',');
|
||||
if (p)
|
||||
{
|
||||
snprintf (outbuf, sizeof (outbuf) - 1, "%d, %d : USERID : UNIX : %s\r\n",
|
||||
g_snprintf (outbuf, sizeof (outbuf) - 1, "%d, %d : USERID : UNIX : %s\r\n",
|
||||
atoi (buf), atoi (p + 1), username);
|
||||
outbuf[sizeof (outbuf) - 1] = 0; /* ensure null termination */
|
||||
send (read_sok, outbuf, strlen (outbuf), 0);
|
||||
@@ -155,7 +155,7 @@ identd_ipv6 (char *username)
|
||||
identd_ipv6_is_running = FALSE;
|
||||
|
||||
inet_ntop (AF_INET6, &addr.sin6_addr, ipbuf, sizeof (ipbuf));
|
||||
snprintf (outbuf, sizeof (outbuf), "*\tServicing ident request from %s as %s\n", ipbuf, username);
|
||||
g_snprintf (outbuf, sizeof (outbuf), "*\tServicing ident request from %s as %s\n", ipbuf, username);
|
||||
PrintText (current_sess, outbuf);
|
||||
|
||||
recv (read_sok, buf, sizeof (buf) - 1, 0);
|
||||
@@ -164,7 +164,7 @@ identd_ipv6 (char *username)
|
||||
p = strchr (buf, ',');
|
||||
if (p)
|
||||
{
|
||||
snprintf (outbuf, sizeof (outbuf) - 1, "%d, %d : USERID : UNIX : %s\r\n", atoi (buf), atoi (p + 1), username);
|
||||
g_snprintf (outbuf, sizeof (outbuf) - 1, "%d, %d : USERID : UNIX : %s\r\n", atoi (buf), atoi (p + 1), username);
|
||||
outbuf[sizeof (outbuf) - 1] = 0; /* ensure null termination */
|
||||
send (read_sok, outbuf, strlen (outbuf), 0);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ ignore_showlist (session *sess)
|
||||
ig = list->data;
|
||||
i++;
|
||||
|
||||
snprintf (tbuf, sizeof (tbuf), " %-25s ", ig->mask);
|
||||
g_snprintf (tbuf, sizeof (tbuf), " %-25s ", ig->mask);
|
||||
if (ig->type & IG_PRIV)
|
||||
strcat (tbuf, _("YES "));
|
||||
else
|
||||
@@ -319,7 +319,7 @@ ignore_save ()
|
||||
ig = (struct ignore *) temp->data;
|
||||
if (!(ig->type & IG_NOSAVE))
|
||||
{
|
||||
snprintf (buf, sizeof (buf), "mask = %s\ntype = %u\n\n",
|
||||
g_snprintf (buf, sizeof (buf), "mask = %s\ntype = %u\n\n",
|
||||
ig->mask, ig->type);
|
||||
write (fh, buf, strlen (buf));
|
||||
}
|
||||
@@ -372,9 +372,9 @@ flood_check (char *nick, char *ip, server *serv, session *sess, int what) /*0=ct
|
||||
for (i = 0; i < 128; i++)
|
||||
if (ip[i] == '@')
|
||||
break;
|
||||
snprintf (real_ip, sizeof (real_ip), "*!*%s", &ip[i]);
|
||||
g_snprintf (real_ip, sizeof (real_ip), "*!*%s", &ip[i]);
|
||||
|
||||
snprintf (buf, sizeof (buf),
|
||||
g_snprintf (buf, sizeof (buf),
|
||||
_("You are being CTCP flooded from %s, ignoring %s\n"),
|
||||
nick, real_ip);
|
||||
PrintText (sess, buf);
|
||||
@@ -399,7 +399,7 @@ flood_check (char *nick, char *ip, server *serv, session *sess, int what) /*0=ct
|
||||
serv->msg_counter++;
|
||||
if (serv->msg_counter == prefs.hex_flood_msg_num) /*if we reached the maximun numbers of ctcp in the seconds limits */
|
||||
{
|
||||
snprintf (buf, sizeof (buf),
|
||||
g_snprintf (buf, sizeof (buf),
|
||||
_("You are being MSG flooded from %s, setting gui_autoopen_dialog OFF.\n"),
|
||||
ip);
|
||||
PrintText (sess, buf);
|
||||
|
||||
@@ -184,7 +184,7 @@ inbound_privmsg (server *serv, char *from, char *ip, char *text, int id,
|
||||
(!sess->topic || strcmp(sess->topic, ip)))
|
||||
{
|
||||
char tbuf[1024];
|
||||
snprintf (tbuf, sizeof (tbuf), "[%s has address %s]\n", from, ip);
|
||||
g_snprintf (tbuf, sizeof (tbuf), "[%s has address %s]\n", from, ip);
|
||||
write (sess->logfd, tbuf, strlen (tbuf));
|
||||
}
|
||||
set_topic (sess, ip, ip);
|
||||
@@ -914,7 +914,7 @@ inbound_ping_reply (session *sess, char *timestring, char *from,
|
||||
tags_data->timestamp);
|
||||
} else
|
||||
{
|
||||
snprintf (outbuf, sizeof (outbuf), "%ld.%03ld", dif / 1000, dif % 1000);
|
||||
g_snprintf (outbuf, sizeof (outbuf), "%ld.%03ld", dif / 1000, dif % 1000);
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_PINGREP, sess, from, outbuf, NULL, NULL, 0,
|
||||
tags_data->timestamp);
|
||||
}
|
||||
|
||||
@@ -341,9 +341,9 @@ notify_watch (server * serv, char *nick, int add)
|
||||
addchar = '-';
|
||||
|
||||
if (serv->supports_monitor)
|
||||
snprintf (tbuf, sizeof (tbuf), "MONITOR %c %s", addchar, nick);
|
||||
g_snprintf (tbuf, sizeof (tbuf), "MONITOR %c %s", addchar, nick);
|
||||
else if (serv->supports_watch)
|
||||
snprintf (tbuf, sizeof (tbuf), "WATCH %c%s", addchar, nick);
|
||||
g_snprintf (tbuf, sizeof (tbuf), "WATCH %c%s", addchar, nick);
|
||||
else
|
||||
return;
|
||||
|
||||
@@ -556,9 +556,9 @@ notify_showlist (struct session *sess, const message_tags_data *tags_data)
|
||||
notify = (struct notify *) list->data;
|
||||
servnot = notify_find_server_entry (notify, sess->server);
|
||||
if (servnot && servnot->ison)
|
||||
snprintf (outbuf, sizeof (outbuf), _(" %-20s online\n"), notify->name);
|
||||
g_snprintf (outbuf, sizeof (outbuf), _(" %-20s online\n"), notify->name);
|
||||
else
|
||||
snprintf (outbuf, sizeof (outbuf), _(" %-20s offline\n"), notify->name);
|
||||
g_snprintf (outbuf, sizeof (outbuf), _(" %-20s offline\n"), notify->name);
|
||||
PrintTextTimeStamp (sess, outbuf, tags_data->timestamp);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
@@ -481,19 +481,19 @@ create_mask (session * sess, char *mask, char *mode, char *typestr, int deop)
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
snprintf (buf, sizeof (buf), "%s %s *!*@%s.*", mode, p2, domain);
|
||||
g_snprintf (buf, sizeof (buf), "%s %s *!*@%s.*", mode, p2, domain);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
snprintf (buf, sizeof (buf), "%s %s *!*@%s", mode, p2, fullhost);
|
||||
g_snprintf (buf, sizeof (buf), "%s %s *!*@%s", mode, p2, fullhost);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
snprintf (buf, sizeof (buf), "%s %s *!%s@%s.*", mode, p2, username, domain);
|
||||
g_snprintf (buf, sizeof (buf), "%s %s *!%s@%s.*", mode, p2, username, domain);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
snprintf (buf, sizeof (buf), "%s %s *!%s@%s", mode, p2, username, fullhost);
|
||||
g_snprintf (buf, sizeof (buf), "%s %s *!%s@%s", mode, p2, username, fullhost);
|
||||
break;
|
||||
}
|
||||
} else
|
||||
@@ -501,26 +501,26 @@ create_mask (session * sess, char *mask, char *mode, char *typestr, int deop)
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
snprintf (buf, sizeof (buf), "%s %s *!*@*%s", mode, p2, domain);
|
||||
g_snprintf (buf, sizeof (buf), "%s %s *!*@*%s", mode, p2, domain);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
snprintf (buf, sizeof (buf), "%s %s *!*@%s", mode, p2, fullhost);
|
||||
g_snprintf (buf, sizeof (buf), "%s %s *!*@%s", mode, p2, fullhost);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
snprintf (buf, sizeof (buf), "%s %s *!%s@*%s", mode, p2, username, domain);
|
||||
g_snprintf (buf, sizeof (buf), "%s %s *!%s@*%s", mode, p2, username, domain);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
snprintf (buf, sizeof (buf), "%s %s *!%s@%s", mode, p2, username, fullhost);
|
||||
g_snprintf (buf, sizeof (buf), "%s %s *!%s@%s", mode, p2, username, fullhost);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
snprintf (buf, sizeof (buf), "%s %s", mode, mask);
|
||||
g_snprintf (buf, sizeof (buf), "%s %s", mode, mask);
|
||||
}
|
||||
|
||||
return g_strdup (buf);
|
||||
@@ -1108,9 +1108,9 @@ menu_del_children (char *path, char *label)
|
||||
if (!label)
|
||||
label = "";
|
||||
if (path[0])
|
||||
snprintf (buf, sizeof (buf), "%s/%s", path, label);
|
||||
g_snprintf (buf, sizeof (buf), "%s/%s", path, label);
|
||||
else
|
||||
snprintf (buf, sizeof (buf), "%s", label);
|
||||
g_snprintf (buf, sizeof (buf), "%s", label);
|
||||
|
||||
list = menu_list;
|
||||
while (list)
|
||||
@@ -1929,7 +1929,7 @@ get_bool_cb (int val, getvalinfo *info)
|
||||
{
|
||||
char buf[512];
|
||||
|
||||
snprintf (buf, sizeof (buf), "%s %d", info->cmd, val);
|
||||
g_snprintf (buf, sizeof (buf), "%s %d", info->cmd, val);
|
||||
if (is_session (info->sess))
|
||||
handle_command (info->sess, buf, FALSE);
|
||||
|
||||
@@ -1961,7 +1961,7 @@ get_int_cb (int cancel, int val, getvalinfo *info)
|
||||
|
||||
if (!cancel)
|
||||
{
|
||||
snprintf (buf, sizeof (buf), "%s %d", info->cmd, val);
|
||||
g_snprintf (buf, sizeof (buf), "%s %d", info->cmd, val);
|
||||
if (is_session (info->sess))
|
||||
handle_command (info->sess, buf, FALSE);
|
||||
}
|
||||
@@ -1996,7 +1996,7 @@ get_file_cb (char *cmd, char *file)
|
||||
no args */
|
||||
if (file)
|
||||
{
|
||||
snprintf (buf, sizeof (buf), "%s %s", cmd, file);
|
||||
g_snprintf (buf, sizeof (buf), "%s %s", cmd, file);
|
||||
handle_command (current_sess, buf, FALSE);
|
||||
}
|
||||
else
|
||||
@@ -2045,7 +2045,7 @@ get_str_cb (int cancel, char *val, getvalinfo *info)
|
||||
|
||||
if (!cancel)
|
||||
{
|
||||
snprintf (buf, sizeof (buf), "%s %s", info->cmd, val);
|
||||
g_snprintf (buf, sizeof (buf), "%s %s", info->cmd, val);
|
||||
if (is_session (info->sess))
|
||||
handle_command (info->sess, buf, FALSE);
|
||||
}
|
||||
@@ -2282,7 +2282,7 @@ cmd_ignore (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||
strchr (mask, '*') == NULL)
|
||||
{
|
||||
mask = tbuf;
|
||||
snprintf (tbuf, TBUFSIZE, "%s!*@*", word[2]);
|
||||
g_snprintf (tbuf, TBUFSIZE, "%s!*@*", word[2]);
|
||||
}
|
||||
|
||||
i = ignore_add (mask, type, TRUE);
|
||||
@@ -2640,7 +2640,7 @@ cmd_me (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
snprintf (tbuf, TBUFSIZE, "\001ACTION %s\001\r", act);
|
||||
g_snprintf (tbuf, TBUFSIZE, "\001ACTION %s\001\r", act);
|
||||
/* first try through DCC CHAT */
|
||||
if (dcc_write_chat (sess->channel, tbuf))
|
||||
{
|
||||
@@ -2980,7 +2980,7 @@ cmd_ping (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||
|
||||
tim = make_ping_time ();
|
||||
|
||||
snprintf (timestring, sizeof (timestring), "%lu", tim);
|
||||
g_snprintf (timestring, sizeof (timestring), "%lu", tim);
|
||||
sess->server->p_ping (sess->server, to, timestring);
|
||||
|
||||
return TRUE;
|
||||
@@ -3220,9 +3220,9 @@ cmd_send (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||
if ((addr & 0xffff0000) == 0xc0a80000 || /* 192.168.x.x */
|
||||
(addr & 0xff000000) == 0x0a000000) /* 10.x.x.x */
|
||||
/* we got a private net address, let's PSEND or it'll fail */
|
||||
snprintf (tbuf, 512, "DCC PSEND %s", word_eol[2]);
|
||||
g_snprintf (tbuf, 512, "DCC PSEND %s", word_eol[2]);
|
||||
else
|
||||
snprintf (tbuf, 512, "DCC SEND %s", word_eol[2]);
|
||||
g_snprintf (tbuf, 512, "DCC SEND %s", word_eol[2]);
|
||||
|
||||
handle_command (sess, tbuf, FALSE);
|
||||
|
||||
@@ -3522,7 +3522,7 @@ cmd_unignore (struct session *sess, char *tbuf, char *word[],
|
||||
if (strchr (mask, '?') == NULL && strchr (mask, '*') == NULL)
|
||||
{
|
||||
mask = tbuf;
|
||||
snprintf (tbuf, TBUFSIZE, "%s!*@*", word[2]);
|
||||
g_snprintf (tbuf, TBUFSIZE, "%s!*@*", word[2]);
|
||||
}
|
||||
|
||||
if (ignore_del (mask, NULL))
|
||||
@@ -4085,7 +4085,7 @@ usercommand_show_help (session *sess, char *name)
|
||||
pop = (struct popup *) list->data;
|
||||
if (!g_ascii_strcasecmp (pop->name, name))
|
||||
{
|
||||
snprintf (buf, sizeof(buf), _("User Command for: %s\n"), pop->cmd);
|
||||
g_snprintf (buf, sizeof(buf), _("User Command for: %s\n"), pop->cmd);
|
||||
PrintText (sess, buf);
|
||||
|
||||
found = TRUE;
|
||||
@@ -4112,7 +4112,7 @@ help (session *sess, char *tbuf, char *helpcmd, int quiet)
|
||||
{
|
||||
if (cmd->help)
|
||||
{
|
||||
snprintf (tbuf, TBUFSIZE, _("Usage: %s\n"), _(cmd->help));
|
||||
g_snprintf (tbuf, TBUFSIZE, _("Usage: %s\n"), _(cmd->help));
|
||||
PrintText (sess, tbuf);
|
||||
} else
|
||||
{
|
||||
@@ -4241,7 +4241,7 @@ auto_insert (char *dest, gsize destlen, unsigned char *src, char *word[],
|
||||
case 'y':
|
||||
now = time (0);
|
||||
tm_ptr = localtime (&now);
|
||||
snprintf (buf, sizeof (buf), "%4d%02d%02d", 1900 +
|
||||
g_snprintf (buf, sizeof (buf), "%4d%02d%02d", 1900 +
|
||||
tm_ptr->tm_year, 1 + tm_ptr->tm_mon, tm_ptr->tm_mday);
|
||||
utf = buf;
|
||||
break;
|
||||
@@ -4394,7 +4394,7 @@ nick_comp_cb (struct User *user, nickdata *data)
|
||||
lenu = strlen (user->nick);
|
||||
if (lenu == data->len)
|
||||
{
|
||||
snprintf (data->tbuf, TBUFSIZE, "%s%s", user->nick, data->space);
|
||||
g_snprintf (data->tbuf, TBUFSIZE, "%s%s", user->nick, data->space);
|
||||
data->len = -1;
|
||||
return FALSE;
|
||||
} else if (lenu < data->bestlen)
|
||||
@@ -4438,7 +4438,7 @@ perform_nick_completion (struct session *sess, char *cmd, char *tbuf)
|
||||
|
||||
if (data.best)
|
||||
{
|
||||
snprintf (tbuf, TBUFSIZE, "%s%s", data.best->nick, space - 1);
|
||||
g_snprintf (tbuf, TBUFSIZE, "%s%s", data.best->nick, space - 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1926,7 +1926,7 @@ hexchat_pluginpref_set_int (hexchat_plugin *pl, const char *var, int value)
|
||||
{
|
||||
char buffer[12];
|
||||
|
||||
snprintf (buffer, sizeof (buffer), "%d", value);
|
||||
g_snprintf (buffer, sizeof (buffer), "%d", value);
|
||||
return hexchat_pluginpref_set_str_real (pl, var, buffer, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -429,7 +429,7 @@ irc_raw (server *serv, char *raw)
|
||||
len = strlen (raw);
|
||||
if (len < sizeof (tbuf) - 3)
|
||||
{
|
||||
len = snprintf (tbuf, sizeof (tbuf), "%s\r\n", raw);
|
||||
len = g_snprintf (tbuf, sizeof (tbuf), "%s\r\n", raw);
|
||||
tcp_send_len (serv, tbuf, len);
|
||||
} else
|
||||
{
|
||||
@@ -590,7 +590,7 @@ process_numeric (session * sess, int n,
|
||||
char *tim;
|
||||
char outbuf[64];
|
||||
|
||||
snprintf (outbuf, sizeof (outbuf),
|
||||
g_snprintf (outbuf, sizeof (outbuf),
|
||||
"%02ld:%02ld:%02ld", idle / 3600, (idle / 60) % 60,
|
||||
idle % 60);
|
||||
if (timestamp == 0)
|
||||
|
||||
@@ -281,7 +281,7 @@ tcp_sendf (server *serv, const char *fmt, ...)
|
||||
int len;
|
||||
|
||||
va_start (args, fmt);
|
||||
len = vsnprintf (send_buf, sizeof (send_buf) - 1, fmt, args);
|
||||
len = g_vsnprintf (send_buf, sizeof (send_buf) - 1, fmt, args);
|
||||
va_end (args);
|
||||
|
||||
send_buf[sizeof (send_buf) - 1] = '\0';
|
||||
@@ -591,7 +591,7 @@ ssl_cb_info (SSL * s, int where, int ret)
|
||||
|
||||
return; /* FIXME: make debug level adjustable in serverlist or settings */
|
||||
|
||||
/* snprintf (buf, sizeof (buf), "%s (%d)", SSL_state_string_long (s), where);
|
||||
/* g_snprintf (buf, sizeof (buf), "%s (%d)", SSL_state_string_long (s), where);
|
||||
if (g_sess)
|
||||
EMIT_SIGNAL (XP_TE_SSLMESSAGE, g_sess, buf, NULL, NULL, NULL, 0);
|
||||
else
|
||||
@@ -611,9 +611,9 @@ ssl_cb_verify (int ok, X509_STORE_CTX * ctx)
|
||||
X509_NAME_oneline (X509_get_issuer_name (ctx->current_cert), issuer,
|
||||
sizeof (issuer));
|
||||
|
||||
snprintf (buf, sizeof (buf), "* Subject: %s", subject);
|
||||
g_snprintf (buf, sizeof (buf), "* Subject: %s", subject);
|
||||
EMIT_SIGNAL (XP_TE_SSLMESSAGE, g_sess, buf, NULL, NULL, NULL, 0);
|
||||
snprintf (buf, sizeof (buf), "* Issuer: %s", issuer);
|
||||
g_snprintf (buf, sizeof (buf), "* Issuer: %s", issuer);
|
||||
EMIT_SIGNAL (XP_TE_SSLMESSAGE, g_sess, buf, NULL, NULL, NULL, 0);
|
||||
|
||||
return (TRUE); /* always ok */
|
||||
@@ -634,7 +634,7 @@ ssl_do_connect (server * serv)
|
||||
if ((err = ERR_get_error ()) > 0)
|
||||
{
|
||||
ERR_error_string (err, err_buf);
|
||||
snprintf (buf, sizeof (buf), "(%d) %s", err, err_buf);
|
||||
g_snprintf (buf, sizeof (buf), "(%d) %s", err, err_buf);
|
||||
EMIT_SIGNAL (XP_TE_CONNFAIL, serv->server_session, buf, NULL,
|
||||
NULL, NULL, 0);
|
||||
|
||||
@@ -660,59 +660,59 @@ ssl_do_connect (server * serv)
|
||||
|
||||
if (!_SSL_get_cert_info (&cert_info, serv->ssl))
|
||||
{
|
||||
snprintf (buf, sizeof (buf), "* Certification info:");
|
||||
g_snprintf (buf, sizeof (buf), "* Certification info:");
|
||||
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
|
||||
NULL, 0);
|
||||
snprintf (buf, sizeof (buf), " Subject:");
|
||||
g_snprintf (buf, sizeof (buf), " Subject:");
|
||||
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
|
||||
NULL, 0);
|
||||
for (i = 0; cert_info.subject_word[i]; i++)
|
||||
{
|
||||
snprintf (buf, sizeof (buf), " %s", cert_info.subject_word[i]);
|
||||
g_snprintf (buf, sizeof (buf), " %s", cert_info.subject_word[i]);
|
||||
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
|
||||
NULL, 0);
|
||||
}
|
||||
snprintf (buf, sizeof (buf), " Issuer:");
|
||||
g_snprintf (buf, sizeof (buf), " Issuer:");
|
||||
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
|
||||
NULL, 0);
|
||||
for (i = 0; cert_info.issuer_word[i]; i++)
|
||||
{
|
||||
snprintf (buf, sizeof (buf), " %s", cert_info.issuer_word[i]);
|
||||
g_snprintf (buf, sizeof (buf), " %s", cert_info.issuer_word[i]);
|
||||
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
|
||||
NULL, 0);
|
||||
}
|
||||
snprintf (buf, sizeof (buf), " Public key algorithm: %s (%d bits)",
|
||||
g_snprintf (buf, sizeof (buf), " Public key algorithm: %s (%d bits)",
|
||||
cert_info.algorithm, cert_info.algorithm_bits);
|
||||
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
|
||||
NULL, 0);
|
||||
/*if (cert_info.rsa_tmp_bits)
|
||||
{
|
||||
snprintf (buf, sizeof (buf),
|
||||
g_snprintf (buf, sizeof (buf),
|
||||
" Public key algorithm uses ephemeral key with %d bits",
|
||||
cert_info.rsa_tmp_bits);
|
||||
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
|
||||
NULL, 0);
|
||||
}*/
|
||||
snprintf (buf, sizeof (buf), " Sign algorithm %s",
|
||||
g_snprintf (buf, sizeof (buf), " Sign algorithm %s",
|
||||
cert_info.sign_algorithm/*, cert_info.sign_algorithm_bits*/);
|
||||
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
|
||||
NULL, 0);
|
||||
snprintf (buf, sizeof (buf), " Valid since %s to %s",
|
||||
g_snprintf (buf, sizeof (buf), " Valid since %s to %s",
|
||||
cert_info.notbefore, cert_info.notafter);
|
||||
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
|
||||
NULL, 0);
|
||||
} else
|
||||
{
|
||||
snprintf (buf, sizeof (buf), " * No Certificate");
|
||||
g_snprintf (buf, sizeof (buf), " * No Certificate");
|
||||
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
|
||||
NULL, 0);
|
||||
}
|
||||
|
||||
chiper_info = _SSL_get_cipher_info (serv->ssl); /* static buffer */
|
||||
snprintf (buf, sizeof (buf), "* Cipher info:");
|
||||
g_snprintf (buf, sizeof (buf), "* Cipher info:");
|
||||
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL,
|
||||
0);
|
||||
snprintf (buf, sizeof (buf), " Version: %s, cipher %s (%u bits)",
|
||||
g_snprintf (buf, sizeof (buf), " Version: %s, cipher %s (%u bits)",
|
||||
chiper_info->version, chiper_info->chiper,
|
||||
chiper_info->chiper_bits);
|
||||
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL,
|
||||
@@ -727,7 +727,7 @@ ssl_do_connect (server * serv)
|
||||
int hostname_err;
|
||||
if ((hostname_err = _SSL_check_hostname(cert, serv->hostname)) != 0)
|
||||
{
|
||||
snprintf (buf, sizeof (buf), "* Verify E: Failed to validate hostname? (%d)%s",
|
||||
g_snprintf (buf, sizeof (buf), "* Verify E: Failed to validate hostname? (%d)%s",
|
||||
hostname_err, serv->accept_invalid_cert ? " -- Ignored" : "");
|
||||
if (serv->accept_invalid_cert)
|
||||
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0);
|
||||
@@ -736,7 +736,7 @@ ssl_do_connect (server * serv)
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* snprintf (buf, sizeof (buf), "* Verify OK (?)"); */
|
||||
/* g_snprintf (buf, sizeof (buf), "* Verify OK (?)"); */
|
||||
/* EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0); */
|
||||
case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY:
|
||||
case X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE:
|
||||
@@ -745,7 +745,7 @@ ssl_do_connect (server * serv)
|
||||
case X509_V_ERR_CERT_HAS_EXPIRED:
|
||||
if (serv->accept_invalid_cert)
|
||||
{
|
||||
snprintf (buf, sizeof (buf), "* Verify E: %s.? (%d) -- Ignored",
|
||||
g_snprintf (buf, sizeof (buf), "* Verify E: %s.? (%d) -- Ignored",
|
||||
X509_verify_cert_error_string (verify_error),
|
||||
verify_error);
|
||||
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
|
||||
@@ -753,7 +753,7 @@ ssl_do_connect (server * serv)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
snprintf (buf, sizeof (buf), "%s.? (%d)",
|
||||
g_snprintf (buf, sizeof (buf), "%s.? (%d)",
|
||||
X509_verify_cert_error_string (verify_error),
|
||||
verify_error);
|
||||
conn_fail:
|
||||
@@ -775,7 +775,7 @@ conn_fail:
|
||||
{
|
||||
if (serv->ssl->session && serv->ssl->session->time + SSLTMOUT < time (NULL))
|
||||
{
|
||||
snprintf (buf, sizeof (buf), "SSL handshake timed out");
|
||||
g_snprintf (buf, sizeof (buf), "SSL handshake timed out");
|
||||
EMIT_SIGNAL (XP_TE_CONNFAIL, serv->server_session, buf, NULL,
|
||||
NULL, NULL, 0);
|
||||
server_cleanup (serv); /* ->connecting = FALSE */
|
||||
@@ -970,11 +970,11 @@ server_read_child (GIOChannel *source, GIOCondition condition, server *serv)
|
||||
}
|
||||
}
|
||||
#else
|
||||
snprintf (outbuf, sizeof (outbuf), "%s/auth/xchat_auth",
|
||||
g_snprintf (outbuf, sizeof (outbuf), "%s/auth/xchat_auth",
|
||||
g_get_home_dir ());
|
||||
if (access (outbuf, X_OK) == 0)
|
||||
{
|
||||
snprintf (outbuf, sizeof (outbuf), "exec -d %s/auth/xchat_auth %s",
|
||||
g_snprintf (outbuf, sizeof (outbuf), "exec -d %s/auth/xchat_auth %s",
|
||||
g_get_home_dir (), prefs.hex_irc_user_name);
|
||||
handle_command (serv->server_session, outbuf, FALSE);
|
||||
}
|
||||
@@ -1198,7 +1198,7 @@ traverse_socks (int print_fd, int sok, char *serverAddr, int port)
|
||||
if (buf[1] == 90)
|
||||
return 0;
|
||||
|
||||
snprintf (buf, sizeof (buf), "SOCKS\tServer reported error %d,%d.\n", buf[0], buf[1]);
|
||||
g_snprintf (buf, sizeof (buf), "SOCKS\tServer reported error %d,%d.\n", buf[0], buf[1]);
|
||||
proxy_error (print_fd, buf);
|
||||
return 1;
|
||||
}
|
||||
@@ -1299,9 +1299,9 @@ traverse_socks5 (int print_fd, int sok, char *serverAddr, int port)
|
||||
if (buf[0] != 5 || buf[1] != 0)
|
||||
{
|
||||
if (buf[1] == 2)
|
||||
snprintf (buf, sizeof (buf), "SOCKS\tProxy refused to connect to host (not allowed).\n");
|
||||
g_snprintf (buf, sizeof (buf), "SOCKS\tProxy refused to connect to host (not allowed).\n");
|
||||
else
|
||||
snprintf (buf, sizeof (buf), "SOCKS\tProxy failed to connect to host (error %d).\n", buf[1]);
|
||||
g_snprintf (buf, sizeof (buf), "SOCKS\tProxy failed to connect to host (error %d).\n", buf[1]);
|
||||
proxy_error (print_fd, buf);
|
||||
return 1;
|
||||
}
|
||||
@@ -1334,7 +1334,7 @@ traverse_wingate (int print_fd, int sok, char *serverAddr, int port)
|
||||
{
|
||||
char buf[128];
|
||||
|
||||
snprintf (buf, sizeof (buf), "%s %d\r\n", serverAddr, port);
|
||||
g_snprintf (buf, sizeof (buf), "%s %d\r\n", serverAddr, port);
|
||||
send (sok, buf, strlen (buf), 0);
|
||||
|
||||
return 0;
|
||||
@@ -1422,16 +1422,16 @@ traverse_http (int print_fd, int sok, char *serverAddr, int port)
|
||||
char auth_data2[252];
|
||||
int n, n2;
|
||||
|
||||
n = snprintf (buf, sizeof (buf), "CONNECT %s:%d HTTP/1.0\r\n",
|
||||
n = g_snprintf (buf, sizeof (buf), "CONNECT %s:%d HTTP/1.0\r\n",
|
||||
serverAddr, port);
|
||||
if (prefs.hex_net_proxy_auth)
|
||||
{
|
||||
n2 = snprintf (auth_data2, sizeof (auth_data2), "%s:%s",
|
||||
n2 = g_snprintf (auth_data2, sizeof (auth_data2), "%s:%s",
|
||||
prefs.hex_net_proxy_user, prefs.hex_net_proxy_pass);
|
||||
base64_encode (auth_data, auth_data2, n2);
|
||||
n += snprintf (buf+n, sizeof (buf)-n, "Proxy-Authorization: Basic %s\r\n", auth_data);
|
||||
n += g_snprintf (buf+n, sizeof (buf)-n, "Proxy-Authorization: Basic %s\r\n", auth_data);
|
||||
}
|
||||
n += snprintf (buf+n, sizeof (buf)-n, "\r\n");
|
||||
n += g_snprintf (buf+n, sizeof (buf)-n, "\r\n");
|
||||
send (sok, buf, n, 0);
|
||||
|
||||
n = http_read_line (print_fd, sok, buf, sizeof (buf));
|
||||
@@ -1504,7 +1504,7 @@ server_child (server * serv)
|
||||
local_ip = net_resolve (ns_local, prefs.hex_net_bind_host, 0, &real_hostname);
|
||||
if (local_ip != NULL)
|
||||
{
|
||||
snprintf (buf, sizeof (buf), "5\n%s\n", local_ip);
|
||||
g_snprintf (buf, sizeof (buf), "5\n%s\n", local_ip);
|
||||
write (serv->childwrite, buf, strlen (buf));
|
||||
net_bind (ns_local, serv->sok4, serv->sok6);
|
||||
bound = 1;
|
||||
@@ -1567,7 +1567,7 @@ server_child (server * serv)
|
||||
/* first resolve where we want to connect to */
|
||||
if (proxy_type > 0)
|
||||
{
|
||||
snprintf (buf, sizeof (buf), "9\n%s\n", proxy_host);
|
||||
g_snprintf (buf, sizeof (buf), "9\n%s\n", proxy_host);
|
||||
write (serv->childwrite, buf, strlen (buf));
|
||||
ip = net_resolve (ns_server, proxy_host, proxy_port, &real_hostname);
|
||||
g_free (proxy_host);
|
||||
@@ -1601,7 +1601,7 @@ server_child (server * serv)
|
||||
connect_port = port;
|
||||
}
|
||||
|
||||
snprintf (buf, sizeof (buf), "3\n%s\n%s\n%d\n",
|
||||
g_snprintf (buf, sizeof (buf), "3\n%s\n%s\n%d\n",
|
||||
real_hostname, ip, connect_port);
|
||||
write (serv->childwrite, buf, strlen (buf));
|
||||
|
||||
@@ -1615,7 +1615,7 @@ server_child (server * serv)
|
||||
|
||||
if (error != 0)
|
||||
{
|
||||
snprintf (buf, sizeof (buf), "2\n%d\n", sock_error ());
|
||||
g_snprintf (buf, sizeof (buf), "2\n%d\n", sock_error ());
|
||||
write (serv->childwrite, buf, strlen (buf));
|
||||
} else
|
||||
{
|
||||
@@ -1627,11 +1627,11 @@ server_child (server * serv)
|
||||
case 0: /* success */
|
||||
#ifdef USE_MSPROXY
|
||||
if (!serv->dont_use_proxy && (proxy_type == 5))
|
||||
snprintf (buf, sizeof (buf), "4\n%d %d %d %d %d\n", sok, psok, serv->msp_state.clientid, serv->msp_state.serverid,
|
||||
g_snprintf (buf, sizeof (buf), "4\n%d %d %d %d %d\n", sok, psok, serv->msp_state.clientid, serv->msp_state.serverid,
|
||||
serv->msp_state.seq_sent);
|
||||
else
|
||||
#endif
|
||||
snprintf (buf, sizeof (buf), "4\n%d\n", sok); /* success */
|
||||
g_snprintf (buf, sizeof (buf), "4\n%d\n", sok); /* success */
|
||||
write (serv->childwrite, buf, strlen (buf));
|
||||
break;
|
||||
case 1: /* socks traversal failed */
|
||||
@@ -1640,7 +1640,7 @@ server_child (server * serv)
|
||||
}
|
||||
} else
|
||||
{
|
||||
snprintf (buf, sizeof (buf), "4\n%d\n", sok); /* success */
|
||||
g_snprintf (buf, sizeof (buf), "4\n%d\n", sok); /* success */
|
||||
write (serv->childwrite, buf, strlen (buf));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,9 +319,9 @@ scrollback_load (session *sess)
|
||||
if (buf[0] == 'T')
|
||||
{
|
||||
if (sizeof (time_t) == 4)
|
||||
stamp = strtoul (buf + 2, NULL, 10);
|
||||
stamp = g_ascii_strtoull (buf + 2, NULL, 10);
|
||||
else
|
||||
stamp = strtoull (buf + 2, NULL, 10); /* in case time_t is 64 bits */
|
||||
stamp = g_ascii_strtoull (buf + 2, NULL, 10); /* in case time_t is 64 bits */
|
||||
text = strchr (buf + 3, ' ');
|
||||
if (text && text[1])
|
||||
{
|
||||
@@ -383,7 +383,7 @@ log_close (session *sess)
|
||||
{
|
||||
currenttime = time (NULL);
|
||||
write (sess->logfd, obuf,
|
||||
snprintf (obuf, sizeof (obuf) - 1, _("**** ENDING LOGGING AT %s\n"),
|
||||
g_snprintf (obuf, sizeof (obuf) - 1, _("**** ENDING LOGGING AT %s\n"),
|
||||
ctime (¤ttime)));
|
||||
close (sess->logfd);
|
||||
sess->logfd = -1;
|
||||
@@ -570,11 +570,11 @@ log_create_pathname (char *servname, char *channame, char *netname)
|
||||
/* create final path/filename */
|
||||
if (logmask_is_fullpath ())
|
||||
{
|
||||
snprintf (fname, sizeof (fname), "%s", fnametime);
|
||||
g_snprintf (fname, sizeof (fname), "%s", fnametime);
|
||||
}
|
||||
else /* relative path */
|
||||
{
|
||||
snprintf (fname, sizeof (fname), "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s", get_xdir (), fnametime);
|
||||
g_snprintf (fname, sizeof (fname), "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s", get_xdir (), fnametime);
|
||||
}
|
||||
|
||||
/* create all the subdirectories */
|
||||
@@ -606,7 +606,7 @@ log_open_file (char *servname, char *channame, char *netname)
|
||||
return -1;
|
||||
currenttime = time (NULL);
|
||||
write (fd, buf,
|
||||
snprintf (buf, sizeof (buf), _("**** BEGIN LOGGING AT %s\n"),
|
||||
g_snprintf (buf, sizeof (buf), _("**** BEGIN LOGGING AT %s\n"),
|
||||
ctime (¤ttime)));
|
||||
|
||||
return fd;
|
||||
@@ -998,7 +998,7 @@ PrintTextTimeStampf (session *sess, time_t timestamp, const char *format, ...)
|
||||
Each XP_TE_* signal is hard coded to call text_emit which calls
|
||||
display_event which decodes the data
|
||||
|
||||
This means that this system *should be faster* than snprintf because
|
||||
This means that this system *should be faster* than g_snprintf because
|
||||
it always 'knows' that format of the string (basically is preparses much
|
||||
of the work)
|
||||
|
||||
@@ -1584,7 +1584,7 @@ pevent_make_pntevts ()
|
||||
g_free (pntevts[i]);
|
||||
if (pevt_build_string (pntevts_text[i], &(pntevts[i]), &m) != 0)
|
||||
{
|
||||
snprintf (out, sizeof (out),
|
||||
g_snprintf (out, sizeof (out),
|
||||
_("Error parsing event %s.\nLoading default."), te[i].name);
|
||||
fe_message (out, FE_MSG_WARN);
|
||||
g_free (pntevts_text[i]);
|
||||
@@ -1725,7 +1725,7 @@ pevent_check_all_loaded ()
|
||||
if (pntevts_text[i] == NULL)
|
||||
{
|
||||
/*printf ("%s\n", te[i].name);
|
||||
snprintf(out, sizeof(out), "The data for event %s failed to load. Reverting to defaults.\nThis may be because a new version of HexChat is loading an old config file.\n\nCheck all print event texts are correct", evtnames[i]);
|
||||
g_snprintf(out, sizeof(out), "The data for event %s failed to load. Reverting to defaults.\nThis may be because a new version of HexChat is loading an old config file.\n\nCheck all print event texts are correct", evtnames[i]);
|
||||
gtkutil_simpledialog(out); */
|
||||
/* make-te.c sets this 128 flag (DON'T call gettext() flag) */
|
||||
if (te[i].num_args & 128)
|
||||
@@ -1944,7 +1944,7 @@ pevt_build_string (const char *input, char **output, int *max_arg)
|
||||
}
|
||||
if (d < '1' || d > '9')
|
||||
{
|
||||
snprintf (o, sizeof (o), "Error, invalid argument $%c\n", d);
|
||||
g_snprintf (o, sizeof (o), "Error, invalid argument $%c\n", d);
|
||||
fe_message (o, FE_MSG_WARN);
|
||||
goto err;
|
||||
}
|
||||
@@ -2064,7 +2064,7 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d,
|
||||
|
||||
if (prefs.hex_text_color_nicks && (index == XP_TE_CHANACTION || index == XP_TE_CHANMSG))
|
||||
{
|
||||
snprintf (tbuf, sizeof (tbuf), "\003%d%s", text_color_of (a), a);
|
||||
g_snprintf (tbuf, sizeof (tbuf), "\003%d%s", text_color_of (a), a);
|
||||
a = tbuf;
|
||||
stripcolor_args &= ~ARG_FLAG(1); /* don't strip color from this argument */
|
||||
}
|
||||
@@ -2196,9 +2196,9 @@ pevent_save (char *fn)
|
||||
|
||||
for (i = 0; i < NUM_XP; i++)
|
||||
{
|
||||
write (fd, buf, snprintf (buf, sizeof (buf),
|
||||
write (fd, buf, g_snprintf (buf, sizeof (buf),
|
||||
"event_name=%s\n", te[i].name));
|
||||
write (fd, buf, snprintf (buf, sizeof (buf),
|
||||
write (fd, buf, g_snprintf (buf, sizeof (buf),
|
||||
"event_text=%s\n\n", pntevts_text[i]));
|
||||
}
|
||||
|
||||
@@ -2373,9 +2373,9 @@ sound_save ()
|
||||
{
|
||||
if (sound_files[i] && sound_files[i][0])
|
||||
{
|
||||
write (fd, buf, snprintf (buf, sizeof (buf),
|
||||
write (fd, buf, g_snprintf (buf, sizeof (buf),
|
||||
"event=%s\n", te[i].name));
|
||||
write (fd, buf, snprintf (buf, sizeof (buf),
|
||||
write (fd, buf, g_snprintf (buf, sizeof (buf),
|
||||
"sound=%s\n\n", sound_files[i]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,10 +66,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SNPRINTF
|
||||
#define snprintf g_snprintf
|
||||
#endif
|
||||
|
||||
char *
|
||||
file_part (char *file)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user