mirror of
https://github.com/bqv/weechat-xmpp/
synced 2024-11-18 03:25:37 +00:00
hacky colours
This commit is contained in:
parent
71531be5e6
commit
8988d969a0
@ -130,7 +130,7 @@ void account__log_emit_weechat(void *const userdata, const xmpp_log_level_t leve
|
||||
weechat_printf(
|
||||
account ? account->buffer : NULL,
|
||||
_("%s%s (%s): %s"),
|
||||
weechat_prefix("error"), area,
|
||||
weechat_prefix("network"), area,
|
||||
log_level_name[level], header);
|
||||
for (int i = 1; i < size; i++)
|
||||
weechat_printf(
|
||||
@ -144,7 +144,7 @@ void account__log_emit_weechat(void *const userdata, const xmpp_log_level_t leve
|
||||
weechat_printf(
|
||||
account ? account->buffer : NULL,
|
||||
_("%s%s (%s): %s"),
|
||||
weechat_prefix("error"), area,
|
||||
weechat_prefix("network"), area,
|
||||
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_stanza_release(message);
|
||||
if (channel->type != CHANNEL_TYPE_MUC)
|
||||
weechat_printf(channel->buffer, "%s: %s",
|
||||
weechat_config_string(account->options[ACCOUNT_OPTION_JID]),
|
||||
weechat_printf(channel->buffer, "%s%s",
|
||||
user__as_prefix_raw(
|
||||
account,
|
||||
weechat_config_string(account->options[ACCOUNT_OPTION_JID])),
|
||||
body);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
//#include "oauth.h"
|
||||
//#include "teaminfo.h"
|
||||
#include "account.h"
|
||||
#include "user.h"
|
||||
#include "channel.h"
|
||||
#include "buffer.h"
|
||||
#include "message.h"
|
||||
@ -490,9 +491,11 @@ int command__me(const void *pointer, void *data,
|
||||
xmpp_message_set_body(message, text);
|
||||
xmpp_send(ptr_account->connection, message);
|
||||
xmpp_stanza_release(message);
|
||||
weechat_printf(ptr_channel->buffer, "* %s %s",
|
||||
weechat_config_string(ptr_account->options[ACCOUNT_OPTION_JID]),
|
||||
text);
|
||||
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]),
|
||||
text);
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
|
12
connection.c
12
connection.c
@ -10,6 +10,7 @@
|
||||
#include "plugin.h"
|
||||
#include "config.h"
|
||||
#include "account.h"
|
||||
#include "user.h"
|
||||
#include "channel.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)
|
||||
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))
|
||||
weechat_printf(channel->buffer, "* %s %s", from, intext+4);
|
||||
weechat_printf(channel->buffer, "%s%s %s",
|
||||
weechat_prefix("action"), from, intext+4);
|
||||
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);
|
||||
|
||||
|
34
user.c
34
user.c
@ -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);
|
||||
}
|
||||
|
||||
const char *user__as_prefix(struct t_account *account,
|
||||
struct t_user *user,
|
||||
const char *name)
|
||||
const char *user__as_prefix_raw(struct t_account *account,
|
||||
const char *name)
|
||||
{
|
||||
static char result[256];
|
||||
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,
|
||||
struct t_user *user,
|
||||
const char *name)
|
||||
{
|
||||
static char result[2048];
|
||||
|
||||
(void) account;
|
||||
|
||||
@ -39,7 +53,7 @@ const char *user__as_prefix(struct t_account *account,
|
||||
}
|
||||
|
||||
struct t_user *user__bot_search(struct t_account *account,
|
||||
const char *bot_id)
|
||||
const char *bot_id)
|
||||
{
|
||||
struct t_user *ptr_user;
|
||||
|
||||
@ -58,7 +72,7 @@ struct t_user *user__bot_search(struct t_account *account,
|
||||
}
|
||||
|
||||
struct t_user *user__search(struct t_account *account,
|
||||
const char *id)
|
||||
const char *id)
|
||||
{
|
||||
struct t_user *ptr_user;
|
||||
|
||||
@ -76,8 +90,8 @@ struct t_user *user__search(struct t_account *account,
|
||||
}
|
||||
|
||||
void user__nicklist_add(struct t_account *account,
|
||||
struct t_channel *channel,
|
||||
struct t_user *user)
|
||||
struct t_channel *channel,
|
||||
struct t_user *user)
|
||||
{
|
||||
struct t_gui_nick_group *ptr_group;
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
@ -89,7 +103,7 @@ void user__nicklist_add(struct t_account *account,
|
||||
"+" : "...");
|
||||
weechat_nicklist_add_nick(ptr_buffer, ptr_group,
|
||||
user->profile.display_name,
|
||||
user->is_away ?
|
||||
user->is_away ?
|
||||
"weechat.color.nicklist_away" :
|
||||
user__get_colour_for_nicklist(user),
|
||||
user->is_away ? "+" : "",
|
||||
@ -98,7 +112,7 @@ void user__nicklist_add(struct t_account *account,
|
||||
}
|
||||
|
||||
struct t_user *user__new(struct t_account *account,
|
||||
const char *id, const char *display_name)
|
||||
const char *id, const char *display_name)
|
||||
{
|
||||
struct t_user *new_user, *ptr_user;
|
||||
|
||||
|
17
user.h
17
user.h
@ -53,23 +53,26 @@ struct t_channel;
|
||||
|
||||
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,
|
||||
struct t_user *user,
|
||||
const char *name);
|
||||
struct t_user *user,
|
||||
const char *name);
|
||||
|
||||
struct t_user *user__bot_search(struct t_account *account,
|
||||
const char *bot_id);
|
||||
const char *bot_id);
|
||||
|
||||
struct t_user *user__search(struct t_account *account,
|
||||
const char *id);
|
||||
const char *id);
|
||||
|
||||
struct t_user *user__new(struct t_account *account,
|
||||
const char *id, const char *display_name);
|
||||
const char *id, const char *display_name);
|
||||
|
||||
void user__free_all(struct t_account *account);
|
||||
|
||||
void user__nicklist_add(struct t_account *account,
|
||||
struct t_channel *channel,
|
||||
struct t_user *user);
|
||||
struct t_channel *channel,
|
||||
struct t_user *user);
|
||||
|
||||
#endif /*WEECHAT_XMPP_USER_H*/
|
||||
|
Loading…
Reference in New Issue
Block a user