aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--protocols/jabber/conference.c28
-rw-r--r--protocols/jabber/jabber.c7
-rw-r--r--protocols/jabber/jabber.h1
-rw-r--r--protocols/jabber/sasl.c2
-rw-r--r--protocols/nogaim.c6
-rw-r--r--protocols/nogaim.h4
6 files changed, 42 insertions, 6 deletions
diff --git a/protocols/jabber/conference.c b/protocols/jabber/conference.c
index 3fc9ee70..008bbe63 100644
--- a/protocols/jabber/conference.c
+++ b/protocols/jabber/conference.c
@@ -96,6 +96,25 @@ int jabber_chat_msg( struct groupchat *c, char *message, int flags )
return 1;
}
+int jabber_chat_topic( struct groupchat *c, char *topic )
+{
+ struct im_connection *ic = c->ic;
+ struct jabber_chat *jc = c->data;
+ struct xt_node *node;
+
+ node = xt_new_node( "subject", topic, NULL );
+ node = jabber_make_packet( "message", "groupchat", jc->name, node );
+
+ if( !jabber_write_packet( ic, node ) )
+ {
+ xt_free_node( node );
+ return 0;
+ }
+ xt_free_node( node );
+
+ return 1;
+}
+
int jabber_chat_leave( struct groupchat *c, const char *reason )
{
struct im_connection *ic = c->ic;
@@ -213,6 +232,7 @@ void jabber_chat_pkt_presence( struct im_connection *ic, struct jabber_buddy *bu
void jabber_chat_pkt_message( struct im_connection *ic, struct jabber_buddy *bud, struct xt_node *node )
{
+ struct xt_node *subject = xt_find_node( node->children, "subject" );
struct xt_node *body = xt_find_node( node->children, "body" );
struct groupchat *chat;
char *s;
@@ -236,6 +256,14 @@ void jabber_chat_pkt_message( struct im_connection *ic, struct jabber_buddy *bud
return;
}
+ if( subject )
+ {
+ s = strchr( bud->ext_jid, '/' );
+ if( s ) *s = 0;
+ imcb_chat_topic( chat, bud->ext_jid, subject->text_len > 0 ?
+ subject->text : NULL, jabber_get_timestamp( node ) );
+ if( s ) *s = '/';
+ }
if( body && body->text_len > 0 )
{
s = strchr( bud->ext_jid, '/' );
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c
index ab26efc9..e7be63fd 100644
--- a/protocols/jabber/jabber.c
+++ b/protocols/jabber/jabber.c
@@ -384,6 +384,12 @@ static void jabber_chat_msg_( struct groupchat *c, char *message, int flags )
jabber_chat_msg( c, message, flags );
}
+static void jabber_chat_topic_( struct groupchat *c, char *topic )
+{
+ if( c && topic )
+ jabber_chat_topic( c, topic );
+}
+
static void jabber_chat_leave_( struct groupchat *c )
{
if( c )
@@ -460,6 +466,7 @@ void jabber_initmodule()
ret->add_buddy = jabber_add_buddy;
ret->remove_buddy = jabber_remove_buddy;
ret->chat_msg = jabber_chat_msg_;
+ ret->chat_topic = jabber_chat_topic_;
// ret->chat_invite = jabber_chat_invite;
ret->chat_leave = jabber_chat_leave_;
ret->chat_join = jabber_chat_join_;
diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h
index 7af7f98e..e26c3899 100644
--- a/protocols/jabber/jabber.h
+++ b/protocols/jabber/jabber.h
@@ -228,6 +228,7 @@ gboolean sasl_supported( struct im_connection *ic );
struct groupchat *jabber_chat_join( struct im_connection *ic, char *room, char *nick, char *password );
void jabber_chat_free( struct groupchat *c );
int jabber_chat_msg( struct groupchat *ic, char *message, int flags );
+int jabber_chat_topic( struct groupchat *c, char *topic );
int jabber_chat_leave( struct groupchat *c, const char *reason );
void jabber_chat_pkt_presence( struct im_connection *ic, struct jabber_buddy *bud, struct xt_node *node );
void jabber_chat_pkt_message( struct im_connection *ic, struct jabber_buddy *bud, struct xt_node *node );
diff --git a/protocols/jabber/sasl.c b/protocols/jabber/sasl.c
index 6eee37b3..87059051 100644
--- a/protocols/jabber/sasl.c
+++ b/protocols/jabber/sasl.c
@@ -331,5 +331,5 @@ gboolean sasl_supported( struct im_connection *ic )
{
struct jabber_data *jd = ic->proto_data;
- return ( (void*) ( jd->xt && jd->xt->root && xt_find_attr( jd->xt->root, "version" ) ) ) != NULL;
+ return ( jd->xt && jd->xt->root && xt_find_attr( jd->xt->root, "version" ) ) != 0;
}
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index 2ad8a049..e0f04c0b 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -759,15 +759,15 @@ void imcb_chat_msg( struct groupchat *c, char *who, char *msg, u_int32_t flags,
g_free( wrapped );
}
-void imcb_chat_topic( struct groupchat *c, char *who, char *topic )
+void imcb_chat_topic( struct groupchat *c, char *who, char *topic, time_t set_at )
{
struct im_connection *ic = c->ic;
user_t *u = NULL;
if( who == NULL)
- u = user_find( ic, ic->irc->mynick );
+ u = user_find( ic->irc, ic->irc->mynick );
else if( g_strcasecmp( who, ic->acc->user ) == 0 )
- u = user_find( ic, ic->irc->nick );
+ u = user_find( ic->irc, ic->irc->nick );
else
u = user_findhandle( ic, who );
diff --git a/protocols/nogaim.h b/protocols/nogaim.h
index 7c643cd3..adee5e33 100644
--- a/protocols/nogaim.h
+++ b/protocols/nogaim.h
@@ -218,7 +218,7 @@ struct prpl {
server to confirm the topic change with a regular topic change
event. If it doesn't do that, you have to fake it to make it
visible to the user. */
- void (* chat_topic) (struct groupchat *, char *message);
+ void (* chat_topic) (struct groupchat *, char *topic);
/* You can tell what away states your protocol supports, so that
* BitlBee will try to map the IRC away reasons to them, or use
@@ -301,7 +301,7 @@ G_MODULE_EXPORT void imcb_chat_remove_buddy( struct groupchat *b, char *handle,
/* To tell BitlBee 'who' said 'msg' in 'c'. 'flags' and 'sent_at' can be 0. */
G_MODULE_EXPORT void imcb_chat_msg( struct groupchat *c, char *who, char *msg, u_int32_t flags, time_t sent_at );
/* To tell BitlBee 'who' changed the topic of 'c' to 'topic'. */
-G_MODULE_EXPORT void imcb_chat_topic( struct groupchat *c, char *who, char *topic );
+G_MODULE_EXPORT void imcb_chat_topic( struct groupchat *c, char *who, char *topic, time_t set_at );
G_MODULE_EXPORT void imcb_chat_free( struct groupchat *c );
/* Actions, or whatever. */