1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-16 21:35:24 +00:00

Allow utf8 symbols as omemo/pgp/otr indicator char

Fix https://github.com/profanity-im/profanity/issues/1264
This commit is contained in:
Michael Vetter 2020-02-20 18:11:08 +01:00
parent 280b718cfb
commit 1f8b1eb740
21 changed files with 643 additions and 622 deletions

File diff suppressed because it is too large Load Diff

View File

@ -868,82 +868,79 @@ prefs_get_roster_size(void)
}
}
char
char*
prefs_get_otr_char(void)
{
char result = '~';
char *result = "~";
char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_OTR, "otr.char", NULL);
if (!resultstr) {
result = '~';
result = strdup("~");
} else {
result = resultstr[0];
result = resultstr;
}
free(resultstr);
return result;
}
void
prefs_set_otr_char(char ch)
prefs_set_otr_char(char *ch)
{
char str[2];
str[0] = ch;
str[1] = '\0';
g_key_file_set_string(prefs, PREF_GROUP_OTR, "otr.char", str);
if (g_utf8_strlen(ch, 4) == 1) {
g_key_file_set_string(prefs, PREF_GROUP_OTR, "otr.char", ch);
} else {
log_error("Could not set otr char: %s", ch);
}
}
char
char*
prefs_get_pgp_char(void)
{
char result = '~';
char *result = "~";
char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_PGP, "pgp.char", NULL);
if (!resultstr) {
result = '~';
result = strdup("~");
} else {
result = resultstr[0];
result = resultstr;
}
free(resultstr);
return result;
}
void
prefs_set_pgp_char(char ch)
prefs_set_pgp_char(char *ch)
{
char str[2];
str[0] = ch;
str[1] = '\0';
g_key_file_set_string(prefs, PREF_GROUP_PGP, "pgp.char", str);
if (g_utf8_strlen(ch, 4) == 1) {
g_key_file_set_string(prefs, PREF_GROUP_PGP, "pgp.char", ch);
} else {
log_error("Could not set pgp char: %s", ch);
}
}
char
char*
prefs_get_omemo_char(void)
{
char result = '~';
char *result = "~";
char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_OMEMO, "omemo.char", NULL);
if (!resultstr) {
result = '~';
result = strdup("~");
} else {
result = resultstr[0];
result = resultstr;
}
free(resultstr);
return result;
}
void
prefs_set_omemo_char(char ch)
prefs_set_omemo_char(char *ch)
{
char str[2];
str[0] = ch;
str[1] = '\0';
g_key_file_set_string(prefs, PREF_GROUP_OMEMO, "omemo.char", str);
if (g_utf8_strlen(ch, 4) == 1) {
g_key_file_set_string(prefs, PREF_GROUP_OMEMO, "omemo.char", ch);
} else {
log_error("Could not set omemo char: %s", ch);
}
}
char
@ -1201,18 +1198,17 @@ prefs_set_roster_presence_indent(gint value)
g_key_file_set_integer(prefs, PREF_GROUP_UI, "roster.presence.indent", value);
}
char
char*
prefs_get_correction_char(void)
{
char result = '+';
char *result = "+";
char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "correction.char", NULL);
if (!resultstr) {
result = '+';
result = strdup("+");
} else {
result = resultstr[0];
result = resultstr;
}
free(resultstr);
return result;
}

View File

@ -232,12 +232,12 @@ void prefs_free_plugins(gchar **plugins);
void prefs_add_plugin(const char *const name);
void prefs_remove_plugin(const char *const name);
char prefs_get_otr_char(void);
void prefs_set_otr_char(char ch);
char prefs_get_pgp_char(void);
void prefs_set_pgp_char(char ch);
char prefs_get_omemo_char(void);
void prefs_set_omemo_char(char ch);
char* prefs_get_otr_char(void);
void prefs_set_otr_char(char *ch);
char* prefs_get_pgp_char(void);
void prefs_set_pgp_char(char *ch);
char* prefs_get_omemo_char(void);
void prefs_set_omemo_char(char *ch);
char prefs_get_roster_header_char(void);
void prefs_set_roster_header_char(char ch);
@ -273,7 +273,7 @@ void prefs_set_roster_presence_indent(gint value);
gint prefs_get_occupants_indent(void);
void prefs_set_occupants_indent(gint value);
char prefs_get_correction_char(void);
char* prefs_get_correction_char(void);
void prefs_set_correction_char(char ch);
void prefs_add_login(const char *jid);

View File

@ -461,24 +461,24 @@ _load_preferences(void)
if (g_key_file_has_key(theme, "ui", "otr.char", NULL)) {
gchar *ch = g_key_file_get_string(theme, "ui", "otr.char", NULL);
if (ch && strlen(ch) > 0) {
prefs_set_otr_char(ch[0]);
if (ch && g_utf8_strlen(ch, 4) == 1) {
prefs_set_otr_char(ch);
g_free(ch);
}
}
if (g_key_file_has_key(theme, "ui", "pgp.char", NULL)) {
gchar *ch = g_key_file_get_string(theme, "ui", "pgp.char", NULL);
if (ch && strlen(ch) > 0) {
prefs_set_pgp_char(ch[0]);
if (ch && g_utf8_strlen(ch, 4) == 1) {
prefs_set_pgp_char(ch);
g_free(ch);
}
}
if (g_key_file_has_key(theme, "ui", "omemo.char", NULL)) {
gchar *ch = g_key_file_get_string(theme, "ui", "omemo.char", NULL);
if (ch && strlen(ch) > 0) {
prefs_set_omemo_char(ch[0]);
if (ch && g_utf8_strlen(ch, 4) == 1) {
prefs_set_omemo_char(ch);
g_free(ch);
}
}

View File

@ -676,7 +676,7 @@ sv_ev_incoming_message(ProfMessage *message)
#ifdef HAVE_OMEMO
if (message->encrypted) {
if (chatwin->is_otr) {
win_println((ProfWin*)chatwin, THEME_DEFAULT, '-', "PGP encrypted message received whilst in OTR session.");
win_println((ProfWin*)chatwin, THEME_DEFAULT, "-", "PGP encrypted message received whilst in OTR session.");
} else {
_sv_ev_incoming_pgp(chatwin, new_win, message, TRUE);
}

View File

@ -353,14 +353,14 @@ otr_on_message_send(ProfChatWin *chatwin, const char *const message, gboolean re
free(id);
return TRUE;
} else {
win_println((ProfWin*)chatwin, THEME_ERROR, '-', "%s", "Failed to encrypt and send message.");
win_println((ProfWin*)chatwin, THEME_ERROR, "-", "%s", "Failed to encrypt and send message.");
return TRUE;
}
}
// show error if not secure and policy always
if (policy == PROF_OTRPOLICY_ALWAYS) {
win_println((ProfWin*)chatwin, THEME_ERROR, '-', "%s", "Failed to send message. OTR policy set to: always");
win_println((ProfWin*)chatwin, THEME_ERROR, "-", "%s", "Failed to send message. OTR policy set to: always");
return TRUE;
}

View File

@ -86,7 +86,7 @@ api_cons_show_themed(const char *const group, const char *const key, const char
char *parsed = str_replace(message, "\r\n", "\n");
theme_item_t themeitem = plugin_themes_get(group, key, def);
ProfWin *console = wins_get_console();
win_println(console, themeitem, '-', "%s", parsed);
win_println(console, themeitem, "-", "%s", parsed);
free(parsed);
@ -375,7 +375,7 @@ api_win_show(const char *tag, const char *line)
}
ProfWin *window = (ProfWin*)pluginwin;
win_println(window, THEME_DEFAULT, '!', "%s", line);
win_println(window, THEME_DEFAULT, "!", "%s", line);
return 1;
}
@ -400,7 +400,7 @@ api_win_show_themed(const char *tag, const char *const group, const char *const
theme_item_t themeitem = plugin_themes_get(group, key, def);
ProfWin *window = (ProfWin*)pluginwin;
win_println(window, themeitem, '!', "%s", line);
win_println(window, themeitem, "!", "%s", line);
return 1;
}
@ -522,7 +522,7 @@ api_encryption_reset(const char *const barejid)
#ifdef HAVE_LIBGPGME
if (chatwin->pgp_send) {
chatwin->pgp_send = FALSE;
win_println((ProfWin*)chatwin, THEME_DEFAULT, '!', "PGP encryption disabled.");
win_println((ProfWin*)chatwin, THEME_DEFAULT, "!", "PGP encryption disabled.");
}
#endif
@ -784,7 +784,7 @@ api_chat_show(const char *const barejid, const char *message)
}
char *parsed = str_replace(message, "\r\n", "\n");
win_println((ProfWin*)chatwin, THEME_TEXT, '-', "%s", parsed);
win_println((ProfWin*)chatwin, THEME_TEXT, "-", "%s", parsed);
free(parsed);
return 1;
@ -804,13 +804,13 @@ api_chat_show_themed(const char *const barejid, const char *const group, const c
return 0;
}
char show_ch = '-';
char *show_ch = "-";
if (ch) {
if (strlen(ch) != 1) {
if (g_utf8_strlen(ch, 4) != 1) {
log_warning("%s", "api_chat_show_themed failed, ch must be a string of length 1");
return 0;
} else {
show_ch = ch[0];
show_ch = (char*)ch;
}
}
@ -849,7 +849,7 @@ api_room_show(const char *const roomjid, const char *message)
}
char *parsed = str_replace(message, "\r\n", "\n");
win_println((ProfWin*)mucwin, THEME_TEXT, '-', "%s", parsed);
win_println((ProfWin*)mucwin, THEME_TEXT, "-", "%s", parsed);
free(parsed);
return 1;
@ -869,13 +869,13 @@ api_room_show_themed(const char *const roomjid, const char *const group, const c
return 0;
}
char show_ch = '-';
char *show_ch = "-";
if (ch) {
if (strlen(ch) != 1) {
if (g_utf8_strlen(ch, 4) != 1) {
log_warning("%s", "api_room_show_themed failed, ch must be a string of length 1");
return 0;
} else {
show_ch = ch[0];
show_ch = (char*)ch;
}
}

View File

@ -81,11 +81,11 @@ buffer_free(ProfBuff buffer)
}
void
buffer_append(ProfBuff buffer, const char show_char, int pad_indent, GDateTime *time,
buffer_append(ProfBuff buffer, const char *show_char, int pad_indent, GDateTime *time,
int flags, theme_item_t theme_item, const char *const display_from, const char *const message, DeliveryReceipt *receipt, const char *const id)
{
ProfBuffEntry *e = malloc(sizeof(struct prof_buff_entry_t));
e->show_char = show_char;
e->show_char = strdup(show_char);
e->pad_indent = pad_indent;
e->flags = flags;
e->theme_item = theme_item;
@ -163,6 +163,7 @@ buffer_get_entry_by_id(ProfBuff buffer, const char *const id)
static void
_free_entry(ProfBuffEntry *entry)
{
free(entry->show_char);
free(entry->message);
free(entry->display_from);
free(entry->id);

View File

@ -47,7 +47,8 @@ typedef struct delivery_receipt_t {
} DeliveryReceipt;
typedef struct prof_buff_entry_t {
char show_char;
// pointer because it could be a unicode symbol as well
char *show_char;
int pad_indent;
GDateTime *time;
int flags;
@ -65,7 +66,7 @@ typedef struct prof_buff_t *ProfBuff;
ProfBuff buffer_create();
void buffer_free(ProfBuff buffer);
void buffer_append(ProfBuff buffer, const char show_char, int pad_indent, GDateTime *time,
void buffer_append(ProfBuff buffer, const char *show_char, int pad_indent, GDateTime *time,
int flags, theme_item_t theme_item, const char *const display_from, const char *const message, DeliveryReceipt *receipt, const char *const id);
void buffer_remove_entry_by_id(ProfBuff buffer, const char *const id);
int buffer_size(ProfBuff buffer);

View File

@ -109,9 +109,9 @@ chatwin_otr_secured(ProfChatWin *chatwin, gboolean trusted)
ProfWin *window = (ProfWin*) chatwin;
if (trusted) {
win_println(window, THEME_OTR_STARTED_TRUSTED, '!', "OTR session started (trusted).");
win_println(window, THEME_OTR_STARTED_TRUSTED, "!", "OTR session started (trusted).");
} else {
win_println(window, THEME_OTR_STARTED_UNTRUSTED, '!', "OTR session started (untrusted).");
win_println(window, THEME_OTR_STARTED_UNTRUSTED, "!", "OTR session started (untrusted).");
}
if (wins_is_current(window)) {
@ -138,7 +138,7 @@ chatwin_otr_unsecured(ProfChatWin *chatwin)
chatwin->otr_is_trusted = FALSE;
ProfWin *window = (ProfWin*)chatwin;
win_println(window, THEME_OTR_ENDED, '!', "OTR session ended.");
win_println(window, THEME_OTR_ENDED, "!", "OTR session ended.");
if (wins_is_current(window)) {
title_bar_switch();
}
@ -151,41 +151,41 @@ chatwin_otr_smp_event(ProfChatWin *chatwin, prof_otr_smp_event_t event, void *da
switch (event) {
case PROF_OTR_SMP_INIT:
win_println((ProfWin*)chatwin, THEME_DEFAULT, '!',
win_println((ProfWin*)chatwin, THEME_DEFAULT, "!",
"%s wants to authenticate your identity, use '/otr secret <secret>'.", chatwin->barejid);
break;
case PROF_OTR_SMP_INIT_Q:
win_println((ProfWin*)chatwin, THEME_DEFAULT, '!',
win_println((ProfWin*)chatwin, THEME_DEFAULT, "!",
"%s wants to authenticate your identity with the following question:", chatwin->barejid);
win_println((ProfWin*)chatwin, THEME_DEFAULT, '!', " %s", (char*)data);
win_println((ProfWin*)chatwin, THEME_DEFAULT, '!', "use '/otr answer <answer>'.");
win_println((ProfWin*)chatwin, THEME_DEFAULT, "!", " %s", (char*)data);
win_println((ProfWin*)chatwin, THEME_DEFAULT, "!", "use '/otr answer <answer>'.");
break;
case PROF_OTR_SMP_SENDER_FAIL:
win_println((ProfWin*)chatwin, THEME_DEFAULT, '!',
win_println((ProfWin*)chatwin, THEME_DEFAULT, "!",
"Authentication failed, the secret you entered does not match the secret entered by %s.",
chatwin->barejid);
break;
case PROF_OTR_SMP_RECEIVER_FAIL:
win_println((ProfWin*)chatwin, THEME_DEFAULT, '!',
win_println((ProfWin*)chatwin, THEME_DEFAULT, "!",
"Authentication failed, the secret entered by %s does not match yours.", chatwin->barejid);
break;
case PROF_OTR_SMP_ABORT:
win_println((ProfWin*)chatwin, THEME_DEFAULT, '!', "SMP session aborted.");
win_println((ProfWin*)chatwin, THEME_DEFAULT, "!", "SMP session aborted.");
break;
case PROF_OTR_SMP_SUCCESS:
win_println((ProfWin*)chatwin, THEME_DEFAULT, '!', "Authentication successful.");
win_println((ProfWin*)chatwin, THEME_DEFAULT, "!", "Authentication successful.");
break;
case PROF_OTR_SMP_SUCCESS_Q:
win_println((ProfWin*)chatwin, THEME_DEFAULT, '!', "%s successfully authenticated you.", chatwin->barejid);
win_println((ProfWin*)chatwin, THEME_DEFAULT, "!", "%s successfully authenticated you.", chatwin->barejid);
break;
case PROF_OTR_SMP_FAIL_Q:
win_println((ProfWin*)chatwin, THEME_DEFAULT, '!', "%s failed to authenticate you.", chatwin->barejid);
win_println((ProfWin*)chatwin, THEME_DEFAULT, "!", "%s failed to authenticate you.", chatwin->barejid);
break;
case PROF_OTR_SMP_AUTH:
win_println((ProfWin*)chatwin, THEME_DEFAULT, '!', "Authenticating %s...", chatwin->barejid);
win_println((ProfWin*)chatwin, THEME_DEFAULT, "!", "Authenticating %s...", chatwin->barejid);
break;
case PROF_OTR_SMP_AUTH_WAIT:
win_println((ProfWin*)chatwin, THEME_DEFAULT, '!', "Awaiting authentication from %s...", chatwin->barejid);
win_println((ProfWin*)chatwin, THEME_DEFAULT, "!", "Awaiting authentication from %s...", chatwin->barejid);
break;
default:
break;
@ -201,7 +201,7 @@ chatwin_otr_trust(ProfChatWin *chatwin)
chatwin->otr_is_trusted = TRUE;
ProfWin *window = (ProfWin*)chatwin;
win_println(window, THEME_OTR_TRUSTED, '!', "OTR session trusted.");
win_println(window, THEME_OTR_TRUSTED, "!", "OTR session trusted.");
if (wins_is_current(window)) {
title_bar_switch();
}
@ -216,7 +216,7 @@ chatwin_otr_untrust(ProfChatWin *chatwin)
chatwin->otr_is_trusted = FALSE;
ProfWin *window = (ProfWin*)chatwin;
win_println(window, THEME_OTR_UNTRUSTED, '!', "OTR session untrusted.");
win_println(window, THEME_OTR_UNTRUSTED, "!", "OTR session untrusted.");
if (wins_is_current(window)) {
title_bar_switch();
}
@ -240,7 +240,7 @@ chatwin_recipient_gone(ProfChatWin *chatwin)
display_usr = chatwin->barejid;
}
win_println((ProfWin*)chatwin, THEME_GONE, '!', "<- %s has left the conversation.", display_usr);
win_println((ProfWin*)chatwin, THEME_GONE, "!", "<- %s has left the conversation.", display_usr);
}
void
@ -314,15 +314,17 @@ chatwin_outgoing_msg(ProfChatWin *chatwin, const char *const message, char *id,
{
assert(chatwin != NULL);
char enc_char = '-';
char *enc_char;
if (chatwin->outgoing_char) {
enc_char = chatwin->outgoing_char[0];
enc_char = chatwin->outgoing_char;
} else if (enc_mode == PROF_MSG_ENC_OTR) {
enc_char = prefs_get_otr_char();
} else if (enc_mode == PROF_MSG_ENC_PGP) {
enc_char = prefs_get_pgp_char();
} else if (enc_mode == PROF_MSG_ENC_OMEMO) {
enc_char = prefs_get_omemo_char();
} else {
enc_char = strdup("-");
}
if (request_receipt && id) {
@ -331,6 +333,8 @@ chatwin_outgoing_msg(ProfChatWin *chatwin, const char *const message, char *id,
win_print_outgoing((ProfWin*)chatwin, enc_char, id, replace_id, message);
}
free(enc_char);
// save last id and message for LMC
if (id) {
_chatwin_set_last_message(chatwin, id, message);
@ -342,11 +346,13 @@ chatwin_outgoing_carbon(ProfChatWin *chatwin, ProfMessage *message)
{
assert(chatwin != NULL);
char enc_char = '-';
char *enc_char;
if (message->enc == PROF_MSG_ENC_PGP) {
enc_char = prefs_get_pgp_char();
} else if (message->enc == PROF_MSG_ENC_OMEMO) {
enc_char = prefs_get_omemo_char();
} else {
enc_char = strdup("-");
}
ProfWin *window = (ProfWin*)chatwin;
@ -354,6 +360,8 @@ chatwin_outgoing_carbon(ProfChatWin *chatwin, ProfMessage *message)
win_print_outgoing(window, enc_char, message->id, message->replace_id, message->plain);
int num = wins_get_num(window);
status_bar_active(num, WIN_CHAT, chatwin->barejid);
free(enc_char);
}
void

View File

@ -48,12 +48,12 @@ confwin_show_form(ProfConfWin *confwin)
{
ProfWin *window = (ProfWin*) confwin;
if (confwin->form->title) {
win_print(window, THEME_DEFAULT, '-', "Form title: ");
win_print(window, THEME_DEFAULT, "-", "Form title: ");
win_appendln(window, THEME_DEFAULT, "%s", confwin->form->title);
} else {
win_println(window, THEME_DEFAULT, '-', "Configuration for room %s.", confwin->roomjid);
win_println(window, THEME_DEFAULT, "-", "Configuration for room %s.", confwin->roomjid);
}
win_println(window, THEME_DEFAULT, '-', "");
win_println(window, THEME_DEFAULT, "-", "");
confwin_form_help(confwin);
@ -65,7 +65,7 @@ confwin_show_form(ProfConfWin *confwin)
if ((g_strcmp0(field->type, "fixed") == 0) && field->values) {
if (field->values) {
char *value = field->values->data;
win_println(window, THEME_DEFAULT, '-', "%s", value);
win_println(window, THEME_DEFAULT, "-", "%s", value);
}
} else if (g_strcmp0(field->type, "hidden") != 0 && field->var) {
char *tag = g_hash_table_lookup(confwin->form->var_to_tag, field->var);
@ -84,7 +84,7 @@ confwin_show_form_field(ProfConfWin *confwin, DataForm *form, char *tag)
FormField *field = form_get_field_by_tag(form, tag);
ProfWin *window = (ProfWin*)confwin;
_confwin_form_field(window, tag, field);
win_println(window, THEME_DEFAULT, '-', "");
win_println(window, THEME_DEFAULT, "-", "");
}
void
@ -97,13 +97,13 @@ confwin_handle_configuration(ProfConfWin *confwin, DataForm *form)
confwin_show_form(confwin);
win_println(window, THEME_DEFAULT, '-', "");
win_println(window, THEME_DEFAULT, "-", "");
if (confwin->submit != NULL) {
win_println(window, THEME_DEFAULT, '-', "Use '/form submit' to save changes.");
win_println(window, THEME_DEFAULT, "-", "Use '/form submit' to save changes.");
}
win_println(window, THEME_DEFAULT, '-', "Use '/form cancel' to cancel changes.");
win_println(window, THEME_DEFAULT, '-', "See '/form help' for more information.");
win_println(window, THEME_DEFAULT, '-', "");
win_println(window, THEME_DEFAULT, "-", "Use '/form cancel' to cancel changes.");
win_println(window, THEME_DEFAULT, "-", "See '/form help' for more information.");
win_println(window, THEME_DEFAULT, "-", "");
}
void
@ -114,16 +114,16 @@ confwin_field_help(ProfConfWin *confwin, char *tag)
ProfWin *window = (ProfWin*) confwin;
FormField *field = form_get_field_by_tag(confwin->form, tag);
if (field) {
win_print(window, THEME_DEFAULT, '-', "%s", field->label);
win_print(window, THEME_DEFAULT, "-", "%s", field->label);
if (field->required) {
win_appendln(window, THEME_DEFAULT, " (Required):");
} else {
win_appendln(window, THEME_DEFAULT, ":");
}
if (field->description) {
win_println(window, THEME_DEFAULT, '-', " Description : %s", field->description);
win_println(window, THEME_DEFAULT, "-", " Description : %s", field->description);
}
win_println(window, THEME_DEFAULT, '-', " Type : %s", field->type);
win_println(window, THEME_DEFAULT, "-", " Type : %s", field->type);
int num_values = 0;
GSList *curr_option = NULL;
@ -132,51 +132,51 @@ confwin_field_help(ProfConfWin *confwin, char *tag)
switch (field->type_t) {
case FIELD_TEXT_SINGLE:
case FIELD_TEXT_PRIVATE:
win_println(window, THEME_DEFAULT, '-', " Set : /%s <value>", tag);
win_println(window, THEME_DEFAULT, '-', " Where : <value> is any text");
win_println(window, THEME_DEFAULT, "-", " Set : /%s <value>", tag);
win_println(window, THEME_DEFAULT, "-", " Where : <value> is any text");
break;
case FIELD_TEXT_MULTI:
num_values = form_get_value_count(confwin->form, tag);
win_println(window, THEME_DEFAULT, '-', " Add : /%s add <value>", tag);
win_println(window, THEME_DEFAULT, '-', " Where : <value> is any text");
win_println(window, THEME_DEFAULT, "-", " Add : /%s add <value>", tag);
win_println(window, THEME_DEFAULT, "-", " Where : <value> is any text");
if (num_values > 0) {
win_println(window, THEME_DEFAULT, '-', " Remove : /%s remove <value>", tag);
win_println(window, THEME_DEFAULT, '-', " Where : <value> between 'val1' and 'val%d'", num_values);
win_println(window, THEME_DEFAULT, "-", " Remove : /%s remove <value>", tag);
win_println(window, THEME_DEFAULT, "-", " Where : <value> between 'val1' and 'val%d'", num_values);
}
break;
case FIELD_BOOLEAN:
win_println(window, THEME_DEFAULT, '-', " Set : /%s <value>", tag);
win_println(window, THEME_DEFAULT, '-', " Where : <value> is either 'on' or 'off'");
win_println(window, THEME_DEFAULT, "-", " Set : /%s <value>", tag);
win_println(window, THEME_DEFAULT, "-", " Where : <value> is either 'on' or 'off'");
break;
case FIELD_LIST_SINGLE:
win_println(window, THEME_DEFAULT, '-', " Set : /%s <value>", tag);
win_println(window, THEME_DEFAULT, '-', " Where : <value> is one of");
win_println(window, THEME_DEFAULT, "-", " Set : /%s <value>", tag);
win_println(window, THEME_DEFAULT, "-", " Where : <value> is one of");
curr_option = field->options;
while (curr_option) {
option = curr_option->data;
win_println(window, THEME_DEFAULT, '-', " %s", option->value);
win_println(window, THEME_DEFAULT, "-", " %s", option->value);
curr_option = g_slist_next(curr_option);
}
break;
case FIELD_LIST_MULTI:
win_println(window, THEME_DEFAULT, '-', " Add : /%s add <value>", tag);
win_println(window, THEME_DEFAULT, '-', " Remove : /%s remove <value>", tag);
win_println(window, THEME_DEFAULT, '-', " Where : <value> is one of");
win_println(window, THEME_DEFAULT, "-", " Add : /%s add <value>", tag);
win_println(window, THEME_DEFAULT, "-", " Remove : /%s remove <value>", tag);
win_println(window, THEME_DEFAULT, "-", " Where : <value> is one of");
curr_option = field->options;
while (curr_option) {
option = curr_option->data;
win_println(window, THEME_DEFAULT, '-', " %s", option->value);
win_println(window, THEME_DEFAULT, "-", " %s", option->value);
curr_option = g_slist_next(curr_option);
}
break;
case FIELD_JID_SINGLE:
win_println(window, THEME_DEFAULT, '-', " Set : /%s <value>", tag);
win_println(window, THEME_DEFAULT, '-', " Where : <value> is a valid Jabber ID");
win_println(window, THEME_DEFAULT, "-", " Set : /%s <value>", tag);
win_println(window, THEME_DEFAULT, "-", " Where : <value> is a valid Jabber ID");
break;
case FIELD_JID_MULTI:
win_println(window, THEME_DEFAULT, '-', " Add : /%s add <value>", tag);
win_println(window, THEME_DEFAULT, '-', " Remove : /%s remove <value>", tag);
win_println(window, THEME_DEFAULT, '-', " Where : <value> is a valid Jabber ID");
win_println(window, THEME_DEFAULT, "-", " Add : /%s add <value>", tag);
win_println(window, THEME_DEFAULT, "-", " Remove : /%s remove <value>", tag);
win_println(window, THEME_DEFAULT, "-", " Where : <value> is a valid Jabber ID");
break;
case FIELD_FIXED:
case FIELD_UNKNOWN:
@ -185,7 +185,7 @@ confwin_field_help(ProfConfWin *confwin, char *tag)
break;
}
} else {
win_println(window, THEME_DEFAULT, '-', "No such field %s", tag);
win_println(window, THEME_DEFAULT, "-", "No such field %s", tag);
}
}
@ -196,16 +196,16 @@ confwin_form_help(ProfConfWin *confwin)
if (confwin->form->instructions) {
ProfWin *window = (ProfWin*) confwin;
win_println(window, THEME_DEFAULT, '-', "Supplied instructions:");
win_println(window, THEME_DEFAULT, '-', "%s", confwin->form->instructions);
win_println(window, THEME_DEFAULT, '-', "");
win_println(window, THEME_DEFAULT, "-", "Supplied instructions:");
win_println(window, THEME_DEFAULT, "-", "%s", confwin->form->instructions);
win_println(window, THEME_DEFAULT, "-", "");
}
}
static void
_confwin_form_field(ProfWin *window, char *tag, FormField *field)
{
win_print(window, THEME_AWAY, '-', "[%s] ", tag);
win_print(window, THEME_AWAY, "-", "[%s] ", tag);
win_append(window, THEME_DEFAULT, "%s", field->label);
if (field->required) {
win_append(window, THEME_DEFAULT, " (required): ");
@ -248,7 +248,7 @@ _confwin_form_field(ProfWin *window, char *tag, FormField *field)
char *value = curr_value->data;
GString *val_tag = g_string_new("");
g_string_printf(val_tag, "val%d", index++);
win_println(window, THEME_ONLINE, '-', " [%s] %s", val_tag->str, value);
win_println(window, THEME_ONLINE, "-", " [%s] %s", val_tag->str, value);
g_string_free(val_tag, TRUE);
curr_value = g_slist_next(curr_value);
}
@ -278,9 +278,9 @@ _confwin_form_field(ProfWin *window, char *tag, FormField *field)
while (curr_option) {
FormOption *option = curr_option->data;
if (g_strcmp0(option->value, value) == 0) {
win_println(window, THEME_ONLINE, '-', " [%s] %s", option->value, option->label);
win_println(window, THEME_ONLINE, "-", " [%s] %s", option->value, option->label);
} else {
win_println(window, THEME_OFFLINE, '-', " [%s] %s", option->value, option->label);
win_println(window, THEME_OFFLINE, "-", " [%s] %s", option->value, option->label);
}
curr_option = g_slist_next(curr_option);
}
@ -294,9 +294,9 @@ _confwin_form_field(ProfWin *window, char *tag, FormField *field)
while (curr_option) {
FormOption *option = curr_option->data;
if (g_slist_find_custom(curr_value, option->value, (GCompareFunc)g_strcmp0)) {
win_println(window, THEME_ONLINE, '-', " [%s] %s", option->value, option->label);
win_println(window, THEME_ONLINE, "-", " [%s] %s", option->value, option->label);
} else {
win_println(window, THEME_OFFLINE, '-', " [%s] %s", option->value, option->label);
win_println(window, THEME_OFFLINE, "-", " [%s] %s", option->value, option->label);
}
curr_option = g_slist_next(curr_option);
}
@ -315,7 +315,7 @@ _confwin_form_field(ProfWin *window, char *tag, FormField *field)
win_newline(window);
while (curr_value) {
char *value = curr_value->data;
win_println(window, THEME_ONLINE, '-', " %s", value);
win_println(window, THEME_ONLINE, "-", " %s", value);
curr_value = g_slist_next(curr_value);
}
break;

View File

@ -74,7 +74,7 @@ cons_debug(const char *const msg, ...)
va_start(arg, msg);
GString *fmt_msg = g_string_new(NULL);
g_string_vprintf(fmt_msg, msg, arg);
win_println(console, THEME_DEFAULT, '-', "%s", fmt_msg->str);
win_println(console, THEME_DEFAULT, "-", "%s", fmt_msg->str);
g_string_free(fmt_msg, TRUE);
va_end(arg);
}
@ -88,7 +88,7 @@ cons_show(const char *const msg, ...)
va_start(arg, msg);
GString *fmt_msg = g_string_new(NULL);
g_string_vprintf(fmt_msg, msg, arg);
win_println(console, THEME_DEFAULT, '-', "%s", fmt_msg->str);
win_println(console, THEME_DEFAULT, "-", "%s", fmt_msg->str);
g_string_free(fmt_msg, TRUE);
va_end(arg);
}
@ -112,8 +112,8 @@ cons_show_help(const char *const cmd, CommandHelp *help)
ProfWin *console = wins_get_console();
cons_show("");
win_println(console, THEME_HELP_HEADER, '-', "%s", &cmd[1]);
win_print(console, THEME_HELP_HEADER, '-', "");
win_println(console, THEME_HELP_HEADER, "-", "%s", &cmd[1]);
win_print(console, THEME_HELP_HEADER, "-", "");
int i;
for (i = 0; i < strlen(cmd) - 1 ; i++) {
win_append(console, THEME_HELP_HEADER, "-");
@ -121,12 +121,12 @@ cons_show_help(const char *const cmd, CommandHelp *help)
win_appendln(console, THEME_HELP_HEADER, "");
cons_show("");
win_println(console, THEME_HELP_HEADER, '-', "Synopsis");
win_println(console, THEME_HELP_HEADER, "-", "Synopsis");
ui_show_lines(console, help->synopsis);
cons_show("");
win_println(console, THEME_HELP_HEADER, '-', "Description");
win_println(console, THEME_DEFAULT, '-', "%s", help->desc);
win_println(console, THEME_HELP_HEADER, "-", "Description");
win_println(console, THEME_DEFAULT, "-", "%s", help->desc);
int maxlen = 0;
for (i = 0; help->args[i][0] != NULL; i++) {
@ -136,7 +136,7 @@ cons_show_help(const char *const cmd, CommandHelp *help)
if (i > 0) {
cons_show("");
win_println(console, THEME_HELP_HEADER, '-', "Arguments");
win_println(console, THEME_HELP_HEADER, "-", "Arguments");
for (i = 0; help->args[i][0] != NULL; i++) {
win_println_indent(console, maxlen + 3, "%-*s: %s", maxlen + 1, help->args[i][0], help->args[i][1]);
}
@ -144,7 +144,7 @@ cons_show_help(const char *const cmd, CommandHelp *help)
if (g_strv_length((gchar**)help->examples) > 0) {
cons_show("");
win_println(console, THEME_HELP_HEADER, '-', "Examples");
win_println(console, THEME_HELP_HEADER, "-", "Examples");
ui_show_lines(console, help->examples);
}
}
@ -169,7 +169,7 @@ cons_show_error(const char *const msg, ...)
va_start(arg, msg);
GString *fmt_msg = g_string_new(NULL);
g_string_vprintf(fmt_msg, msg, arg);
win_println(console, THEME_ERROR, '-', "%s", fmt_msg->str);
win_println(console, THEME_ERROR, "-", "%s", fmt_msg->str);
g_string_free(fmt_msg, TRUE);
va_end(arg);
@ -284,7 +284,7 @@ cons_show_typing(const char *const barejid)
display_usr = barejid;
}
win_println(console, THEME_TYPING, '-', "!! %s is typing a message...", display_usr);
win_println(console, THEME_TYPING, "-", "!! %s is typing a message...", display_usr);
cons_alert();
}
@ -321,27 +321,27 @@ cons_show_incoming_room_message(const char *const nick, const char *const room,
if (g_strcmp0(muc_show, "all") == 0) {
if (mention) {
win_println(console, THEME_MENTION, '-', "<< room mention: %s in %s (win %d)", nick, room, ui_index);
win_println(console, THEME_MENTION, "-", "<< room mention: %s in %s (win %d)", nick, room, ui_index);
} else if (triggers) {
char *triggers_str = _room_triggers_to_string(triggers);
win_println(console, THEME_TRIGGER, '-', "<< room trigger %s: %s in %s (win %d)", triggers_str, nick, room, ui_index);
win_println(console, THEME_TRIGGER, "-", "<< room trigger %s: %s in %s (win %d)", triggers_str, nick, room, ui_index);
free(triggers_str);
} else {
win_println(console, THEME_INCOMING, '-', "<< room message: %s in %s (win %d)", nick, room, ui_index);
win_println(console, THEME_INCOMING, "-", "<< room message: %s in %s (win %d)", nick, room, ui_index);
}
cons_alert();
} else if (g_strcmp0(muc_show, "first") == 0) {
if (mention) {
win_println(console, THEME_MENTION, '-', "<< room mention: %s in %s (win %d)", nick, room, ui_index);
win_println(console, THEME_MENTION, "-", "<< room mention: %s in %s (win %d)", nick, room, ui_index);
cons_alert();
} else if (triggers) {
char *triggers_str = _room_triggers_to_string(triggers);
win_println(console, THEME_TRIGGER, '-', "<< room trigger %s: %s in %s (win %d)", triggers_str, nick, room, ui_index);
win_println(console, THEME_TRIGGER, "-", "<< room trigger %s: %s in %s (win %d)", triggers_str, nick, room, ui_index);
free(triggers_str);
cons_alert();
} else if (unread == 0) {
win_println(console, THEME_INCOMING, '-', "<< room message: %s (win %d)", room, ui_index);
win_println(console, THEME_INCOMING, "-", "<< room message: %s (win %d)", room, ui_index);
cons_alert();
}
}
@ -360,10 +360,10 @@ cons_show_incoming_message(const char *const short_from, const int win_index, in
char *chat_show = prefs_get_string(PREF_CONSOLE_CHAT);
if (g_strcmp0(chat_show, "all") == 0) {
win_println(console, THEME_INCOMING, '-', "<< chat message: %s (win %d)", short_from, ui_index);
win_println(console, THEME_INCOMING, "-", "<< chat message: %s (win %d)", short_from, ui_index);
cons_alert();
} else if ((g_strcmp0(chat_show, "first") == 0) && unread == 0) {
win_println(console, THEME_INCOMING, '-', "<< chat message: %s (win %d)", short_from, ui_index);
win_println(console, THEME_INCOMING, "-", "<< chat message: %s (win %d)", short_from, ui_index);
cons_alert();
}
@ -382,10 +382,10 @@ cons_show_incoming_private_message(const char *const nick, const char *const roo
char *priv_show = prefs_get_string(PREF_CONSOLE_PRIVATE);
if (g_strcmp0(priv_show, "all") == 0) {
win_println(console, THEME_INCOMING, '-', "<< private message: %s in %s (win %d)", nick, room, ui_index);
win_println(console, THEME_INCOMING, "-", "<< private message: %s in %s (win %d)", nick, room, ui_index);
cons_alert();
} else if ((g_strcmp0(priv_show, "first") == 0) && unread == 0) {
win_println(console, THEME_INCOMING, '-', "<< private message: %s in %s (win %d)", nick, room, ui_index);
win_println(console, THEME_INCOMING, "-", "<< private message: %s in %s (win %d)", nick, room, ui_index);
cons_alert();
}
@ -405,24 +405,24 @@ cons_about(void)
if (strcmp(PACKAGE_STATUS, "development") == 0) {
#ifdef HAVE_GIT_VERSION
win_println(console, THEME_DEFAULT, '-', "Welcome to Profanity, version %sdev.%s.%s", PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION);
win_println(console, THEME_DEFAULT, "-", "Welcome to Profanity, version %sdev.%s.%s", PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION);
#else
win_println(console, THEME_DEFAULT, "Welcome to Profanity, version %sdev", PACKAGE_VERSION);
#endif
} else {
win_println(console, THEME_DEFAULT, '-', "Welcome to Profanity, version %s", PACKAGE_VERSION);
win_println(console, THEME_DEFAULT, "-", "Welcome to Profanity, version %s", PACKAGE_VERSION);
}
}
win_println(console, THEME_DEFAULT, '-', "Copyright (C) 2012 - 2019 James Booth <boothj5web@gmail.com>.");
win_println(console, THEME_DEFAULT, '-', "Copyright (C) 2019 - 2020 Michael Vetter <jubalh@iodoru.org>.");
win_println(console, THEME_DEFAULT, '-', "License GPLv3+: GNU GPL version 3 or later <https://www.gnu.org/licenses/gpl.html>");
win_println(console, THEME_DEFAULT, '-', "");
win_println(console, THEME_DEFAULT, '-', "This is free software; you are free to change and redistribute it.");
win_println(console, THEME_DEFAULT, '-', "There is NO WARRANTY, to the extent permitted by law.");
win_println(console, THEME_DEFAULT, '-', "");
win_println(console, THEME_DEFAULT, '-', "Type '/help' to show complete help.");
win_println(console, THEME_DEFAULT, '-', "");
win_println(console, THEME_DEFAULT, "-", "Copyright (C) 2012 - 2019 James Booth <boothj5web@gmail.com>.");
win_println(console, THEME_DEFAULT, "-", "Copyright (C) 2019 - 2020 Michael Vetter <jubalh@iodoru.org>.");
win_println(console, THEME_DEFAULT, "-", "License GPLv3+: GNU GPL version 3 or later <https://www.gnu.org/licenses/gpl.html>");
win_println(console, THEME_DEFAULT, "-", "");
win_println(console, THEME_DEFAULT, "-", "This is free software; you are free to change and redistribute it.");
win_println(console, THEME_DEFAULT, "-", "There is NO WARRANTY, to the extent permitted by law.");
win_println(console, THEME_DEFAULT, "-", "");
win_println(console, THEME_DEFAULT, "-", "Type '/help' to show complete help.");
win_println(console, THEME_DEFAULT, "-", "");
if (prefs_get_boolean(PREF_VERCHECK)) {
cons_check_version(FALSE);
@ -444,13 +444,13 @@ cons_check_version(gboolean not_available_msg)
if (relase_valid) {
if (release_is_new(latest_release)) {
win_println(console, THEME_DEFAULT, '-', "A new version of Profanity is available: %s", latest_release);
win_println(console, THEME_DEFAULT, '-', "Check <https://profanity-im.github.io> for details.");
win_println(console, THEME_DEFAULT, '-', "");
win_println(console, THEME_DEFAULT, "-", "A new version of Profanity is available: %s", latest_release);
win_println(console, THEME_DEFAULT, "-", "Check <https://profanity-im.github.io> for details.");
win_println(console, THEME_DEFAULT, "-", "");
} else {
if (not_available_msg) {
win_println(console, THEME_DEFAULT, '-', "No new version available.");
win_println(console, THEME_DEFAULT, '-', "");
win_println(console, THEME_DEFAULT, "-", "No new version available.");
win_println(console, THEME_DEFAULT, "-", "");
}
}
@ -466,7 +466,7 @@ cons_show_login_success(ProfAccount *account, gboolean secured)
ProfWin *console = wins_get_console();
const char *fulljid = connection_get_fulljid();
win_print(console, THEME_DEFAULT, '-', "%s logged in successfully, ", fulljid);
win_print(console, THEME_DEFAULT, "-", "%s logged in successfully, ", fulljid);
resource_presence_t presence = accounts_get_login_presence(account->name);
const char *presence_str = string_from_resource_presence(presence);
@ -500,9 +500,9 @@ cons_show_wins(gboolean unread)
GSList *curr = window_strings;
while (curr) {
if (g_strstr_len(curr->data, strlen(curr->data), " unread") > 0) {
win_println(console, THEME_CMD_WINS_UNREAD, '-', "%s", curr->data);
win_println(console, THEME_CMD_WINS_UNREAD, "-", "%s", curr->data);
} else {
win_println(console, THEME_DEFAULT, '-', "%s", curr->data);
win_println(console, THEME_DEFAULT, "-", "%s", curr->data);
}
curr = g_slist_next(curr);
}
@ -548,13 +548,13 @@ cons_show_caps(const char *const fulljid, resource_presence_t presence)
const char *resource_presence = string_from_resource_presence(presence);
theme_item_t presence_colour = theme_main_presence_attrs(resource_presence);
win_print(console, presence_colour, '-', "%s", fulljid);
win_print(console, presence_colour, "-", "%s", fulljid);
win_appendln(console, THEME_DEFAULT, ":");
// show identity
if (caps->identity) {
DiscoIdentity *identity = caps->identity;
win_print(console, THEME_DEFAULT, '-', "Identity: ");
win_print(console, THEME_DEFAULT, "-", "Identity: ");
if (identity->name) {
win_append(console, THEME_DEFAULT, "%s", identity->name);
if (identity->category || identity->type) {
@ -576,7 +576,7 @@ cons_show_caps(const char *const fulljid, resource_presence_t presence)
if (caps->software_version) {
SoftwareVersion *software_version = caps->software_version;
if (software_version->software) {
win_print(console, THEME_DEFAULT, '-', "Software: %s", software_version->software);
win_print(console, THEME_DEFAULT, "-", "Software: %s", software_version->software);
}
if (software_version->software_version) {
win_append(console, THEME_DEFAULT, ", %s", software_version->software_version);
@ -585,7 +585,7 @@ cons_show_caps(const char *const fulljid, resource_presence_t presence)
win_newline(console);
}
if (software_version->os) {
win_print(console, THEME_DEFAULT, '-', "OS: %s", software_version->os);
win_print(console, THEME_DEFAULT, "-", "OS: %s", software_version->os);
}
if (software_version->os_version) {
win_append(console, THEME_DEFAULT, ", %s", software_version->os_version);
@ -596,10 +596,10 @@ cons_show_caps(const char *const fulljid, resource_presence_t presence)
}
if (caps->features) {
win_println(console, THEME_DEFAULT, '-', "Features:");
win_println(console, THEME_DEFAULT, "-", "Features:");
GSList *feature = caps->features;
while (feature) {
win_println(console, THEME_DEFAULT, '-', " %s", feature->data);
win_println(console, THEME_DEFAULT, "-", " %s", feature->data);
feature = g_slist_next(feature);
}
}
@ -661,7 +661,7 @@ cons_show_room_list(GSList *rooms, const char *const conference_node)
cons_show("Chat rooms at %s:", conference_node);
while (rooms) {
DiscoItem *room = rooms->data;
win_print(console, THEME_DEFAULT, '-', " %s", room->jid);
win_print(console, THEME_DEFAULT, "-", " %s", room->jid);
if (room->name) {
win_append(console, THEME_DEFAULT, ", (%s)", room->name);
}
@ -696,7 +696,7 @@ cons_show_bookmarks(const GList *list)
if (muc_active(item->barejid) && roomwin) {
presence_colour = THEME_ONLINE;
}
win_print(console, presence_colour, '-', " %s", item->barejid);
win_print(console, presence_colour, "-", " %s", item->barejid);
if (item->nick) {
win_append(console, presence_colour, "/%s", item->nick);
}
@ -776,7 +776,7 @@ cons_show_disco_items(GSList *items, const char *const jid)
cons_show("Service discovery items for %s:", jid);
while (items) {
DiscoItem *item = items->data;
win_print(console, THEME_DEFAULT, '-', " %s", item->jid);
win_print(console, THEME_DEFAULT, "-", " %s", item->jid);
if (item->name) {
win_append(console, THEME_DEFAULT, ", (%s)", item->name);
}
@ -855,7 +855,7 @@ cons_show_account_list(gchar **accounts)
(g_strcmp0(session_get_account_name(), accounts[i]) == 0)) {
resource_presence_t presence = accounts_get_last_presence(accounts[i]);
theme_item_t presence_colour = theme_main_presence_attrs(string_from_resource_presence(presence));
win_println(console, presence_colour, '-', "%s", accounts[i]);
win_println(console, presence_colour, "-", "%s", accounts[i]);
} else {
cons_show(accounts[i]);
}
@ -974,7 +974,7 @@ cons_show_account(ProfAccount *account)
GList *curr = resources;
if (curr) {
win_println(console, THEME_DEFAULT, '-', "Resources:");
win_println(console, THEME_DEFAULT, "-", "Resources:");
// sort in order of availability
while (curr) {
@ -992,7 +992,7 @@ cons_show_account(ProfAccount *account)
Resource *resource = curr->data;
const char *resource_presence = string_from_resource_presence(resource->presence);
theme_item_t presence_colour = theme_main_presence_attrs(resource_presence);
win_print(console, presence_colour, '-', " %s (%d), %s", resource->name, resource->priority, resource_presence);
win_print(console, presence_colour, "-", " %s (%d), %s", resource->name, resource->priority, resource_presence);
if (resource->status) {
win_append(console, presence_colour, ", \"%s\"", resource->status);
@ -1006,7 +1006,7 @@ cons_show_account(ProfAccount *account)
// show identity
if (caps->identity) {
DiscoIdentity *identity = caps->identity;
win_print(console, THEME_DEFAULT, '-', " Identity: ");
win_print(console, THEME_DEFAULT, "-", " Identity: ");
if (identity->name) {
win_append(console, THEME_DEFAULT, "%s", identity->name);
if (identity->category || identity->type) {
@ -1028,7 +1028,7 @@ cons_show_account(ProfAccount *account)
if (caps->software_version) {
SoftwareVersion *software_version = caps->software_version;
if (software_version->software) {
win_print(console, THEME_DEFAULT, '-', " Software: %s", software_version->software);
win_print(console, THEME_DEFAULT, "-", " Software: %s", software_version->software);
}
if (software_version->software_version) {
win_append(console, THEME_DEFAULT, ", %s", software_version->software_version);
@ -1037,7 +1037,7 @@ cons_show_account(ProfAccount *account)
win_newline(console);
}
if (software_version->os) {
win_print(console, THEME_DEFAULT, '-', " OS: %s", software_version->os);
win_print(console, THEME_DEFAULT, "-", " OS: %s", software_version->os);
}
if (software_version->os_version) {
win_append(console, THEME_DEFAULT, ", %s", software_version->os_version);
@ -2034,8 +2034,9 @@ cons_correction_setting(void)
cons_show("Last Message Correction (XEP-0308) (/correction) : OFF");
}
char cc = prefs_get_correction_char();
char *cc = prefs_get_correction_char();
cons_show("LMC indication char (/correction char) : %c", cc);
free(cc);
}
void
@ -2071,8 +2072,9 @@ cons_show_otr_prefs(void)
}
prefs_free_string(log_value);
char ch = prefs_get_otr_char();
cons_show("OTR char (/otr char) : %c", ch);
char *ch = prefs_get_otr_char();
cons_show("OTR char (/otr char) : %s", ch);
free(ch);
if (prefs_get_boolean(PREF_OTR_SENDFILE)) {
cons_show("Allow sending unencrypted files in an OTR session via /sendfile (/otr sendfile): ON");
@ -2099,8 +2101,9 @@ cons_show_pgp_prefs(void)
}
prefs_free_string(log_value);
char ch = prefs_get_pgp_char();
cons_show("PGP char (/pgp char) : %c", ch);
char *ch = prefs_get_pgp_char();
cons_show("PGP char (/pgp char) : %s", ch);
free(ch);
if (prefs_get_boolean(PREF_PGP_SENDFILE)) {
cons_show("Allow sending unencrypted files via /sendfile while otherwise using PGP (/pgp sendfile): ON");
@ -2131,8 +2134,9 @@ cons_show_omemo_prefs(void)
}
prefs_free_string(log_value);
char ch = prefs_get_omemo_char();
cons_show("OMEMO char (/omemo char) : %c", ch);
char *ch = prefs_get_omemo_char();
cons_show("OMEMO char (/omemo char) : %s", ch);
free(ch);
if (prefs_get_boolean(PREF_OMEMO_SENDFILE)) {
cons_show("Allow sending unencrypted files in an OMEMO session via /sendfile (/omemo sendfile): ON");
@ -2252,7 +2256,7 @@ cons_navigation_help(void)
{
ProfWin *console = wins_get_console();
cons_show("");
win_println(console, THEME_HELP_HEADER, '-', "Navigation");
win_println(console, THEME_HELP_HEADER, "-", "Navigation");
cons_show("Alt-1..Alt-0, F1..F10 : Choose window.");
cons_show("Alt-LEFT, Alt-RIGHT : Previous/next chat window.");
cons_show("PAGEUP, PAGEDOWN : Page the main window.");
@ -2358,7 +2362,7 @@ _cons_theme_bar_prop(theme_item_t theme, char *prop)
GString *propstr = g_string_new(" ");
g_string_append_printf(propstr, "%-24s", prop);
win_print(console, THEME_TEXT, '-', "%s", propstr->str);
win_print(console, THEME_TEXT, "-", "%s", propstr->str);
g_string_free(propstr, TRUE);
GString *valstr = g_string_new(" ");
@ -2377,7 +2381,7 @@ _cons_theme_prop(theme_item_t theme, char *prop)
GString *propstr = g_string_new(" ");
g_string_append_printf(propstr, "%-24s", prop);
win_print(console, THEME_TEXT, '-', "%s", propstr->str);
win_print(console, THEME_TEXT, "-", "%s", propstr->str);
g_string_free(propstr, TRUE);
GString *valstr = g_string_new("");
@ -2503,28 +2507,28 @@ cons_theme_colours(void)
ProfWin *console = wins_get_console();
cons_show("Available colours:");
win_print(console, THEME_WHITE, '-', " white ");
win_print(console, THEME_WHITE, "-", " white ");
win_appendln(console, THEME_WHITE_BOLD, " bold_white");
win_print(console, THEME_GREEN, '-', " green ");
win_print(console, THEME_GREEN, "-", " green ");
win_appendln(console, THEME_GREEN_BOLD, " bold_green");
win_print(console, THEME_RED, '-', " red ");
win_print(console, THEME_RED, "-", " red ");
win_appendln(console, THEME_RED_BOLD, " bold_red");
win_print(console, THEME_YELLOW, '-', " yellow ");
win_print(console, THEME_YELLOW, "-", " yellow ");
win_appendln(console, THEME_YELLOW_BOLD, " bold_yellow");
win_print(console, THEME_BLUE, '-', " blue ");
win_print(console, THEME_BLUE, "-", " blue ");
win_appendln(console, THEME_BLUE_BOLD, " bold_blue");
win_print(console, THEME_CYAN, '-', " cyan ");
win_print(console, THEME_CYAN, "-", " cyan ");
win_appendln(console, THEME_CYAN_BOLD, " bold_cyan");
win_print(console, THEME_MAGENTA, '-', " magenta ");
win_print(console, THEME_MAGENTA, "-", " magenta ");
win_appendln(console, THEME_MAGENTA_BOLD, " bold_magenta");
win_print(console, THEME_BLACK, '-', " black ");
win_print(console, THEME_BLACK, "-", " black ");
win_appendln(console, THEME_BLACK_BOLD, " bold_black");
if (COLORS >= 256) {
@ -2541,25 +2545,25 @@ static void
_cons_splash_logo(void)
{
ProfWin *console = wins_get_console();
win_println(console, THEME_DEFAULT, '-', "Welcome to");
win_println(console, THEME_DEFAULT, "-", "Welcome to");
win_println(console, THEME_SPLASH, '-', " ___ _ ");
win_println(console, THEME_SPLASH, '-', " / __) (_)_ ");
win_println(console, THEME_SPLASH, '-', " ____ ___ ___ | |__ ____ ____ _| |_ _ _ ");
win_println(console, THEME_SPLASH, '-', "| _ \\ / __) _ \\| __) _ | _ \\| | _) | | |");
win_println(console, THEME_SPLASH, '-', "| | ) | | | (_) | | | ( | | | | | | |_| |_| |");
win_println(console, THEME_SPLASH, '-', "| ||_/|_| \\___/|_| \\_||_|_| |_|_|\\___)__ |");
win_println(console, THEME_SPLASH, '-', "|_| (____/ ");
win_println(console, THEME_SPLASH, '-', "");
win_println(console, THEME_SPLASH, "-", " ___ _ ");
win_println(console, THEME_SPLASH, "-", " / __) (_)_ ");
win_println(console, THEME_SPLASH, "-", " ____ ___ ___ | |__ ____ ____ _| |_ _ _ ");
win_println(console, THEME_SPLASH, "-", "| _ \\ / __) _ \\| __) _ | _ \\| | _) | | |");
win_println(console, THEME_SPLASH, "-", "| | ) | | | (_) | | | ( | | | | | | |_| |_| |");
win_println(console, THEME_SPLASH, "-", "| ||_/|_| \\___/|_| \\_||_|_| |_|_|\\___)__ |");
win_println(console, THEME_SPLASH, "-", "|_| (____/ ");
win_println(console, THEME_SPLASH, "-", "");
if (strcmp(PACKAGE_STATUS, "development") == 0) {
#ifdef HAVE_GIT_VERSION
win_println(console, THEME_DEFAULT, '-', "Version %sdev.%s.%s", PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION);
win_println(console, THEME_DEFAULT, "-", "Version %sdev.%s.%s", PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION);
#else
win_println(console, THEME_DEFAULT, "Version %sdev", PACKAGE_VERSION);
#endif
} else {
win_println(console, THEME_DEFAULT, '-', "Version %s", PACKAGE_VERSION);
win_println(console, THEME_DEFAULT, "-", "Version %s", PACKAGE_VERSION);
}
}
@ -2586,7 +2590,7 @@ _show_roster_contacts(GSList *list, gboolean show_groups)
} else {
presence_colour = theme_main_presence_attrs("offline");
}
win_print(console, presence_colour, '-', "%s", title->str);
win_print(console, presence_colour, "-", "%s", title->str);
g_string_free(title, TRUE);

View File

@ -414,19 +414,19 @@ ui_handle_recipient_error(const char *const recipient, const char *const err_msg
ProfChatWin *chatwin = wins_get_chat(recipient);
if (chatwin) {
win_println((ProfWin*)chatwin, THEME_ERROR, '!', "Error from %s: %s", recipient, err_msg);
win_println((ProfWin*)chatwin, THEME_ERROR, "!", "Error from %s: %s", recipient, err_msg);
return;
}
ProfMucWin *mucwin = wins_get_muc(recipient);
if (mucwin) {
win_println((ProfWin*)mucwin, THEME_ERROR, '!', "Error from %s: %s", recipient, err_msg);
win_println((ProfWin*)mucwin, THEME_ERROR, "!", "Error from %s: %s", recipient, err_msg);
return;
}
ProfPrivateWin *privatewin = wins_get_private(recipient);
if (privatewin) {
win_println((ProfWin*)privatewin, THEME_ERROR, '!', "Error from %s: %s", recipient, err_msg);
win_println((ProfWin*)privatewin, THEME_ERROR, "!", "Error from %s: %s", recipient, err_msg);
return;
}
}
@ -436,7 +436,7 @@ ui_handle_otr_error(const char *const barejid, const char *const message)
{
ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) {
win_println((ProfWin*)chatwin, THEME_ERROR, '!', "%s", message);
win_println((ProfWin*)chatwin, THEME_ERROR, "!", "%s", message);
} else {
cons_show_error("%s - %s", barejid, message);
}
@ -467,7 +467,7 @@ ui_invalid_command_usage(const char *const cmd, void (*setting_func)(void))
cons_show(msg->str);
ProfWin *current = wins_get_current();
if (current->type == WIN_CHAT) {
win_println(current, THEME_DEFAULT, '-', "%s", msg->str);
win_println(current, THEME_DEFAULT, "-", "%s", msg->str);
}
}
@ -778,7 +778,7 @@ ui_print_system_msg_from_recipient(const char *const barejid, const char *messag
}
}
win_println(window, THEME_DEFAULT, '-', "*%s %s", barejid, message);
win_println(window, THEME_DEFAULT, "-", "*%s %s", barejid, message);
}
void
@ -791,7 +791,7 @@ ui_room_join(const char *const roomjid, gboolean focus)
ProfWin *window = (ProfWin*)mucwin;
char *nick = muc_nick(roomjid);
win_print(window, THEME_ROOMINFO, '!', "-> You have joined the room as %s", nick);
win_print(window, THEME_ROOMINFO, "!", "-> You have joined the room as %s", nick);
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
char *role = muc_role_str(roomjid);
char *affiliation = muc_affiliation_str(roomjid);
@ -811,7 +811,7 @@ ui_room_join(const char *const roomjid, gboolean focus)
status_bar_active(num, WIN_MUC, mucwin->roomjid);
ProfWin *console = wins_get_console();
char *nick = muc_nick(roomjid);
win_println(console, THEME_TYPING, '!', "-> Autojoined %s as %s (%d).", roomjid, nick, num);
win_println(console, THEME_TYPING, "!", "-> Autojoined %s as %s (%d).", roomjid, nick, num);
}
GList *privwins = wins_get_private_chats(roomjid);
@ -887,16 +887,16 @@ ui_room_destroyed(const char *const roomjid, const char *const reason, const cha
ProfWin *console = wins_get_console();
if (reason) {
win_println(console, THEME_TYPING, '!', "<- Room destroyed: %s, reason: %s", roomjid, reason);
win_println(console, THEME_TYPING, "!", "<- Room destroyed: %s, reason: %s", roomjid, reason);
} else {
win_println(console, THEME_TYPING, '!', "<- Room destroyed: %s", roomjid);
win_println(console, THEME_TYPING, "!", "<- Room destroyed: %s", roomjid);
}
if (new_jid) {
if (password) {
win_println(console, THEME_TYPING, '!', "Replacement room: %s, password: %s", new_jid, password);
win_println(console, THEME_TYPING, "!", "Replacement room: %s, password: %s", new_jid, password);
} else {
win_println(console, THEME_TYPING, '!', "Replacement room: %s", new_jid);
win_println(console, THEME_TYPING, "!", "Replacement room: %s", new_jid);
}
}
}
@ -933,7 +933,7 @@ ui_room_kicked(const char *const roomjid, const char *const actor, const char *c
}
ProfWin *console = wins_get_console();
win_println(console, THEME_TYPING, '!', "<- %s", message->str);
win_println(console, THEME_TYPING, "!", "<- %s", message->str);
g_string_free(message, TRUE);
}
@ -969,7 +969,7 @@ ui_room_banned(const char *const roomjid, const char *const actor, const char *c
}
ProfWin *console = wins_get_console();
win_println(console, THEME_TYPING, '!', "<- %s", message->str);
win_println(console, THEME_TYPING, "!", "<- %s", message->str);
g_string_free(message, TRUE);
}
@ -1012,16 +1012,16 @@ ui_ask_pgp_passphrase(const char *hint, int prev_fail)
{
ProfWin *current = wins_get_current();
win_println(current, THEME_DEFAULT, '-', "");
win_println(current, THEME_DEFAULT, "-", "");
if (prev_fail) {
win_println(current, THEME_DEFAULT, '!', "Incorrect passphrase");
win_println(current, THEME_DEFAULT, "!", "Incorrect passphrase");
}
if (hint) {
win_println(current, THEME_DEFAULT, '!', "Enter PGP key passphrase for %s", hint);
win_println(current, THEME_DEFAULT, "!", "Enter PGP key passphrase for %s", hint);
} else {
win_println(current, THEME_DEFAULT, '!', "Enter PGP key passphrase");
win_println(current, THEME_DEFAULT, "!", "Enter PGP key passphrase");
}
ui_update();
@ -1144,7 +1144,7 @@ ui_handle_room_configuration_form_error(const char *const roomjid, const char *c
g_string_append(message_str, message);
}
win_println(window, THEME_ERROR, '-', "%s", message_str->str);
win_println(window, THEME_ERROR, "-", "%s", message_str->str);
g_string_free(message_str, TRUE);
}
@ -1168,7 +1168,7 @@ ui_handle_room_config_submit_result(const char *const roomjid)
if (muc_window) {
ui_focus_win((ProfWin*)muc_window);
win_println(muc_window, THEME_ROOMINFO, '!', "Room configuration successful");
win_println(muc_window, THEME_ROOMINFO, "!", "Room configuration successful");
} else {
ProfWin *console = wins_get_console();
ui_focus_win(console);
@ -1195,25 +1195,25 @@ ui_handle_room_config_submit_result_error(const char *const roomjid, const char
if (form_window) {
if (message) {
win_println(form_window, THEME_ERROR, '!', "Configuration error: %s", message);
win_println(form_window, THEME_ERROR, "!", "Configuration error: %s", message);
} else {
win_println(form_window, THEME_ERROR, '!', "Configuration error");
win_println(form_window, THEME_ERROR, "!", "Configuration error");
}
} else if (muc_window) {
if (message) {
win_println(muc_window, THEME_ERROR, '!', "Configuration error: %s", message);
win_println(muc_window, THEME_ERROR, "!", "Configuration error: %s", message);
} else {
win_println(muc_window, THEME_ERROR, '!', "Configuration error");
win_println(muc_window, THEME_ERROR, "!", "Configuration error");
}
} else {
if (message) {
win_println(console, THEME_ERROR, '!', "Configuration error for %s: %s", roomjid, message);
win_println(console, THEME_ERROR, "!", "Configuration error for %s: %s", roomjid, message);
} else {
win_println(console, THEME_ERROR, '!', "Configuration error for %s", roomjid);
win_println(console, THEME_ERROR, "!", "Configuration error for %s", roomjid);
}
}
} else {
win_println(console, THEME_ERROR, '!', "Configuration error");
win_println(console, THEME_ERROR, "!", "Configuration error");
}
}
@ -1223,7 +1223,7 @@ ui_show_lines(ProfWin *window, gchar** lines)
if (lines) {
int i;
for (i = 0; lines[i] != NULL; i++) {
win_println(window, THEME_DEFAULT, '-', "%s", lines[i]);
win_println(window, THEME_DEFAULT, "-", "%s", lines[i]);
}
}
}
@ -1260,7 +1260,7 @@ ui_handle_software_version_error(const char *const roomjid, const char *const me
g_string_append(message_str, message);
}
win_println(window, THEME_ERROR, '-', "%s", message_str->str);
win_println(window, THEME_ERROR, "-", "%s", message_str->str);
g_string_free(message_str, TRUE);
}
@ -1300,18 +1300,18 @@ ui_show_software_version(const char *const jid, const char *const presence,
}
if (name || version || os) {
win_println(window, THEME_DEFAULT, '-', "");
win_println(window, THEME_DEFAULT, "-", "");
theme_item_t presence_colour = theme_main_presence_attrs(presence);
win_print(window, presence_colour, '-', "%s", jid);
win_print(window, presence_colour, "-", "%s", jid);
win_appendln(window, THEME_DEFAULT, ":");
}
if (name) {
win_println(window, THEME_DEFAULT, '-', "Name : %s", name);
win_println(window, THEME_DEFAULT, "-", "Name : %s", name);
}
if (version) {
win_println(window, THEME_DEFAULT, '-', "Version : %s", version);
win_println(window, THEME_DEFAULT, "-", "Version : %s", version);
}
if (os) {
win_println(window, THEME_DEFAULT, '-', "OS : %s", os);
win_println(window, THEME_DEFAULT, "-", "OS : %s", os);
}
}

View File

@ -76,7 +76,7 @@ mucwin_role_change(ProfMucWin *mucwin, const char *const role, const char *const
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
win_print(window, THEME_ROOMINFO, '!', "Your role has been changed to: %s", role);
win_print(window, THEME_ROOMINFO, "!", "Your role has been changed to: %s", role);
if (actor) {
win_append(window, THEME_ROOMINFO, ", by: %s", actor);
}
@ -93,7 +93,7 @@ mucwin_affiliation_change(ProfMucWin *mucwin, const char *const affiliation, con
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
win_print(window, THEME_ROOMINFO, '!', "Your affiliation has been changed to: %s", affiliation);
win_print(window, THEME_ROOMINFO, "!", "Your affiliation has been changed to: %s", affiliation);
if (actor) {
win_append(window, THEME_ROOMINFO, ", by: %s", actor);
}
@ -110,7 +110,7 @@ mucwin_role_and_affiliation_change(ProfMucWin *mucwin, const char *const role, c
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
win_print(window, THEME_ROOMINFO, '!', "Your role and affiliation have been changed, role: %s, affiliation: %s", role, affiliation);
win_print(window, THEME_ROOMINFO, "!", "Your role and affiliation have been changed, role: %s, affiliation: %s", role, affiliation);
if (actor) {
win_append(window, THEME_ROOMINFO, ", by: %s", actor);
}
@ -128,7 +128,7 @@ mucwin_occupant_role_change(ProfMucWin *mucwin, const char *const nick, const ch
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
win_print(window, THEME_ROOMINFO, '!', "%s's role has been changed to: %s", nick, role);
win_print(window, THEME_ROOMINFO, "!", "%s's role has been changed to: %s", nick, role);
if (actor) {
win_append(window, THEME_ROOMINFO, ", by: %s", actor);
}
@ -145,7 +145,7 @@ mucwin_occupant_affiliation_change(ProfMucWin *mucwin, const char *const nick, c
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
win_print(window, THEME_ROOMINFO, '!', "%s's affiliation has been changed to: %s", nick, affiliation);
win_print(window, THEME_ROOMINFO, "!", "%s's affiliation has been changed to: %s", nick, affiliation);
if (actor) {
win_append(window, THEME_ROOMINFO, ", by: %s", actor);
}
@ -162,7 +162,7 @@ mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char *cons
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
win_print(window, THEME_ROOMINFO, '!', "%s's role and affiliation have been changed, role: %s, affiliation: %s", nick, role, affiliation);
win_print(window, THEME_ROOMINFO, "!", "%s's role and affiliation have been changed, role: %s, affiliation: %s", nick, role, affiliation);
if (actor) {
win_append(window, THEME_ROOMINFO, ", by: %s", actor);
}
@ -178,8 +178,8 @@ mucwin_room_info_error(ProfMucWin *mucwin, const char *const error)
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
win_println(window, THEME_DEFAULT, '!', "Room info request failed: %s", error);
win_println(window, THEME_DEFAULT, '-', "");
win_println(window, THEME_DEFAULT, "!", "Room info request failed: %s", error);
win_println(window, THEME_DEFAULT, "-", "");
}
void
@ -191,7 +191,7 @@ mucwin_room_disco_info(ProfMucWin *mucwin, GSList *identities, GSList *features)
if ((identities && (g_slist_length(identities) > 0)) ||
(features && (g_slist_length(features) > 0))) {
if (identities) {
win_println(window, THEME_DEFAULT, '!', "Identities:");
win_println(window, THEME_DEFAULT, "!", "Identities:");
}
while (identities) {
DiscoIdentity *identity = identities->data; // anme trpe, cat
@ -207,19 +207,19 @@ mucwin_room_disco_info(ProfMucWin *mucwin, GSList *identities, GSList *features)
if (identity->category) {
identity_str = g_string_append(identity_str, identity->category);
}
win_println(window, THEME_DEFAULT, '!', "%s", identity_str->str);
win_println(window, THEME_DEFAULT, "!", "%s", identity_str->str);
g_string_free(identity_str, TRUE);
identities = g_slist_next(identities);
}
if (features) {
win_println(window, THEME_DEFAULT, '!', "Features:");
win_println(window, THEME_DEFAULT, "!", "Features:");
}
while (features) {
win_println(window, THEME_DEFAULT, '!', " %s", features->data);
win_println(window, THEME_DEFAULT, "!", " %s", features->data);
features = g_slist_next(features);
}
win_println(window, THEME_DEFAULT, '-', "");
win_println(window, THEME_DEFAULT, "-", "");
}
}
@ -231,16 +231,16 @@ mucwin_roster(ProfMucWin *mucwin, GList *roster, const char *const presence)
ProfWin *window = (ProfWin*)mucwin;
if ((roster == NULL) || (g_list_length(roster) == 0)) {
if (presence == NULL) {
win_println(window, THEME_ROOMINFO, '!', "Room is empty.");
win_println(window, THEME_ROOMINFO, "!", "Room is empty.");
} else {
win_println(window, THEME_ROOMINFO, '!', "No occupants %s.", presence);
win_println(window, THEME_ROOMINFO, "!", "No occupants %s.", presence);
}
} else {
int length = g_list_length(roster);
if (presence == NULL) {
win_print(window, THEME_ROOMINFO, '!', "%d occupants: ", length);
win_print(window, THEME_ROOMINFO, "!", "%d occupants: ", length);
} else {
win_print(window, THEME_ROOMINFO, '!', "%d %s: ", length, presence);
win_print(window, THEME_ROOMINFO, "!", "%d %s: ", length, presence);
}
while (roster) {
@ -266,7 +266,7 @@ mucwin_occupant_offline(ProfMucWin *mucwin, const char *const nick)
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
win_println(window, THEME_OFFLINE, '!', "<- %s has left the room.", nick);
win_println(window, THEME_OFFLINE, "!", "<- %s has left the room.", nick);
}
void
@ -287,7 +287,7 @@ mucwin_occupant_kicked(ProfMucWin *mucwin, const char *const nick, const char *c
g_string_append(message, reason);
}
win_println(window, THEME_OFFLINE, '!', "<- %s", message->str);
win_println(window, THEME_OFFLINE, "!", "<- %s", message->str);
g_string_free(message, TRUE);
}
@ -309,7 +309,7 @@ mucwin_occupant_banned(ProfMucWin *mucwin, const char *const nick, const char *c
g_string_append(message, reason);
}
win_println(window, THEME_OFFLINE, '!', "<- %s", message->str);
win_println(window, THEME_OFFLINE, "!", "<- %s", message->str);
g_string_free(message, TRUE);
}
@ -320,7 +320,7 @@ mucwin_occupant_online(ProfMucWin *mucwin, const char *const nick, const char *c
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
win_print(window, THEME_ONLINE, '!', "-> %s has joined the room", nick);
win_print(window, THEME_ONLINE, "!", "-> %s has joined the room", nick);
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
if (role) {
win_append(window, THEME_ONLINE, ", role: %s", role);
@ -348,7 +348,7 @@ mucwin_occupant_nick_change(ProfMucWin *mucwin, const char *const old_nick, cons
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
win_println(window, THEME_THEM, '!', "** %s is now known as %s", old_nick, nick);
win_println(window, THEME_THEM, "!", "** %s is now known as %s", old_nick, nick);
}
void
@ -357,7 +357,7 @@ mucwin_nick_change(ProfMucWin *mucwin, const char *const nick)
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
win_println(window, THEME_ME, '!', "** You are now known as %s", nick);
win_println(window, THEME_ME, "!", "** You are now known as %s", nick);
}
void
@ -415,11 +415,11 @@ _mucwin_print_mention(ProfWin *window, const char *const message, const char *co
char *before_str = g_strndup(message + last_pos, pos - last_pos);
if (strncmp(before_str, "/me ", 4) == 0) {
win_print_them(window, THEME_ROOMMENTION, *ch, flags, "");
win_print_them(window, THEME_ROOMMENTION, ch, flags, "");
win_append_highlight(window, THEME_ROOMMENTION, "*%s ", from);
win_append_highlight(window, THEME_ROOMMENTION, "%s", before_str + 4);
} else {
win_print_them(window, THEME_ROOMMENTION, *ch, flags, from);
win_print_them(window, THEME_ROOMMENTION, ch, flags, from);
win_append_highlight(window, THEME_ROOMMENTION, "%s", before_str);
}
g_free(before_str);
@ -529,18 +529,21 @@ mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, const char *c
ProfWin *window = (ProfWin*)mucwin;
char *mynick = muc_nick(mucwin->roomjid);
char ch = '-';
char *ch;
if (mucwin->message_char) {
ch = mucwin->message_char[0];
ch = strdup(mucwin->message_char);
} else if (enc_mode == PROF_MSG_ENC_OTR) {
ch = prefs_get_otr_char();
} else if (enc_mode == PROF_MSG_ENC_PGP) {
ch = prefs_get_pgp_char();
} else if (enc_mode == PROF_MSG_ENC_OMEMO) {
ch = prefs_get_omemo_char();
} else {
ch = strdup("-");
}
win_print_outgoing_muc_msg(window, ch, mynick, id, replace_id, message);
free(ch);
// save last id and message for LMC
if (id) {
@ -566,27 +569,31 @@ mucwin_incoming_msg(ProfMucWin *mucwin, const ProfMessage *const message, GSList
ProfWin *window = (ProfWin*)mucwin;
char *mynick = muc_nick(mucwin->roomjid);
char ch = '-';
char *ch;
if (mucwin->message_char) {
ch = mucwin->message_char[0];
ch = strdup(mucwin->message_char);
} else if (message->enc == PROF_MSG_ENC_OTR) {
ch = prefs_get_otr_char();
} else if (message->enc == PROF_MSG_ENC_PGP) {
ch = prefs_get_pgp_char();
} else if (message->enc == PROF_MSG_ENC_OMEMO) {
ch = prefs_get_omemo_char();
} else {
ch = strdup("-");
}
win_insert_last_read_position_marker((ProfWin*)mucwin, mucwin->roomjid);
if (g_slist_length(mentions) > 0) {
_mucwin_print_mention(window, message->plain, message->jid->resourcepart, mynick, mentions, &ch, flags);
_mucwin_print_mention(window, message->plain, message->jid->resourcepart, mynick, mentions, ch, flags);
} else if (triggers) {
win_print_them(window, THEME_ROOMTRIGGER, ch, flags, message->jid->resourcepart);
_mucwin_print_triggers(window, message->plain, triggers);
} else {
win_println_incoming_muc_msg(window, ch, flags, message->jid->resourcepart, message->id, message->replace_id, message->plain);
}
free(ch);
}
void
@ -597,12 +604,12 @@ mucwin_requires_config(ProfMucWin *mucwin)
ProfWin *window = (ProfWin*)mucwin;
int num = wins_get_num(window);
win_println(window, THEME_DEFAULT, '-', "");
win_println(window, THEME_ROOMINFO, '!', "Room locked, requires configuration.");
win_println(window, THEME_ROOMINFO, '!', "Use '/room accept' to accept the defaults");
win_println(window, THEME_ROOMINFO, '!', "Use '/room destroy' to cancel and destroy the room");
win_println(window, THEME_ROOMINFO, '!', "Use '/room config' to edit the room configuration");
win_println(window, THEME_DEFAULT, '-', "");
win_println(window, THEME_DEFAULT, "-", "");
win_println(window, THEME_ROOMINFO, "!", "Room locked, requires configuration.");
win_println(window, THEME_ROOMINFO, "!", "Use '/room accept' to accept the defaults");
win_println(window, THEME_ROOMINFO, "!", "Use '/room destroy' to cancel and destroy the room");
win_println(window, THEME_ROOMINFO, "!", "Use '/room config' to edit the room configuration");
win_println(window, THEME_DEFAULT, "-", "");
// currently in groupchat window
if (wins_is_current(window)) {
@ -622,17 +629,17 @@ mucwin_subject(ProfMucWin *mucwin, const char *const nick, const char *const sub
ProfWin *window = (ProfWin*)mucwin;
if (subject) {
if (nick) {
win_print(window, THEME_ROOMINFO, '!', "*%s has set the room subject: ", nick);
win_print(window, THEME_ROOMINFO, "!", "*%s has set the room subject: ", nick);
win_appendln(window, THEME_DEFAULT, "%s", subject);
} else {
win_print(window, THEME_ROOMINFO, '!', "Room subject: ");
win_print(window, THEME_ROOMINFO, "!", "Room subject: ");
win_appendln(window, THEME_DEFAULT, "%s", subject);
}
} else {
if (nick) {
win_println(window, THEME_ROOMINFO, '!', "*%s has cleared the room subject.", nick);
win_println(window, THEME_ROOMINFO, "!", "*%s has cleared the room subject.", nick);
} else {
win_println(window, THEME_ROOMINFO, '!', "Room subject cleared");
win_println(window, THEME_ROOMINFO, "!", "Room subject cleared");
}
}
}
@ -643,7 +650,7 @@ mucwin_kick_error(ProfMucWin *mucwin, const char *const nick, const char *const
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
win_println(window, THEME_ERROR, '!', "Error kicking %s: %s", nick, error);
win_println(window, THEME_ERROR, "!", "Error kicking %s: %s", nick, error);
}
void
@ -654,7 +661,7 @@ mucwin_broadcast(ProfMucWin *mucwin, const char *const message)
ProfWin *window = (ProfWin*)mucwin;
int num = wins_get_num(window);
win_print(window, THEME_ROOMINFO, '!', "Room message: ");
win_print(window, THEME_ROOMINFO, "!", "Room message: ");
win_appendln(window, THEME_DEFAULT, "%s", message);
// currently in groupchat window
@ -674,7 +681,7 @@ mucwin_affiliation_list_error(ProfMucWin *mucwin, const char *const affiliation,
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
win_println(window, THEME_ERROR, '!', "Error retrieving %s list: %s", affiliation, error);
win_println(window, THEME_ERROR, "!", "Error retrieving %s list: %s", affiliation, error);
}
void
@ -684,17 +691,17 @@ mucwin_handle_affiliation_list(ProfMucWin *mucwin, const char *const affiliation
ProfWin *window = (ProfWin*)mucwin;
if (jids) {
win_println(window, THEME_DEFAULT, '!', "Affiliation: %s", affiliation);
win_println(window, THEME_DEFAULT, "!", "Affiliation: %s", affiliation);
GSList *curr_jid = jids;
while (curr_jid) {
const char *jid = curr_jid->data;
win_println(window, THEME_DEFAULT, '!', " %s", jid);
win_println(window, THEME_DEFAULT, "!", " %s", jid);
curr_jid = g_slist_next(curr_jid);
}
win_println(window, THEME_DEFAULT, '!', "");
win_println(window, THEME_DEFAULT, "!", "");
} else {
win_println(window, THEME_DEFAULT, '!', "No users found with affiliation: %s", affiliation);
win_println(window, THEME_DEFAULT, '!', "");
win_println(window, THEME_DEFAULT, "!", "No users found with affiliation: %s", affiliation);
win_println(window, THEME_DEFAULT, "!", "");
}
}
@ -709,34 +716,34 @@ mucwin_show_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation)
if (!occupants) {
switch (affiliation) {
case MUC_AFFILIATION_OWNER:
win_println(window, THEME_DEFAULT, '!', "No owners found.");
win_println(window, THEME_DEFAULT, "!", "No owners found.");
break;
case MUC_AFFILIATION_ADMIN:
win_println(window, THEME_DEFAULT, '!', "No admins found.");
win_println(window, THEME_DEFAULT, "!", "No admins found.");
break;
case MUC_AFFILIATION_MEMBER:
win_println(window, THEME_DEFAULT, '!', "No members found.");
win_println(window, THEME_DEFAULT, "!", "No members found.");
break;
case MUC_AFFILIATION_OUTCAST:
win_println(window, THEME_DEFAULT, '!', "No outcasts found.");
win_println(window, THEME_DEFAULT, "!", "No outcasts found.");
break;
default:
break;
}
win_println(window, THEME_DEFAULT, '-', "");
win_println(window, THEME_DEFAULT, "-", "");
} else {
switch (affiliation) {
case MUC_AFFILIATION_OWNER:
win_println(window, THEME_DEFAULT, '!', "Owners:");
win_println(window, THEME_DEFAULT, "!", "Owners:");
break;
case MUC_AFFILIATION_ADMIN:
win_println(window, THEME_DEFAULT, '!', "Admins:");
win_println(window, THEME_DEFAULT, "!", "Admins:");
break;
case MUC_AFFILIATION_MEMBER:
win_println(window, THEME_DEFAULT, '!', "Members:");
win_println(window, THEME_DEFAULT, "!", "Members:");
break;
case MUC_AFFILIATION_OUTCAST:
win_println(window, THEME_DEFAULT, '!', "Outcasts:");
win_println(window, THEME_DEFAULT, "!", "Outcasts:");
break;
default:
break;
@ -747,16 +754,16 @@ mucwin_show_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation)
Occupant *occupant = curr_occupant->data;
if (occupant->affiliation == affiliation) {
if (occupant->jid) {
win_println(window, THEME_DEFAULT, '!', " %s (%s)", occupant->nick, occupant->jid);
win_println(window, THEME_DEFAULT, "!", " %s (%s)", occupant->nick, occupant->jid);
} else {
win_println(window, THEME_DEFAULT, '!', " %s", occupant->nick);
win_println(window, THEME_DEFAULT, "!", " %s", occupant->nick);
}
}
curr_occupant = g_slist_next(curr_occupant);
}
win_println(window, THEME_DEFAULT, '-', "");
win_println(window, THEME_DEFAULT, "-", "");
}
}
@ -766,7 +773,7 @@ mucwin_role_list_error(ProfMucWin *mucwin, const char *const role, const char *c
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
win_println(window, THEME_ERROR, '!', "Error retrieving %s list: %s", role, error);
win_println(window, THEME_ERROR, "!", "Error retrieving %s list: %s", role, error);
}
void
@ -776,26 +783,26 @@ mucwin_handle_role_list(ProfMucWin *mucwin, const char *const role, GSList *nick
ProfWin *window = (ProfWin*)mucwin;
if (nicks) {
win_println(window, THEME_DEFAULT, '!', "Role: %s", role);
win_println(window, THEME_DEFAULT, "!", "Role: %s", role);
GSList *curr_nick = nicks;
while (curr_nick) {
const char *nick = curr_nick->data;
Occupant *occupant = muc_roster_item(mucwin->roomjid, nick);
if (occupant) {
if (occupant->jid) {
win_println(window, THEME_DEFAULT, '!', " %s (%s)", nick, occupant->jid);
win_println(window, THEME_DEFAULT, "!", " %s (%s)", nick, occupant->jid);
} else {
win_println(window, THEME_DEFAULT, '!', " %s", nick);
win_println(window, THEME_DEFAULT, "!", " %s", nick);
}
} else {
win_println(window, THEME_DEFAULT, '!', " %s", nick);
win_println(window, THEME_DEFAULT, "!", " %s", nick);
}
curr_nick = g_slist_next(curr_nick);
}
win_println(window, THEME_DEFAULT, '!', "");
win_println(window, THEME_DEFAULT, "!", "");
} else {
win_println(window, THEME_DEFAULT, '!', "No occupants found with role: %s", role);
win_println(window, THEME_DEFAULT, '!', "");
win_println(window, THEME_DEFAULT, "!", "No occupants found with role: %s", role);
win_println(window, THEME_DEFAULT, "!", "");
}
}
@ -810,28 +817,28 @@ mucwin_show_role_list(ProfMucWin *mucwin, muc_role_t role)
if (!occupants) {
switch (role) {
case MUC_ROLE_MODERATOR:
win_println(window, THEME_DEFAULT, '!', "No moderators found.");
win_println(window, THEME_DEFAULT, "!", "No moderators found.");
break;
case MUC_ROLE_PARTICIPANT:
win_println(window, THEME_DEFAULT, '!', "No participants found.");
win_println(window, THEME_DEFAULT, "!", "No participants found.");
break;
case MUC_ROLE_VISITOR:
win_println(window, THEME_DEFAULT, '!', "No visitors found.");
win_println(window, THEME_DEFAULT, "!", "No visitors found.");
break;
default:
break;
}
win_println(window, THEME_DEFAULT, '-', "");
win_println(window, THEME_DEFAULT, "-", "");
} else {
switch (role) {
case MUC_ROLE_MODERATOR:
win_println(window, THEME_DEFAULT, '!', "Moderators:");
win_println(window, THEME_DEFAULT, "!", "Moderators:");
break;
case MUC_ROLE_PARTICIPANT:
win_println(window, THEME_DEFAULT, '!', "Participants:");
win_println(window, THEME_DEFAULT, "!", "Participants:");
break;
case MUC_ROLE_VISITOR:
win_println(window, THEME_DEFAULT, '!', "Visitors:");
win_println(window, THEME_DEFAULT, "!", "Visitors:");
break;
default:
break;
@ -842,16 +849,16 @@ mucwin_show_role_list(ProfMucWin *mucwin, muc_role_t role)
Occupant *occupant = curr_occupant->data;
if (occupant->role == role) {
if (occupant->jid) {
win_println(window, THEME_DEFAULT, '!', " %s (%s)", occupant->nick, occupant->jid);
win_println(window, THEME_DEFAULT, "!", " %s (%s)", occupant->nick, occupant->jid);
} else {
win_println(window, THEME_DEFAULT, '!', " %s", occupant->nick);
win_println(window, THEME_DEFAULT, "!", " %s", occupant->nick);
}
}
curr_occupant = g_slist_next(curr_occupant);
}
win_println(window, THEME_DEFAULT, '-', "");
win_println(window, THEME_DEFAULT, "-", "");
}
}
@ -862,7 +869,7 @@ mucwin_affiliation_set_error(ProfMucWin *mucwin, const char *const jid, const ch
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
win_println(window, THEME_ERROR, '!', "Error setting %s affiliation for %s: %s", affiliation, jid, error);
win_println(window, THEME_ERROR, "!", "Error setting %s affiliation for %s: %s", affiliation, jid, error);
}
void
@ -872,7 +879,7 @@ mucwin_role_set_error(ProfMucWin *mucwin, const char *const nick, const char *co
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
win_println(window, THEME_ERROR, '!', "Error setting %s role for %s: %s", role, nick, error);
win_println(window, THEME_ERROR, "!", "Error setting %s role for %s: %s", role, nick, error);
}
void
@ -884,10 +891,10 @@ mucwin_info(ProfMucWin *mucwin)
char *affiliation = muc_affiliation_str(mucwin->roomjid);
ProfWin *window = (ProfWin*) mucwin;
win_println(window, THEME_DEFAULT, '!', "Room: %s", mucwin->roomjid);
win_println(window, THEME_DEFAULT, '!', "Affiliation: %s", affiliation);
win_println(window, THEME_DEFAULT, '!', "Role: %s", role);
win_println(window, THEME_DEFAULT, '-', "");
win_println(window, THEME_DEFAULT, "!", "Room: %s", mucwin->roomjid);
win_println(window, THEME_DEFAULT, "!", "Affiliation: %s", affiliation);
win_println(window, THEME_DEFAULT, "!", "Role: %s", role);
win_println(window, THEME_DEFAULT, "-", "");
}
void

View File

@ -95,7 +95,7 @@ privwin_outgoing_msg(ProfPrivateWin *privwin, const char *const message)
{
assert(privwin != NULL);
win_print_outgoing((ProfWin*)privwin, '-', NULL, NULL , message);
win_print_outgoing((ProfWin*)privwin, "-", NULL, NULL , message);
}
void
@ -103,7 +103,7 @@ privwin_message_occupant_offline(ProfPrivateWin *privwin)
{
assert(privwin != NULL);
win_println((ProfWin*)privwin, THEME_ERROR, '-', "Unable to send message, occupant no longer present in room.");
win_println((ProfWin*)privwin, THEME_ERROR, "-", "Unable to send message, occupant no longer present in room.");
}
void
@ -111,7 +111,7 @@ privwin_message_left_room(ProfPrivateWin *privwin)
{
assert(privwin != NULL);
win_println((ProfWin*)privwin, THEME_ERROR, '-', "Unable to send message, you are no longer present in room.");
win_println((ProfWin*)privwin, THEME_ERROR, "-", "Unable to send message, you are no longer present in room.");
}
void
@ -121,7 +121,7 @@ privwin_occupant_offline(ProfPrivateWin *privwin)
privwin->occupant_offline = TRUE;
Jid *jidp = jid_create(privwin->fulljid);
win_println((ProfWin*)privwin, THEME_OFFLINE, '-', "<- %s has left the room.", jidp->resourcepart);
win_println((ProfWin*)privwin, THEME_OFFLINE, "-", "<- %s has left the room.", jidp->resourcepart);
jid_destroy(jidp);
}
@ -144,7 +144,7 @@ privwin_occupant_kicked(ProfPrivateWin *privwin, const char *const actor, const
g_string_append(message, reason);
}
win_println((ProfWin*)privwin, THEME_OFFLINE, '!', "<- %s", message->str);
win_println((ProfWin*)privwin, THEME_OFFLINE, "!", "<- %s", message->str);
g_string_free(message, TRUE);
}
@ -167,7 +167,7 @@ privwin_occupant_banned(ProfPrivateWin *privwin, const char *const actor, const
g_string_append(message, reason);
}
win_println((ProfWin*)privwin, THEME_OFFLINE, '!', "<- %s", message->str);
win_println((ProfWin*)privwin, THEME_OFFLINE, "!", "<- %s", message->str);
g_string_free(message, TRUE);
}
@ -178,7 +178,7 @@ privwin_occupant_online(ProfPrivateWin *privwin)
privwin->occupant_offline = FALSE;
Jid *jidp = jid_create(privwin->fulljid);
win_println((ProfWin*)privwin, THEME_ONLINE, '-', "-- %s has joined the room.", jidp->resourcepart);
win_println((ProfWin*)privwin, THEME_ONLINE, "-", "-- %s has joined the room.", jidp->resourcepart);
jid_destroy(jidp);
}
@ -189,7 +189,7 @@ privwin_room_destroyed(ProfPrivateWin *privwin)
privwin->room_left = TRUE;
Jid *jidp = jid_create(privwin->fulljid);
win_println((ProfWin*)privwin, THEME_OFFLINE, '!', "-- %s has been destroyed.", jidp->barejid);
win_println((ProfWin*)privwin, THEME_OFFLINE, "!", "-- %s has been destroyed.", jidp->barejid);
jid_destroy(jidp);
}
@ -200,7 +200,7 @@ privwin_room_joined(ProfPrivateWin *privwin)
privwin->room_left = FALSE;
Jid *jidp = jid_create(privwin->fulljid);
win_println((ProfWin*)privwin, THEME_OFFLINE, '!', "-- You have joined %s.", jidp->barejid);
win_println((ProfWin*)privwin, THEME_OFFLINE, "!", "-- You have joined %s.", jidp->barejid);
jid_destroy(jidp);
}
@ -211,7 +211,7 @@ privwin_room_left(ProfPrivateWin *privwin)
privwin->room_left = TRUE;
Jid *jidp = jid_create(privwin->fulljid);
win_println((ProfWin*)privwin, THEME_OFFLINE, '!', "-- You have left %s.", jidp->barejid);
win_println((ProfWin*)privwin, THEME_OFFLINE, "!", "-- You have left %s.", jidp->barejid);
jid_destroy(jidp);
}
@ -234,7 +234,7 @@ privwin_room_kicked(ProfPrivateWin *privwin, const char *const actor, const char
g_string_append(message, reason);
}
win_println((ProfWin*)privwin, THEME_OFFLINE, '!', "<- %s", message->str);
win_println((ProfWin*)privwin, THEME_OFFLINE, "!", "<- %s", message->str);
g_string_free(message, TRUE);
}
@ -257,7 +257,7 @@ privwin_room_banned(ProfPrivateWin *privwin, const char *const actor, const char
g_string_append(message, reason);
}
win_println((ProfWin*)privwin, THEME_OFFLINE, '!', "<- %s", message->str);
win_println((ProfWin*)privwin, THEME_OFFLINE, "!", "<- %s", message->str);
g_string_free(message, TRUE);
}

View File

@ -360,8 +360,8 @@ void win_show_subwin(ProfWin *window);
void win_refresh_without_subwin(ProfWin *window);
void win_refresh_with_subwin(ProfWin *window);
void win_print(ProfWin *window, theme_item_t theme_item, const char ch, const char *const message, ...);
void win_println(ProfWin *window, theme_item_t theme_item, const char ch, const char *const message, ...);
void win_print(ProfWin *window, theme_item_t theme_item, const char *show_char, const char *const message, ...);
void win_println(ProfWin *window, theme_item_t theme_item, const char *show_char, const char *const message, ...);
void win_println_indent(ProfWin *window, int pad, const char *const message, ...);
void win_append(ProfWin *window, theme_item_t theme_item, const char *const message, ...);

View File

@ -64,8 +64,8 @@
#define CEILING(X) (X-(int)(X) > 0 ? (int)(X+1) : (int)(X))
static void _win_printf(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp, int flags, theme_item_t theme_item, const char *const from, const char *const message_id, const char *const message, ...);
static void _win_print_internal(ProfWin *window, const char show_char, int pad_indent, GDateTime *time,
static void _win_printf(ProfWin *window, const char *show_char, int pad_indent, GDateTime *timestamp, int flags, theme_item_t theme_item, const char *const from, const char *const message_id, const char *const message, ...);
static void _win_print_internal(ProfWin *window, const char *show_char, int pad_indent, GDateTime *time,
int flags, theme_item_t theme_item, const char *const from, const char *const message, DeliveryReceipt *receipt);
static void _win_print_wrapped(WINDOW *win, const char *const message, size_t indent, int pad_indent);
@ -761,7 +761,7 @@ win_show_occupant(ProfWin *window, Occupant *occupant)
theme_item_t presence_colour = theme_main_presence_attrs(presence_str);
win_print(window, presence_colour, '-', "%s", occupant->nick);
win_print(window, presence_colour, "-", "%s", occupant->nick);
win_append(window, presence_colour, " is %s", presence_str);
if (occupant->status) {
@ -783,9 +783,9 @@ win_show_contact(ProfWin *window, PContact contact)
theme_item_t presence_colour = theme_main_presence_attrs(presence);
if (name) {
win_print(window, presence_colour, '-', "%s", name);
win_print(window, presence_colour, "-", "%s", name);
} else {
win_print(window, presence_colour, '-', "%s", barejid);
win_print(window, presence_colour, "-", "%s", barejid);
}
win_append(window, presence_colour, " is %s", presence);
@ -824,7 +824,7 @@ win_show_occupant_info(ProfWin *window, const char *const room, Occupant *occupa
theme_item_t presence_colour = theme_main_presence_attrs(presence_str);
win_print(window, presence_colour, '!', "%s", occupant->nick);
win_print(window, presence_colour, "!", "%s", occupant->nick);
win_append(window, presence_colour, " is %s", presence_str);
if (occupant->status) {
@ -834,11 +834,11 @@ win_show_occupant_info(ProfWin *window, const char *const room, Occupant *occupa
win_newline(window);
if (occupant->jid) {
win_println(window, THEME_DEFAULT, '!', " Jid: %s", occupant->jid);
win_println(window, THEME_DEFAULT, "!", " Jid: %s", occupant->jid);
}
win_println(window, THEME_DEFAULT, '!', " Affiliation: %s", occupant_affiliation);
win_println(window, THEME_DEFAULT, '!', " Role: %s", occupant_role);
win_println(window, THEME_DEFAULT, "!", " Affiliation: %s", occupant_affiliation);
win_println(window, THEME_DEFAULT, "!", " Role: %s", occupant_role);
Jid *jidp = jid_create_from_bare_and_resource(room, occupant->nick);
EntityCapabilities *caps = caps_lookup(jidp->fulljid);
@ -848,7 +848,7 @@ win_show_occupant_info(ProfWin *window, const char *const room, Occupant *occupa
// show identity
if (caps->identity) {
DiscoIdentity *identity = caps->identity;
win_print(window, THEME_DEFAULT, '!', " Identity: ");
win_print(window, THEME_DEFAULT, "!", " Identity: ");
if (identity->name) {
win_append(window, THEME_DEFAULT, "%s", identity->name);
if (identity->category || identity->type) {
@ -870,7 +870,7 @@ win_show_occupant_info(ProfWin *window, const char *const room, Occupant *occupa
if (caps->software_version) {
SoftwareVersion *software_version = caps->software_version;
if (software_version->software) {
win_print(window, THEME_DEFAULT, '!', " Software: %s", software_version->software);
win_print(window, THEME_DEFAULT, "!", " Software: %s", software_version->software);
}
if (software_version->software_version) {
win_append(window, THEME_DEFAULT, ", %s", software_version->software_version);
@ -879,7 +879,7 @@ win_show_occupant_info(ProfWin *window, const char *const room, Occupant *occupa
win_newline(window);
}
if (software_version->os) {
win_print(window, THEME_DEFAULT, '!', " OS: %s", software_version->os);
win_print(window, THEME_DEFAULT, "!", " OS: %s", software_version->os);
}
if (software_version->os_version) {
win_append(window, THEME_DEFAULT, ", %s", software_version->os_version);
@ -892,7 +892,7 @@ win_show_occupant_info(ProfWin *window, const char *const room, Occupant *occupa
caps_destroy(caps);
}
win_println(window, THEME_DEFAULT, '-', "");
win_println(window, THEME_DEFAULT, "-", "");
}
void
@ -906,15 +906,15 @@ win_show_info(ProfWin *window, PContact contact)
theme_item_t presence_colour = theme_main_presence_attrs(presence);
win_println(window, THEME_DEFAULT, '-', "");
win_print(window, presence_colour, '-', "%s", barejid);
win_println(window, THEME_DEFAULT, "-", "");
win_print(window, presence_colour, "-", "%s", barejid);
if (name) {
win_append(window, presence_colour, " (%s)", name);
}
win_appendln(window, THEME_DEFAULT, ":");
if (sub) {
win_println(window, THEME_DEFAULT, '-', "Subscription: %s", sub);
win_println(window, THEME_DEFAULT, "-", "Subscription: %s", sub);
}
if (last_activity) {
@ -928,10 +928,10 @@ win_show_info(ProfWin *window, PContact contact)
int seconds = span / G_TIME_SPAN_SECOND;
if (hours > 0) {
win_println(window, THEME_DEFAULT, '-', "Last activity: %dh%dm%ds", hours, minutes, seconds);
win_println(window, THEME_DEFAULT, "-", "Last activity: %dh%dm%ds", hours, minutes, seconds);
}
else {
win_println(window, THEME_DEFAULT, '-', "Last activity: %dm%ds", minutes, seconds);
win_println(window, THEME_DEFAULT, "-", "Last activity: %dm%ds", minutes, seconds);
}
g_date_time_unref(now);
@ -940,7 +940,7 @@ win_show_info(ProfWin *window, PContact contact)
GList *resources = p_contact_get_available_resources(contact);
GList *ordered_resources = NULL;
if (resources) {
win_println(window, THEME_DEFAULT, '-', "Resources:");
win_println(window, THEME_DEFAULT, "-", "Resources:");
// sort in order of availability
GList *curr = resources;
@ -958,7 +958,7 @@ win_show_info(ProfWin *window, PContact contact)
Resource *resource = curr->data;
const char *resource_presence = string_from_resource_presence(resource->presence);
theme_item_t presence_colour = theme_main_presence_attrs(resource_presence);
win_print(window, presence_colour, '-', " %s (%d), %s", resource->name, resource->priority, resource_presence);
win_print(window, presence_colour, "-", " %s (%d), %s", resource->name, resource->priority, resource_presence);
if (resource->status) {
win_append(window, presence_colour, ", \"%s\"", resource->status);
}
@ -972,7 +972,7 @@ win_show_info(ProfWin *window, PContact contact)
// show identity
if (caps->identity) {
DiscoIdentity *identity = caps->identity;
win_print(window, THEME_DEFAULT, '-', " Identity: ");
win_print(window, THEME_DEFAULT, "-", " Identity: ");
if (identity->name) {
win_append(window, THEME_DEFAULT, "%s", identity->name);
if (identity->category || identity->type) {
@ -994,7 +994,7 @@ win_show_info(ProfWin *window, PContact contact)
if (caps->software_version) {
SoftwareVersion *software_version = caps->software_version;
if (software_version->software) {
win_print(window, THEME_DEFAULT, '-', " Software: %s", software_version->software);
win_print(window, THEME_DEFAULT, "-", " Software: %s", software_version->software);
}
if (software_version->software_version) {
win_append(window, THEME_DEFAULT, ", %s", software_version->software_version);
@ -1003,7 +1003,7 @@ win_show_info(ProfWin *window, PContact contact)
win_newline(window);
}
if (software_version->os) {
win_print(window, THEME_DEFAULT, '-', " OS: %s", software_version->os);
win_print(window, THEME_DEFAULT, "-", " OS: %s", software_version->os);
}
if (software_version->os_version) {
win_append(window, THEME_DEFAULT, ", %s", software_version->os_version);
@ -1037,7 +1037,7 @@ win_show_status_string(ProfWin *window, const char *const from,
presence_colour = THEME_OFFLINE;
}
win_print(window, presence_colour, '-', "%s %s", pre, from);
win_print(window, presence_colour, "-", "%s %s", pre, from);
if (show)
win_append(window, presence_colour, " is %s", show);
@ -1082,6 +1082,7 @@ _win_correct(ProfWin *window, const char *const message, const char *const id, c
entry->date = buffer_date_new_now();
*/
free(entry->show_char);
entry->show_char = prefs_get_correction_char();
if (entry->message) {
@ -1100,7 +1101,7 @@ _win_correct(ProfWin *window, const char *const message, const char *const id, c
void
win_print_incoming(ProfWin *window, const char *const display_name_from, ProfMessage *message)
{
char enc_char = '-';
char *enc_char = "-";
int flags = NO_ME;
if (!message->trusted) {
@ -1113,7 +1114,7 @@ win_print_incoming(ProfWin *window, const char *const display_name_from, ProfMes
{
ProfChatWin *chatwin = (ProfChatWin*)window;
if (chatwin->incoming_char) {
enc_char = chatwin->incoming_char[0];
enc_char = strdup(chatwin->incoming_char);
} else if (message->enc == PROF_MSG_ENC_OTR) {
enc_char = prefs_get_otr_char();
} else if (message->enc == PROF_MSG_ENC_PGP) {
@ -1127,10 +1128,12 @@ win_print_incoming(ProfWin *window, const char *const display_name_from, ProfMes
} else {
_win_printf(window, enc_char, 0, message->timestamp, flags, THEME_TEXT_THEM, display_name_from, message->id, "%s", message->plain);
}
free(enc_char);
break;
}
case WIN_PRIVATE:
_win_printf(window, '-', 0, message->timestamp, flags, THEME_TEXT_THEM, display_name_from, message->id, "%s", message->plain);
_win_printf(window, "-", 0, message->timestamp, flags, THEME_TEXT_THEM, display_name_from, message->id, "%s", message->plain);
break;
default:
assert(FALSE);
@ -1139,13 +1142,13 @@ win_print_incoming(ProfWin *window, const char *const display_name_from, ProfMes
}
void
win_print_them(ProfWin *window, theme_item_t theme_item, char ch, int flags, const char *const them)
win_print_them(ProfWin *window, theme_item_t theme_item, const char *const show_char, int flags, const char *const them)
{
_win_printf(window, ch, 0, NULL, flags | NO_ME | NO_EOL, theme_item, them, NULL, "");
_win_printf(window, show_char, 0, NULL, flags | NO_ME | NO_EOL, theme_item, them, NULL, "");
}
void
win_println_incoming_muc_msg(ProfWin *window, char ch, int flags, const char *const them, const char *const id, const char *const replace_id, const char *const message)
win_println_incoming_muc_msg(ProfWin *window, char *show_char, int flags, const char *const them, const char *const id, const char *const replace_id, const char *const message)
{
//TODO: we always use current timestamp here. instead of the message->timestamp one if available. i think somewhere else we check whether it exists first.
GDateTime *timestamp = g_date_time_new_now_local();
@ -1153,34 +1156,34 @@ win_println_incoming_muc_msg(ProfWin *window, char ch, int flags, const char *co
if (prefs_get_boolean(PREF_CORRECTION_ALLOW) && replace_id) {
_win_correct(window, message, id, replace_id);
} else {
_win_printf(window, ch, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, id, "%s", message);
_win_printf(window, show_char, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, id, "%s", message);
}
// buffer_append(window->layout->buffer, ch, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, message, NULL, NULL);
// _win_print_internal(window, ch, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, message, NULL);
// buffer_append(window->layout->buffer, show_char, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, message, NULL, NULL);
// _win_print_internal(window, show_char, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, message, NULL);
inp_nonblocking(TRUE);
g_date_time_unref(timestamp);
}
void
win_print_outgoing_muc_msg(ProfWin *window, char ch, const char *const me, const char *const id, const char *const replace_id, const char *const message)
win_print_outgoing_muc_msg(ProfWin *window, char *show_char, const char *const me, const char *const id, const char *const replace_id, const char *const message)
{
GDateTime *timestamp = g_date_time_new_now_local();
if (prefs_get_boolean(PREF_CORRECTION_ALLOW) && replace_id) {
_win_correct(window, message, id, replace_id);
} else {
_win_printf(window, ch, 0, timestamp, 0, THEME_TEXT_ME, me, id, "%s", message);
_win_printf(window, show_char, 0, timestamp, 0, THEME_TEXT_ME, me, id, "%s", message);
}
// buffer_append(window->layout->buffer, ch, 0, timestamp, 0, THEME_TEXT_ME, me, message, NULL, NULL);
// _win_print_internal(window, ch, 0, timestamp, 0, THEME_TEXT_ME, me, message, NULL);
// buffer_append(window->layout->buffer, show_char, 0, timestamp, 0, THEME_TEXT_ME, me, message, NULL, NULL);
// _win_print_internal(window, show_char, 0, timestamp, 0, THEME_TEXT_ME, me, message, NULL);
inp_nonblocking(TRUE);
g_date_time_unref(timestamp);
}
void
win_print_outgoing(ProfWin *window, const char ch, const char *const id, const char *const replace_id, const char *const message)
win_print_outgoing(ProfWin *window, const char *show_char, const char *const id, const char *const replace_id, const char *const message)
{
//TODO: we always use current timestamp here. instead of the message->timestamp one if available. i think somewhere else we check whether it exists first.
GDateTime *timestamp = g_date_time_new_now_local();
@ -1188,7 +1191,7 @@ win_print_outgoing(ProfWin *window, const char ch, const char *const id, const c
if (replace_id) {
_win_correct(window, message, id, replace_id);
} else {
_win_printf(window, ch, 0, timestamp, 0, THEME_TEXT_THEM, "me", id, "%s", message);
_win_printf(window, show_char, 0, timestamp, 0, THEME_TEXT_THEM, "me", id, "%s", message);
}
inp_nonblocking(TRUE);
@ -1200,15 +1203,15 @@ win_print_history(ProfWin *window, GDateTime *timestamp, const char *const messa
{
g_date_time_ref(timestamp);
buffer_append(window->layout->buffer, '-', 0, timestamp, 0, THEME_TEXT_HISTORY, "", message, NULL, NULL);
_win_print_internal(window, '-', 0, timestamp, 0, THEME_TEXT_HISTORY, "", message, NULL);
buffer_append(window->layout->buffer, "-", 0, timestamp, 0, THEME_TEXT_HISTORY, "", message, NULL, NULL);
_win_print_internal(window, "-", 0, timestamp, 0, THEME_TEXT_HISTORY, "", message, NULL);
inp_nonblocking(TRUE);
g_date_time_unref(timestamp);
}
void
win_print(ProfWin *window, theme_item_t theme_item, const char ch, const char *const message, ...)
win_print(ProfWin *window, theme_item_t theme_item, const char *show_char, const char *const message, ...)
{
GDateTime *timestamp = g_date_time_new_now_local();
@ -1217,8 +1220,8 @@ win_print(ProfWin *window, theme_item_t theme_item, const char ch, const char *c
GString *fmt_msg = g_string_new(NULL);
g_string_vprintf(fmt_msg, message, arg);
buffer_append(window->layout->buffer, ch, 0, timestamp, NO_EOL, theme_item, "", fmt_msg->str, NULL, NULL);
_win_print_internal(window, ch, 0, timestamp, NO_EOL, theme_item, "", fmt_msg->str, NULL);
buffer_append(window->layout->buffer, show_char, 0, timestamp, NO_EOL, theme_item, "", fmt_msg->str, NULL, NULL);
_win_print_internal(window, show_char, 0, timestamp, NO_EOL, theme_item, "", fmt_msg->str, NULL);
inp_nonblocking(TRUE);
g_date_time_unref(timestamp);
@ -1228,7 +1231,7 @@ win_print(ProfWin *window, theme_item_t theme_item, const char ch, const char *c
}
void
win_println(ProfWin *window, theme_item_t theme_item, const char ch, const char *const message, ...)
win_println(ProfWin *window, theme_item_t theme_item, const char *show_char, const char *const message, ...)
{
GDateTime *timestamp = g_date_time_new_now_local();
@ -1237,8 +1240,8 @@ win_println(ProfWin *window, theme_item_t theme_item, const char ch, const char
GString *fmt_msg = g_string_new(NULL);
g_string_vprintf(fmt_msg, message, arg);
buffer_append(window->layout->buffer, ch, 0, timestamp, 0, theme_item, "", fmt_msg->str, NULL, NULL);
_win_print_internal(window, ch, 0, timestamp, 0, theme_item, "", fmt_msg->str, NULL);
buffer_append(window->layout->buffer, show_char, 0, timestamp, 0, theme_item, "", fmt_msg->str, NULL, NULL);
_win_print_internal(window, show_char, 0, timestamp, 0, theme_item, "", fmt_msg->str, NULL);
inp_nonblocking(TRUE);
g_date_time_unref(timestamp);
@ -1257,8 +1260,8 @@ win_println_indent(ProfWin *window, int pad, const char *const message, ...)
GString *fmt_msg = g_string_new(NULL);
g_string_vprintf(fmt_msg, message, arg);
buffer_append(window->layout->buffer, '-', pad, timestamp, 0, THEME_DEFAULT, "", fmt_msg->str, NULL, NULL);
_win_print_internal(window, '-', pad, timestamp, 0, THEME_DEFAULT, "", fmt_msg->str, NULL);
buffer_append(window->layout->buffer, "-", pad, timestamp, 0, THEME_DEFAULT, "", fmt_msg->str, NULL, NULL);
_win_print_internal(window, "-", pad, timestamp, 0, THEME_DEFAULT, "", fmt_msg->str, NULL);
inp_nonblocking(TRUE);
g_date_time_unref(timestamp);
@ -1277,8 +1280,8 @@ win_append(ProfWin *window, theme_item_t theme_item, const char *const message,
GString *fmt_msg = g_string_new(NULL);
g_string_vprintf(fmt_msg, message, arg);
buffer_append(window->layout->buffer, '-', 0, timestamp, NO_DATE | NO_EOL, theme_item, "", fmt_msg->str, NULL, NULL);
_win_print_internal(window, '-', 0, timestamp, NO_DATE | NO_EOL, theme_item, "", fmt_msg->str, NULL);
buffer_append(window->layout->buffer, "-", 0, timestamp, NO_DATE | NO_EOL, theme_item, "", fmt_msg->str, NULL, NULL);
_win_print_internal(window, "-", 0, timestamp, NO_DATE | NO_EOL, theme_item, "", fmt_msg->str, NULL);
inp_nonblocking(TRUE);
g_date_time_unref(timestamp);
@ -1297,8 +1300,8 @@ win_appendln(ProfWin *window, theme_item_t theme_item, const char *const message
GString *fmt_msg = g_string_new(NULL);
g_string_vprintf(fmt_msg, message, arg);
buffer_append(window->layout->buffer, '-', 0, timestamp, NO_DATE, theme_item, "", fmt_msg->str, NULL, NULL);
_win_print_internal(window, '-', 0, timestamp, NO_DATE, theme_item, "", fmt_msg->str, NULL);
buffer_append(window->layout->buffer, "-", 0, timestamp, NO_DATE, theme_item, "", fmt_msg->str, NULL, NULL);
_win_print_internal(window, "-", 0, timestamp, NO_DATE, theme_item, "", fmt_msg->str, NULL);
inp_nonblocking(TRUE);
g_date_time_unref(timestamp);
@ -1317,8 +1320,8 @@ win_append_highlight(ProfWin *window, theme_item_t theme_item, const char *const
GString *fmt_msg = g_string_new(NULL);
g_string_vprintf(fmt_msg, message, arg);
buffer_append(window->layout->buffer, '-', 0, timestamp, NO_DATE | NO_ME | NO_EOL, theme_item, "", fmt_msg->str, NULL, NULL);
_win_print_internal(window, '-', 0, timestamp, NO_DATE | NO_ME | NO_EOL, theme_item, "", fmt_msg->str, NULL);
buffer_append(window->layout->buffer, "-", 0, timestamp, NO_DATE | NO_ME | NO_EOL, theme_item, "", fmt_msg->str, NULL, NULL);
_win_print_internal(window, "-", 0, timestamp, NO_DATE | NO_ME | NO_EOL, theme_item, "", fmt_msg->str, NULL);
inp_nonblocking(TRUE);
g_date_time_unref(timestamp);
@ -1337,8 +1340,8 @@ win_appendln_highlight(ProfWin *window, theme_item_t theme_item, const char *con
GString *fmt_msg = g_string_new(NULL);
g_string_vprintf(fmt_msg, message, arg);
buffer_append(window->layout->buffer, '-', 0, timestamp, NO_DATE | NO_ME, theme_item, "", fmt_msg->str, NULL, NULL);
_win_print_internal(window, '-', 0, timestamp, NO_DATE | NO_ME, theme_item, "", fmt_msg->str, NULL);
buffer_append(window->layout->buffer, "-", 0, timestamp, NO_DATE | NO_ME, theme_item, "", fmt_msg->str, NULL, NULL);
_win_print_internal(window, "-", 0, timestamp, NO_DATE | NO_ME, theme_item, "", fmt_msg->str, NULL);
inp_nonblocking(TRUE);
g_date_time_unref(timestamp);
@ -1350,11 +1353,11 @@ win_appendln_highlight(ProfWin *window, theme_item_t theme_item, const char *con
void
win_print_http_upload(ProfWin *window, const char *const message, char *url)
{
win_print_outgoing_with_receipt(window, '!', NULL, message, url, NULL);
win_print_outgoing_with_receipt(window, "!", NULL, message, url, NULL);
}
void
win_print_outgoing_with_receipt(ProfWin *window, const char show_char, const char *const from, const char *const message, char *id, const char *const replace_id)
win_print_outgoing_with_receipt(ProfWin *window, const char *show_char, const char *const from, const char *const message, char *id, const char *const replace_id)
{
GDateTime *time = g_date_time_new_now_local();
@ -1407,7 +1410,7 @@ win_newline(ProfWin *window)
}
static void
_win_printf(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp,
_win_printf(ProfWin *window, const char *show_char, int pad_indent, GDateTime *timestamp,
int flags, theme_item_t theme_item, const char *const from, const char *const message_id, const char *const message, ...)
{
if (timestamp == NULL) {
@ -1433,7 +1436,7 @@ _win_printf(ProfWin *window, const char show_char, int pad_indent, GDateTime *ti
}
static void
_win_print_internal(ProfWin *window, const char show_char, int pad_indent, GDateTime *time,
_win_print_internal(ProfWin *window, const char *show_char, int pad_indent, GDateTime *time,
int flags, theme_item_t theme_item, const char *const from, const char *const message, DeliveryReceipt *receipt)
{
// flags : 1st bit = 0/1 - me/not me. define: NO_ME
@ -1488,7 +1491,7 @@ _win_print_internal(ProfWin *window, const char show_char, int pad_indent, GDate
wbkgdset(window->layout->win, theme_attrs(THEME_TIME));
wattron(window->layout->win, theme_attrs(THEME_TIME));
}
wprintw(window->layout->win, "%s %c ", date_fmt, show_char);
wprintw(window->layout->win, "%s %s ", date_fmt, show_char);
if ((flags & NO_COLOUR_DATE) == 0) {
wattroff(window->layout->win, theme_attrs(THEME_TIME));
}
@ -1824,7 +1827,7 @@ win_command_list_error(ProfWin *window, const char *const error)
{
assert(window != NULL);
win_println(window, THEME_ERROR, '!', "Error retrieving command list: %s", error);
win_println(window, THEME_ERROR, "!", "Error retrieving command list: %s", error);
}
void
@ -1836,7 +1839,7 @@ win_command_exec_error(ProfWin *window, const char *const command, const char *c
GString *msg = g_string_new(NULL);
g_string_vprintf(msg, error, arg);
win_println(window, THEME_ERROR, '!', "Error executing command %s: %s", command, msg->str);
win_println(window, THEME_ERROR, "!", "Error executing command %s: %s", command, msg->str);
g_string_free(msg, TRUE);
va_end(arg);
@ -1848,17 +1851,17 @@ win_handle_command_list(ProfWin *window, GSList *cmds)
assert(window != NULL);
if (cmds) {
win_println(window, THEME_DEFAULT, '!', "Ad hoc commands:");
win_println(window, THEME_DEFAULT, "!", "Ad hoc commands:");
GSList *curr_cmd = cmds;
while (curr_cmd) {
const char *cmd = curr_cmd->data;
win_println(window, THEME_DEFAULT, '!', " %s", cmd);
win_println(window, THEME_DEFAULT, "!", " %s", cmd);
curr_cmd = g_slist_next(curr_cmd);
}
win_println(window, THEME_DEFAULT, '!', "");
win_println(window, THEME_DEFAULT, "!", "");
} else {
win_println(window, THEME_DEFAULT, '!', "No commands found");
win_println(window, THEME_DEFAULT, '!', "");
win_println(window, THEME_DEFAULT, "!", "No commands found");
win_println(window, THEME_DEFAULT, "!", "");
}
}
@ -1866,14 +1869,14 @@ void
win_handle_command_exec_status(ProfWin *window, const char *const command, const char *const value)
{
assert(window != NULL);
win_println(window, THEME_DEFAULT, '!', "%s %s", command, value);
win_println(window, THEME_DEFAULT, "!", "%s %s", command, value);
}
void
win_handle_command_exec_result_note(ProfWin *window, const char *const type, const char *const value)
{
assert(window != NULL);
win_println(window, THEME_DEFAULT, '!', value);
win_println(window, THEME_DEFAULT, "!", value);
}
void
@ -1898,7 +1901,7 @@ win_insert_last_read_position_marker(ProfWin *window, char* id)
// the separator will actually be print in win_redraw().
// this only puts it in the buffer and win_redraw() will interpret it.
// so that we have the correct length even when resizing.
buffer_append(window->layout->buffer, ' ', 0, time, 0, THEME_TEXT, NULL, "-", NULL, id);
buffer_append(window->layout->buffer, " ", 0, time, 0, THEME_TEXT, NULL, "-", NULL, id);
win_redraw(window);
g_date_time_unref(time);

View File

@ -62,12 +62,12 @@ void win_show_status_string(ProfWin *window, const char *const from,
GDateTime *last_activity, const char *const pre,
const char *const default_show);
void win_print_them(ProfWin *window, theme_item_t theme_item, char ch, int flags, const char *const them);
void win_print_them(ProfWin *window, theme_item_t theme_item, const char *const show_char, int flags, const char *const them);
void win_print_incoming(ProfWin *window, const char *const from, ProfMessage *message);
void win_print_outgoing(ProfWin *window, const char ch, const char *const id, const char *const replace_id, const char *const message);
void win_print_outgoing_with_receipt(ProfWin *window, const char show_char, const char *const from, const char *const message, char *id, const char *const replace_id);
void win_println_incoming_muc_msg(ProfWin *window, char ch, int flags, const char *const them, const char *const id, const char *const replace_id, const char *const message);
void win_print_outgoing_muc_msg(ProfWin *window, char ch, const char *const me, const char *const id, const char *const replace_id, const char *const message);
void win_print_outgoing(ProfWin *window, const char *show_char, const char *const id, const char *const replace_id, const char *const message);
void win_print_outgoing_with_receipt(ProfWin *window, const char *show_char, const char *const from, const char *const message, char *id, const char *const replace_id);
void win_println_incoming_muc_msg(ProfWin *window, char *show_char, int flags, const char *const them, const char *const id, const char *const replace_id, const char *const message);
void win_print_outgoing_muc_msg(ProfWin *window, char *show_char, const char *const me, const char *const id, const char *const replace_id, const char *const message);
void win_print_history(ProfWin *window, GDateTime *timestamp, const char *const message);
void win_print_http_upload(ProfWin *window, const char *const message, char *url);

View File

@ -279,7 +279,7 @@ wins_private_nick_change(const char *const roomjid, const char *const oldnick, c
Jid *newjid = jid_create_from_bare_and_resource(roomjid, newnick);
privwin->fulljid = strdup(newjid->fulljid);
win_println((ProfWin*)privwin, THEME_THEM, '!', "** %s is now known as %s.", oldjid->resourcepart, newjid->resourcepart);
win_println((ProfWin*)privwin, THEME_THEM, "!", "** %s is now known as %s.", oldjid->resourcepart, newjid->resourcepart);
autocomplete_remove(wins_ac, oldjid->fulljid);
autocomplete_remove(wins_close_ac, oldjid->fulljid);
@ -830,7 +830,7 @@ wins_lost_connection(void)
while (curr) {
ProfWin *window = curr->data;
if (window->type != WIN_CONSOLE) {
win_println(window, THEME_ERROR, '-', "Lost connection.");
win_println(window, THEME_ERROR, "-", "Lost connection.");
// if current win, set current_win_dirty
if (wins_is_current(window)) {
@ -851,7 +851,7 @@ wins_reestablished_connection(void)
while (curr) {
ProfWin *window = curr->data;
if (window->type != WIN_CONSOLE) {
win_println(window, THEME_TEXT, '-', "Connection re-established.");
win_println(window, THEME_TEXT, "-", "Connection re-established.");
// if current win, set current_win_dirty
if (wins_is_current(window)) {

View File

@ -46,13 +46,13 @@ xmlwin_show(ProfXMLWin *xmlwin, const char *const msg)
ProfWin *window = (ProfWin*)xmlwin;
if (g_str_has_prefix(msg, "SENT:")) {
win_println(window, THEME_DEFAULT, '-', "SENT:");
win_println(window, THEME_ONLINE, '-', "%s", &msg[6]);
win_println(window, THEME_ONLINE, '-', "");
win_println(window, THEME_DEFAULT, "-", "SENT:");
win_println(window, THEME_ONLINE, "-", "%s", &msg[6]);
win_println(window, THEME_ONLINE, "-", "");
} else if (g_str_has_prefix(msg, "RECV:")) {
win_println(window, THEME_DEFAULT, '-', "RECV:");
win_println(window, THEME_AWAY, '-', "%s", &msg[6]);
win_println(window, THEME_AWAY, '-', "");
win_println(window, THEME_DEFAULT, "-", "RECV:");
win_println(window, THEME_AWAY, "-", "%s", &msg[6]);
win_println(window, THEME_AWAY, "-", "");
}
}

View File

@ -532,7 +532,7 @@ void win_show_subwin(ProfWin *window) {}
void win_refresh_without_subwin(ProfWin *window) {}
void win_refresh_with_subwin(ProfWin *window) {}
void win_println(ProfWin *window, theme_item_t theme, const char ch, const char *const message, ...)
void win_println(ProfWin *window, theme_item_t theme, const char *ch, const char *const message, ...)
{
va_list args;
va_start(args, message);
@ -541,7 +541,7 @@ void win_println(ProfWin *window, theme_item_t theme, const char ch, const char
va_end(args);
}
void win_print(ProfWin *window, theme_item_t theme_item, const char ch, const char *const message, ...) {}
void win_print(ProfWin *window, theme_item_t theme_item, const char *ch, const char *const message, ...) {}
void win_appendln(ProfWin *window, theme_item_t theme_item, const char *const message, ...) {}
char* win_get_title(ProfWin *window)