hacky colours

v1
Tony Olagbaiye 4 years ago
parent 71531be5e6
commit 8988d969a0
No known key found for this signature in database
GPG Key ID: 9E2FF3BDEBDFC910

@ -130,7 +130,7 @@ void account__log_emit_weechat(void *const userdata, const xmpp_log_level_t leve
weechat_printf( weechat_printf(
account ? account->buffer : NULL, account ? account->buffer : NULL,
_("%s%s (%s): %s"), _("%s%s (%s): %s"),
weechat_prefix("error"), area, weechat_prefix("network"), area,
log_level_name[level], header); log_level_name[level], header);
for (int i = 1; i < size; i++) for (int i = 1; i < size; i++)
weechat_printf( weechat_printf(
@ -144,7 +144,7 @@ void account__log_emit_weechat(void *const userdata, const xmpp_log_level_t leve
weechat_printf( weechat_printf(
account ? account->buffer : NULL, account ? account->buffer : NULL,
_("%s%s (%s): %s"), _("%s%s (%s): %s"),
weechat_prefix("error"), area, weechat_prefix("network"), area,
log_level_name[level], msg); log_level_name[level], msg);
} }
} }

@ -610,7 +610,9 @@ void channel__send_message(struct t_account *account, struct t_channel *channel,
xmpp_send(account->connection, message); xmpp_send(account->connection, message);
xmpp_stanza_release(message); xmpp_stanza_release(message);
if (channel->type != CHANNEL_TYPE_MUC) if (channel->type != CHANNEL_TYPE_MUC)
weechat_printf(channel->buffer, "%s: %s", weechat_printf(channel->buffer, "%s%s",
weechat_config_string(account->options[ACCOUNT_OPTION_JID]), user__as_prefix_raw(
account,
weechat_config_string(account->options[ACCOUNT_OPTION_JID])),
body); body);
} }

@ -11,6 +11,7 @@
//#include "oauth.h" //#include "oauth.h"
//#include "teaminfo.h" //#include "teaminfo.h"
#include "account.h" #include "account.h"
#include "user.h"
#include "channel.h" #include "channel.h"
#include "buffer.h" #include "buffer.h"
#include "message.h" #include "message.h"
@ -490,7 +491,9 @@ int command__me(const void *pointer, void *data,
xmpp_message_set_body(message, text); xmpp_message_set_body(message, text);
xmpp_send(ptr_account->connection, message); xmpp_send(ptr_account->connection, message);
xmpp_stanza_release(message); xmpp_stanza_release(message);
weechat_printf(ptr_channel->buffer, "* %s %s", if (ptr_channel->type != CHANNEL_TYPE_MUC)
weechat_printf(ptr_channel->buffer, "%s%s %s",
weechat_prefix("action"),
weechat_config_string(ptr_account->options[ACCOUNT_OPTION_JID]), weechat_config_string(ptr_account->options[ACCOUNT_OPTION_JID]),
text); text);
} }

@ -10,6 +10,7 @@
#include "plugin.h" #include "plugin.h"
#include "config.h" #include "config.h"
#include "account.h" #include "account.h"
#include "user.h"
#include "channel.h" #include "channel.h"
#include "connection.h" #include "connection.h"
@ -106,11 +107,16 @@ int message_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata)
} }
if (strcmp(to, channel->id) == 0) if (strcmp(to, channel->id) == 0)
weechat_printf(channel->buffer, "%s [to %s]: %s", from, to, intext); weechat_printf(channel->buffer, "%s[to %s]: %s",
user__as_prefix_raw(account->context, from),
to, intext);
else if (weechat_string_match(intext, "/me *", 0)) else if (weechat_string_match(intext, "/me *", 0))
weechat_printf(channel->buffer, "* %s %s", from, intext+4); weechat_printf(channel->buffer, "%s%s %s",
weechat_prefix("action"), from, intext+4);
else else
weechat_printf(channel->buffer, "%s: %s", from, intext); weechat_printf(channel->buffer, "%s%s",
user__as_prefix_raw(account->context, from),
intext);
xmpp_free(account->context, intext); xmpp_free(account->context, intext);

@ -23,11 +23,25 @@ const char *user__get_colour_for_nicklist(struct t_user *user)
return weechat_info_get("nick_color_name", user->profile.display_name); return weechat_info_get("nick_color_name", user->profile.display_name);
} }
const char *user__as_prefix_raw(struct t_account *account,
const char *name)
{
static char result[2048];
(void) account;
snprintf(result, sizeof(result), "%s%s\t",
weechat_info_get("nick_color", name),
name);
return result;
}
const char *user__as_prefix(struct t_account *account, const char *user__as_prefix(struct t_account *account,
struct t_user *user, struct t_user *user,
const char *name) const char *name)
{ {
static char result[256]; static char result[2048];
(void) account; (void) account;

@ -53,6 +53,9 @@ struct t_channel;
const char *user__get_colour(struct t_user *user); const char *user__get_colour(struct t_user *user);
const char *user__as_prefix_raw(struct t_account *account,
const char *name);
const char *user__as_prefix(struct t_account *account, const char *user__as_prefix(struct t_account *account,
struct t_user *user, struct t_user *user,
const char *name); const char *name);

Loading…
Cancel
Save