aboutsummaryrefslogtreecommitdiffstats
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/jabber/jabber.c20
-rw-r--r--protocols/jabber/message.c25
2 files changed, 41 insertions, 4 deletions
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c
index cc7bac3d..84d7e366 100644
--- a/protocols/jabber/jabber.c
+++ b/protocols/jabber/jabber.c
@@ -111,6 +111,22 @@ static int jabber_send_im( struct gaim_connection *gc, char *who, char *message,
return 0;
}
+static GList *jabber_away_states( struct gaim_connection *gc )
+{
+ GList *l = NULL;
+
+ l = g_list_append( l, (void*) "Online" );
+ l = g_list_append( l, (void*) "Away" );
+ l = g_list_append( l, (void*) "Extended Away" );
+ l = g_list_append( l, (void*) "Do Not Disturb" );
+
+ return( l );
+}
+
+static void jabber_set_away( struct gaim_connection *gc, char *state, char *message )
+{
+}
+
void jabber_init()
{
struct prpl *ret = g_new0(struct prpl, 1);
@@ -120,9 +136,9 @@ void jabber_init()
ret->acc_init = jabber_acc_init;
ret->close = jabber_close;
ret->send_im = jabber_send_im;
-// ret->away_states = jabber_away_states;
+ ret->away_states = jabber_away_states;
// ret->get_status_string = jabber_get_status_string;
-// ret->set_away = jabber_set_away;
+ ret->set_away = jabber_set_away;
// ret->set_info = jabber_set_info;
// ret->get_info = jabber_get_info;
// ret->add_buddy = jabber_add_buddy;
diff --git a/protocols/jabber/message.c b/protocols/jabber/message.c
index e5f75464..b41522fd 100644
--- a/protocols/jabber/message.c
+++ b/protocols/jabber/message.c
@@ -25,11 +25,32 @@
xt_status jabber_pkt_message( struct xt_node *node, gpointer data )
{
+ struct gaim_connection *gc = data;
char *from = xt_find_attr( node, "from" );
+ char *type = xt_find_attr( node, "type" );
struct xt_node *msg = xt_find_node( node->children, "body" );
- printf( "Received MSG from %s: %s\n", from, msg ? msg->text : "<null>" );
- xt_print( node );
+ if( !type || !msg )
+ return XT_HANDLED; /* Grmbl... FIXME */
+
+ if( strcmp( type, "chat" ) == 0 )
+ {
+ char *s;
+
+ s = strchr( from, '/' );
+ if( s )
+ *s = 0;
+
+ serv_got_im( gc, from, msg->text, 0, 0, 0 );
+
+ if( s )
+ *s = '/';
+ }
+ else
+ {
+ printf( "Received MSG from %s: %s\n", from, msg ? msg->text : "<null>" );
+ xt_print( node );
+ }
return XT_HANDLED;
}