Skip to content
Permalink
Browse files

Pointless fixes

  • Loading branch information...
michaelortmann authored and vanosg committed Oct 4, 2019
1 parent cdd2f1a commit 410165483340f67900313668b39370f282c30447
Showing with 23 additions and 19 deletions.
  1. +12 −11 src/mod/server.mod/cmdsserv.c
  2. +11 −8 src/mod/server.mod/servmsg.c
@@ -27,8 +27,10 @@ static void cmd_servers(struct userrec *u, int idx, char *par)
struct server_list *x = serverlist;
time_t t;
struct tm *currtm;
int i, len = 0;
char buf[16];
int i, len;
#ifdef IPV6
char buf[sizeof(struct in6_addr)];
#endif
char s[1024];
char setpass[11];

@@ -39,20 +41,19 @@ static void cmd_servers(struct userrec *u, int idx, char *par)
dprintf(idx, "Server list:\n");
i = 0;
for (; x; x = x->next) {
len = 0;
/* Build server display line, section by section */
#ifdef IPV6
if (inet_pton(AF_INET6, x->name, buf) == 1) {
len += egg_snprintf(s, sizeof s, " [%s]:", x->name);
len = egg_snprintf(s, sizeof s, " [%s]:", x->name);
} else {
#endif
len += egg_snprintf(s, sizeof s, " %s:", x->name);
len = egg_snprintf(s, sizeof s, " %s:", x->name);
#ifdef IPV6
}
#endif

#ifdef TLS
len += egg_snprintf(s+len, sizeof s - len, "%s", x->ssl ? "+" : "");
len += egg_snprintf(s + len, sizeof s - len, "%s", x->ssl ? "+" : "");
#endif
if (x->pass) {
t = time(NULL);
@@ -66,12 +67,12 @@ static void cmd_servers(struct userrec *u, int idx, char *par)
strlcpy(setpass, "", sizeof setpass);
}
if ((i == curserv) && realservername) {
len += egg_snprintf(s+len, sizeof s - len, "%d (%s) <- I am here",
x->port ? x->port : default_port, setpass, realservername);
egg_snprintf(s + len, sizeof s - len, "%d (%s) <- I am here",
x->port ? x->port : default_port, setpass, realservername);
} else {
len += egg_snprintf(s+len, sizeof s - len, "%d %s",
x->port ? x->port : default_port, setpass,
(i == curserv) ? "<- I am here" : "");
egg_snprintf(s + len, sizeof s - len, "%d %s",
x->port ? x->port : default_port, setpass,
(i == curserv) ? "<- I am here" : "");
}
dprintf(idx, "%s\n", s);
i++;
@@ -1536,15 +1536,18 @@ static void server_resolve_failure(int);
*/
static void connect_server(void)
{
char pass[121], botserver[UHOSTLEN], buf[16], s[1024];
char pass[121], botserver[UHOSTLEN], s[1024];
#ifdef IPV6
char buf[sizeof(struct in6_addr)];
#endif
int servidx, len = 0;
unsigned int botserverport = 0;

lastpingcheck = 0;
trying_server = now;
empty_msgq();
if (newserverport) { /* Jump to specified server */
curserv = -1; /* Reset server list */
if (newserverport) { /* Jump to specified server */
curserv = -1; /* Reset server list */
strcpy(botserver, newserver);
botserverport = newserverport;
strcpy(pass, newserverpass);
@@ -1580,19 +1583,19 @@ static void connect_server(void)

#ifdef IPV6
if (inet_pton(AF_INET6, botserver, buf)) {
len += egg_snprintf(s, sizeof s, "%s [%s]", IRC_SERVERTRY, botserver);
egg_snprintf(s, sizeof s, "%s [%s]", IRC_SERVERTRY, botserver);
} else {
#endif
len += egg_snprintf(s, sizeof s, "%s %s", IRC_SERVERTRY, botserver);
egg_snprintf(s, sizeof s, "%s %s", IRC_SERVERTRY, botserver);
#ifdef IPV6
}
#endif

#ifdef TLS
len += egg_snprintf(s + len, sizeof s - len, ":%s%d",
use_ssl ? "+" : "", botserverport);
egg_snprintf(s + len, sizeof s - len, ":%s%d",
use_ssl ? "+" : "", botserverport);
#else
len += egg_snprintf(s + len, sizeof s - len, ":%d", botserverport);
egg_snprintf(s + len, sizeof s - len, ":%d", botserverport);
#endif
putlog(LOG_SERV, "*", "%s", s);
dcc[servidx].port = botserverport;

0 comments on commit 4101654

Please sign in to comment.
You can’t perform that action at this time.