Minor cleanups
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
This commit is contained in:
parent
7985d4fed0
commit
f9e95ec582
@ -42,17 +42,19 @@ static void send_message(struct user* user, const char* message)
|
|||||||
hub_free(buffer);
|
hub_free(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int command_access_denied(struct user* user)
|
static int command_access_denied(struct user* user, const char* command)
|
||||||
{
|
{
|
||||||
send_message(user, "*** Access denied.");
|
char temp[64];
|
||||||
return 0;
|
snprintf(temp, 64, "*** Access denied: \"%s\"", command);
|
||||||
|
send_message(user, temp);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int command_stats(struct user* user, const char* message)
|
static int command_stats(struct user* user, const char* message)
|
||||||
{
|
{
|
||||||
char temp[128];
|
char temp[128];
|
||||||
snprintf(temp, 128, "*** Stats: %zu users, peak: %zu. Network (up/down): %d/%d KB/s, peak: %d/%d KB/s",
|
snprintf(temp, 128, "*** Stats: %zu users, peak: %zu. Network (up/down): %d/%d KB/s, peak: %d/%d KB/s",
|
||||||
user->hub->users->count,
|
user->hub->users->count,
|
||||||
user->hub->users->count_peak,
|
user->hub->users->count_peak,
|
||||||
(int) user->hub->stats.net_tx / 1024,
|
(int) user->hub->stats.net_tx / 1024,
|
||||||
@ -60,8 +62,8 @@ static int command_stats(struct user* user, const char* message)
|
|||||||
(int) user->hub->stats.net_tx_peak / 1024,
|
(int) user->hub->stats.net_tx_peak / 1024,
|
||||||
(int) user->hub->stats.net_rx_peak / 1024);
|
(int) user->hub->stats.net_rx_peak / 1024);
|
||||||
|
|
||||||
send_message(user, temp);
|
send_message(user, temp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -152,11 +154,7 @@ static int command_version(struct user* user, const char* message)
|
|||||||
static int command_myip(struct user* user, const char* message)
|
static int command_myip(struct user* user, const char* message)
|
||||||
{
|
{
|
||||||
char tmp[128];
|
char tmp[128];
|
||||||
|
snprintf(tmp, 128, "*** Your IP: %s", ip_convert_to_string(&user->ipaddr));
|
||||||
tmp[0] = 0;
|
|
||||||
strcat(tmp, "*** Your IP: ");
|
|
||||||
strcat(tmp, ip_convert_to_string(&user->ipaddr));
|
|
||||||
|
|
||||||
send_message(user, tmp);
|
send_message(user, tmp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -174,7 +172,7 @@ int command_dipatcher(struct user* user, const char* message)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return command_access_denied(user);
|
return command_access_denied(user, &command_handlers[n].prefix[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user