Skip to content
Permalink
Browse files

Code cleanup

  • Loading branch information...
vanosg committed Sep 13, 2019
1 parent 9327a25 commit cfd7ef82d037607be07bbd94d5ceb15050feec11
Showing with 14 additions and 15 deletions.
  1. +3 −3 src/mod/server.mod/cmdsserv.c
  2. +5 −6 src/mod/server.mod/server.c
  3. +2 −2 src/mod/server.mod/servmsg.c
  4. +4 −4 src/mod/server.mod/tclserv.c
@@ -48,13 +48,13 @@ static void cmd_servers(struct userrec *u, int idx, char *par)
#endif

#ifdef TLS
len += egg_snprintf(s+len, 1024 - len, "%s", x->ssl ? "+" : "");
len += egg_snprintf(s+len, sizeof s - len, "%s", x->ssl ? "+" : "");
#endif
if ((i == curserv) && realservername) {
len += egg_snprintf(s+len, 1024 - len, "%d (%s) <- I am here",
len += egg_snprintf(s+len, sizeof s - len, "%d (%s) <- I am here",
x->port ? x->port : default_port, realservername);
} else {
len += egg_snprintf(s+len, 1024 - len, "%d %s",
len += egg_snprintf(s+len, sizeof s - len, "%d %s",
x->port ? x->port : default_port,
(i == curserv) ? "<- I am here" : "");
}
@@ -120,8 +120,8 @@ static int deq_kick(int);
static void msgq_clear(struct msgq_head *qh);
static int stack_limit;
static char *realservername;
static char add_server(char *, char *, char *);
static char del_server(char *, char *);
static char add_server(const char *, const char *, const char *);
static char del_server(const char *, const char *);
static void free_server(struct server_list *);

static int sasl = 0;
@@ -1000,7 +1000,7 @@ static void old_add_server(const char *ss) {

/* Add a new server to the server_list.
*/
static char add_server(char *name, char *port, char *pass)
static char add_server(const char *name, const char *port, const char *pass)
{
struct server_list *x, *z;
char *ret;
@@ -1048,7 +1048,7 @@ static char add_server(char *name, char *port, char *pass)
* Checks based on IP and then the port, if one is provided. If no port is
* provided, remove only the first matching host.
*/
static char del_server(char *name, char *port)
static char del_server(const char *name, const char *port)
{
struct server_list *z, *curr, *prev;
char *ret;
@@ -1072,13 +1072,12 @@ static char del_server(char *name, char *port)
#endif
serverlist = serverlist->next;
free_server(z);
return 0;
}
} else {
serverlist = serverlist->next;
free_server(z);
return 0;
}
return 0;
}
curr = serverlist->next;
prev = serverlist;
@@ -1582,10 +1582,10 @@ static void connect_server(void)
#endif

#ifdef TLS
len += egg_snprintf(s + len, (sizeof s) - len, ":%s%d",
len += egg_snprintf(s + len, sizeof s - len, ":%s%d",
use_ssl ? "+" : "", botserverport);
#else
len += egg_snprintf(s + len, (sizeof s) - len, ":%d", botserverport);
len += egg_snprintf(s + len, sizeof s - len, ":%d", botserverport);
#endif
putlog(LOG_SERV, "*", "%s", s);
dcc[servidx].port = botserverport;
@@ -347,15 +347,15 @@ static int tcl_addserver STDVAR {
if (argc == 4) {
strlcpy(pass, argv[3], sizeof pass);
}
ret = (add_server(name, port, pass));
ret = add_server(name, port, pass);
if (ret == 0) {
return TCL_OK;
} else if (ret == 1) {
Tcl_AppendResult(irp, "A ':' was detected in the non-IPv6 address ", name,
" Make sure the port is separated by a space, not a ':'. "\
" Make sure the port is separated by a space, not a ':'. "
"Skipping...", NULL);
} else if (ret == 2) {
Tcl_AppendResult(irp, "Attempted to add SSL-enabled server, but Eggdrop "\
Tcl_AppendResult(irp, "Attempted to add SSL-enabled server, but Eggdrop "
"was not compiled with SSL libraries. Skipping...", NULL);
}
return TCL_ERROR;
@@ -376,7 +376,7 @@ static int tcl_delserver STDVAR {
return TCL_OK;
} else if (ret == 1) {
Tcl_AppendResult(irp, "A ':' was detected in the non-IPv6 address ", name,
" Make sure the port is separated by a space, not a ':'. "\
" Make sure the port is separated by a space, not a ':'. "
"Skipping...", NULL);
} else if (ret == 2) {
Tcl_AppendResult(irp, "Server list is empty", NULL);

0 comments on commit cfd7ef8

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