aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--irc_im.c24
-rw-r--r--protocols/bee.h1
-rw-r--r--protocols/bee_chat.c21
3 files changed, 33 insertions, 13 deletions
diff --git a/irc_im.c b/irc_im.c
index 1f36059d..b7c90f2c 100644
--- a/irc_im.c
+++ b/irc_im.c
@@ -337,6 +337,23 @@ static gboolean bee_irc_chat_remove_user( bee_t *bee, struct groupchat *c, bee_u
return TRUE;
}
+static gboolean bee_irc_chat_topic( bee_t *bee, struct groupchat *c, const char *new, bee_user_t *bu )
+{
+ irc_t *irc = bee->ui_data;
+ irc_user_t *iu;
+
+ if( bu == NULL )
+ iu = irc->root;
+ else if( bu == bee->user )
+ iu = irc->user;
+ else
+ iu = bu->ui_data;
+
+ irc_channel_set_topic( c->ui_data, new, iu );
+
+ return TRUE;
+}
+
static gboolean bee_irc_chat_name_hint( bee_t *bee, struct groupchat *c, const char *name )
{
irc_t *irc = bee->ui_data;
@@ -390,11 +407,15 @@ static gboolean bee_irc_channel_chat_part( irc_channel_t *ic, const char *msg )
}
+static gboolean bee_irc_channel_chat_topic( irc_channel_t *ic, const char *new )
+{
+}
+
static const struct irc_channel_funcs irc_channel_im_chat_funcs = {
bee_irc_channel_chat_privmsg,
NULL, /* join */
bee_irc_channel_chat_part,
- NULL, /* topic */
+ bee_irc_channel_chat_topic,
};
@@ -438,6 +459,7 @@ const struct bee_ui_funcs irc_ui_funcs = {
bee_irc_chat_msg,
bee_irc_chat_add_user,
bee_irc_chat_remove_user,
+ bee_irc_chat_topic,
bee_irc_chat_name_hint,
bee_irc_ft_in_start,
diff --git a/protocols/bee.h b/protocols/bee.h
index c1b95881..e0ab0030 100644
--- a/protocols/bee.h
+++ b/protocols/bee.h
@@ -84,6 +84,7 @@ typedef struct bee_ui_funcs
gboolean (*chat_msg)( bee_t *bee, struct groupchat *c, bee_user_t *bu, const char *msg, time_t sent_at );
gboolean (*chat_add_user)( bee_t *bee, struct groupchat *c, bee_user_t *bu );
gboolean (*chat_remove_user)( bee_t *bee, struct groupchat *c, bee_user_t *bu );
+ gboolean (*chat_topic)( bee_t *bee, struct groupchat *c, const char *new, bee_user_t *bu );
gboolean (*chat_name_hint)( bee_t *bee, struct groupchat *c, const char *name );
struct file_transfer* (*ft_in_start)( bee_t *bee, bee_user_t *bu, const char *file_name, size_t file_size );
diff --git a/protocols/bee_chat.c b/protocols/bee_chat.c
index 36e4c453..e565b616 100644
--- a/protocols/bee_chat.c
+++ b/protocols/bee_chat.c
@@ -123,27 +123,25 @@ void imcb_chat_log( struct groupchat *c, char *format, ... )
void imcb_chat_topic( struct groupchat *c, char *who, char *topic, time_t set_at )
{
-#if 0
struct im_connection *ic = c->ic;
- user_t *u = NULL;
+ bee_t *bee = ic->bee;
+ bee_user_t *bu;
+
+ if( !bee->ui->chat_topic )
+ return;
if( who == NULL)
- u = user_find( ic->irc, ic->irc->mynick );
+ bu = NULL;
else if( g_strcasecmp( who, ic->acc->user ) == 0 )
- u = user_find( ic->irc, ic->irc->nick );
+ bu = bee->user;
else
- u = user_findhandle( ic, who );
+ bu = bee_user_by_handle( bee, ic, who );
if( ( g_strcasecmp( set_getstr( &ic->bee->set, "strip_html" ), "always" ) == 0 ) ||
( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->bee->set, "strip_html" ) ) )
strip_html( topic );
- g_free( c->topic );
- c->topic = g_strdup( topic );
-
- if( c->joined && u )
- irc_write( ic->irc, ":%s!%s@%s TOPIC %s :%s", u->nick, u->user, u->host, c->channel, topic );
-#endif
+ bee->ui->chat_topic( bee, c, topic, bu );
}
void imcb_chat_add_buddy( struct groupchat *c, const char *handle )
@@ -205,7 +203,6 @@ int bee_chat_msg( bee_t *bee, struct groupchat *c, const char *msg, int flags )
{
struct im_connection *ic = c->ic;
char *buf = NULL;
- int st;
if( ( ic->flags & OPT_DOES_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
{