mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Made usage of cons_show vargs
This commit is contained in:
parent
6aa1fe5513
commit
585d3e52f7
@ -478,9 +478,7 @@ _cmd_connect(const char * const inp, struct cmd_help_t help)
|
||||
cons_show("You are either connected already, or a login is in process.");
|
||||
result = TRUE;
|
||||
} else if (strlen(inp) < 10) {
|
||||
char usage[strlen(help.usage + 8)];
|
||||
sprintf(usage, "Usage: %s", help.usage);
|
||||
cons_show(usage);
|
||||
cons_show("Usage: %s", help.usage);
|
||||
result = TRUE;
|
||||
} else {
|
||||
char *user, *lower;
|
||||
@ -622,14 +620,10 @@ _cmd_msg(const char * const inp, struct cmd_help_t help)
|
||||
|
||||
win_show_outgoing_msg("me", usr, msg);
|
||||
} else {
|
||||
char usage[strlen(help.usage + 8)];
|
||||
sprintf(usage, "Usage: %s", help.usage);
|
||||
cons_show(usage);
|
||||
cons_show("Usage: %s", help.usage);
|
||||
}
|
||||
} else {
|
||||
char usage[strlen(help.usage + 8)];
|
||||
sprintf(usage, "Usage: %s", help.usage);
|
||||
cons_show(usage);
|
||||
cons_show("Usage: %s", help.usage);
|
||||
}
|
||||
}
|
||||
|
||||
@ -670,9 +664,7 @@ _cmd_tiny(const char * const inp, struct cmd_help_t help)
|
||||
free(url);
|
||||
}
|
||||
} else {
|
||||
char usage[strlen(help.usage + 8)];
|
||||
sprintf(usage, "Usage: %s", help.usage);
|
||||
cons_show(usage);
|
||||
cons_show("Usage: %s", help.usage);
|
||||
|
||||
if (win_in_chat()) {
|
||||
char usage[strlen(help.usage + 8)];
|
||||
@ -739,9 +731,7 @@ static gboolean
|
||||
_cmd_set_remind(const char * const inp, struct cmd_help_t help)
|
||||
{
|
||||
if ((strncmp(inp, "/remind ", 8) != 0) || (strlen(inp) < 9)) {
|
||||
char usage[strlen(help.usage + 8)];
|
||||
sprintf(usage, "Usage: %s", help.usage);
|
||||
cons_show(usage);
|
||||
cons_show("Usage: %s", help.usage);
|
||||
} else {
|
||||
// copy input
|
||||
char inp_cpy[strlen(inp) + 1];
|
||||
@ -821,14 +811,10 @@ _update_presence(const jabber_presence_t presence,
|
||||
jabber_update_presence(presence, msg);
|
||||
title_bar_set_status(presence);
|
||||
if (msg != NULL) {
|
||||
char str[14 + strlen(show) + 3 + strlen(msg) + 2];
|
||||
sprintf(str, "Status set to %s, \"%s\"", show, msg);
|
||||
cons_show(str);
|
||||
cons_show("Status set to %s, \"%s\"", show, msg);
|
||||
free(msg);
|
||||
} else {
|
||||
char str[14 + strlen(show) + 1];
|
||||
sprintf(str, "Status set to %s", show);
|
||||
cons_show(str);
|
||||
cons_show("Status set to %s", show);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,11 +116,9 @@ void
|
||||
prof_handle_login_success(const char *jid)
|
||||
{
|
||||
const char *msg = " logged in successfully.";
|
||||
char line[strlen(jid) + 1 + strlen(msg) + 1];
|
||||
sprintf(line, "%s %s", jid, msg);
|
||||
cons_show("%s %s", jid, msg);
|
||||
title_bar_set_status(PRESENCE_ONLINE);
|
||||
cons_show(line);
|
||||
log_info(line);
|
||||
log_info("%s %s", jid, msg);
|
||||
win_page_off();
|
||||
status_bar_print_message(jid);
|
||||
status_bar_refresh();
|
||||
@ -173,14 +171,10 @@ prof_handle_roster(GSList *roster)
|
||||
while (roster != NULL) {
|
||||
jabber_roster_entry *entry = roster->data;
|
||||
if (entry->name != NULL) {
|
||||
char line[strlen(entry->name) + 2 + strlen(entry->jid) + 1 + 1];
|
||||
sprintf(line, "%s (%s)", entry->name, entry->jid);
|
||||
cons_show(line);
|
||||
cons_show("%s (%s)", entry->name, entry->jid);
|
||||
|
||||
} else {
|
||||
char line[strlen(entry->jid) + 1];
|
||||
sprintf(line, "%s", entry->jid);
|
||||
cons_show(line);
|
||||
cons_show("%s", entry->jid);
|
||||
}
|
||||
|
||||
roster = g_slist_next(roster);
|
||||
|
@ -489,11 +489,7 @@ cons_prefs(void)
|
||||
else
|
||||
cons_show("Chat logging : OFF");
|
||||
|
||||
char remind_period[50];
|
||||
sprintf(remind_period,
|
||||
"Message reminder period : %d seconds", prefs_get_remind());
|
||||
|
||||
cons_show(remind_period);
|
||||
cons_show("Message reminder period : %d seconds", prefs_get_remind());
|
||||
|
||||
cons_show("");
|
||||
|
||||
@ -509,9 +505,7 @@ _cons_show_basic_help(void)
|
||||
GSList *basic_helpers = cmd_get_basic_help();
|
||||
while (basic_helpers != NULL) {
|
||||
struct cmd_help_t *help = (struct cmd_help_t *)basic_helpers->data;
|
||||
char line[25 + 2 + strlen(help->short_help)];
|
||||
sprintf(line, "%-25s: %s", help->usage, help->short_help);
|
||||
cons_show(line);
|
||||
cons_show("%-25s: %s", help->usage, help->short_help);
|
||||
basic_helpers = g_slist_next(basic_helpers);
|
||||
}
|
||||
|
||||
@ -531,9 +525,7 @@ cons_help(void)
|
||||
GSList *settings_helpers = cmd_get_settings_help();
|
||||
while (settings_helpers != NULL) {
|
||||
struct cmd_help_t *help = (struct cmd_help_t *)settings_helpers->data;
|
||||
char line[25 + 2 + strlen(help->short_help)];
|
||||
sprintf(line, "%-25s: %s", help->usage, help->short_help);
|
||||
cons_show(line);
|
||||
cons_show("%-25s: %s", help->usage, help->short_help);
|
||||
settings_helpers = g_slist_next(settings_helpers);
|
||||
}
|
||||
|
||||
@ -544,9 +536,7 @@ cons_help(void)
|
||||
GSList *status_helpers = cmd_get_status_help();
|
||||
while (status_helpers != NULL) {
|
||||
struct cmd_help_t *help = (struct cmd_help_t *)status_helpers->data;
|
||||
char line[25 + 2 + strlen(help->short_help)];
|
||||
sprintf(line, "%-25s: %s", help->usage, help->short_help);
|
||||
cons_show(line);
|
||||
cons_show("%-25s: %s", help->usage, help->short_help);
|
||||
status_helpers = g_slist_next(status_helpers);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user