Index: protocols/jabber/jabber.c
===================================================================
--- protocols/jabber/jabber.c	(revision df61847525ba9e8d6d42c4295d034175fd2d0445)
+++ protocols/jabber/jabber.c	(revision 43e3368f4ad8249523d9c8a0d57a764ac370daf4)
@@ -762,8 +762,8 @@
 static void jabber_handlemessage(gjconn gjc, jpacket p)
 {
-	xmlnode y, xmlns, subj, z;
+	xmlnode y, xmlns, z;
 	time_t time_sent = time(NULL);
 
-	char *from = NULL, *msg = NULL, *type = NULL, *topic = NULL;
+	char *from = NULL, *msg = NULL, *type = NULL;
 	char m[BUF_LONG * 2];
 
@@ -803,16 +803,5 @@
 
 		if (type && !g_strcasecmp(type, "jabber:x:conference")) {
-			char *room;
-			GList *m = NULL;
-			char **data;
-
-			room = xmlnode_get_attrib(xmlns, "jid");
-			data = g_strsplit(room, "@", 2);
-			m = g_list_append(m, g_strdup(data[0]));
-			m = g_list_append(m, g_strdup(data[1]));
-			m = g_list_append(m, g_strdup(gjc->user->user));
-			g_strfreev(data);
-
-			/* ** Bitlbee ** serv_got_chat_invite(GJ_GC(gjc), room, from, msg, m); */
+			/* do nothing */
 		} else if (msg) { /* whisper */
 			struct jabber_chat *jc;
@@ -822,20 +811,13 @@
 			else {
 				int flags = 0;
-				/* ** Bitlbee **
-				if (xmlnode_get_tag(p->x, "gaim"))
-					flags = IM_FLAG_GAIMUSER;
-				if (find_conversation(jid_full(p->from)))
-					serv_got_im(GJ_GC(gjc), jid_full(p->from), m, flags, time_sent, -1);
-				else {
-				** End - Bitlbee ** */
-					if(p->from->user) {
-					    from = g_strdup_printf("%s@%s", p->from->user, p->from->server);
-					} else {
-					    /* server message? */
-					    from = g_strdup(p->from->server);
-					}
-					serv_got_im(GJ_GC(gjc), from, m, flags, time_sent, -1);
-					g_free(from);
-				/* ** Bitlbee ** } ** End - Bitlbee ** */
+				
+				if(p->from->user) {
+				    from = g_strdup_printf("%s@%s", p->from->user, p->from->server);
+				} else {
+				    /* server message? */
+				    from = g_strdup(p->from->server);
+				}
+				serv_got_im(GJ_GC(gjc), from, m, flags, time_sent, -1);
+				g_free(from);
 			}
 		}
@@ -852,73 +834,43 @@
 			g_free(from);
 		}
-	} else if (!g_strcasecmp(type, "groupchat")) {
-		struct jabber_chat *jc;
-		static int i = 0;
-
-		/*
-		if ((y = xmlnode_get_tag(p->x, "html"))) {
-			msg = xmlnode_get_data(y);
-		} else
-		*/
-		if ((y = xmlnode_get_tag(p->x, "body"))) {
-			msg = xmlnode_get_data(y);
-		}
-
-		msg = utf8_to_str(msg);
+	} else if (!g_strcasecmp(type, "headline")) {
+		char *subject, *body, *url;
 		
-		if ((subj = xmlnode_get_tag(p->x, "subject"))) {
-		   	topic = xmlnode_get_data(subj);
-		} 
-		topic = utf8_to_str(topic);
-
-		jc = find_existing_chat(GJ_GC(gjc), p->from);
-		if (!jc) {
-			/* we're not in this chat. are we supposed to be? */
-			if ((jc = find_pending_chat(GJ_GC(gjc), p->from)) != NULL) {
-				/* yes, we're supposed to be. so now we are. */
-				jc->b = serv_got_joined_chat(GJ_GC(gjc), i++, p->from->user);
-				jc->id = jc->b->id;
-				jc->state = JCS_ACTIVE;
-			} else {
-				/* no, we're not supposed to be. */
-				g_free(msg);
-				return;
-			}
-		}
-		if (p->from->resource) {
-			if (!y) {
-				if (!find_chat_buddy(jc->b, p->from->resource)) {
-					add_chat_buddy(jc->b, p->from->resource);
-				} else if ((y = xmlnode_get_tag(p->x, "status"))) {
-					char *buf;
-
-					buf = g_strdup_printf("%s@%s/%s",
-						p->from->user, p->from->server, p->from->resource);
-					jabber_track_away(gjc, p, buf, NULL);
-					g_free(buf);
-
-				}
-			} else if (jc->b && msg) {
-				char buf[8192];
-
-				if (topic) {
-					char tbuf[8192];
-					g_snprintf(tbuf, sizeof(tbuf), "%s", topic);
-				}
-				
-
-				g_snprintf(buf, sizeof(buf), "%s", msg);
-				serv_got_chat_in(GJ_GC(gjc), jc->b->id, p->from->resource, 0, buf, time_sent);
-			}
-		} else { /* message from the server */
-		   	if(jc->b && topic) {
-			   	char tbuf[8192];
-				g_snprintf(tbuf, sizeof(tbuf), "%s", topic);
-			}
-		}
-
-		g_free(msg);
-		g_free(topic);
-
+		y = xmlnode_get_tag( p->x, "body" );
+		body = y ? g_strdup( xmlnode_get_data( y ) ) : NULL;
+		
+		y = xmlnode_get_tag( p->x, "subject" );
+		subject = y ? g_strdup( xmlnode_get_data( y ) ) : NULL;
+		
+		url = NULL;
+		z = xmlnode_get_firstchild(p->x);
+		while( z )
+		{
+			char *xtype = xmlnode_get_attrib( z, "xmlns" );
+			
+			if( xtype && g_strcasecmp( xtype, "jabber:x:oob" ) == 0 &&
+			             ( y = xmlnode_get_tag( z, "url" ) ) )
+			{
+				url = g_strdup( xmlnode_get_data( y ) );
+				break;
+			}
+			
+			z = xmlnode_get_nextsibling( z );
+		}
+		
+		g_snprintf( m, BUF_LONG, "Subject: %s\nURL: %s\nMessage:\n%s", subject ? subject : "(none)",
+		                     url ? url : "(none)", body ? body : "(none)" );
+
+		if( p->from->user )
+			from = g_strdup_printf( "%s@%s", p->from->user, p->from->server );
+		else
+			from = g_strdup( p->from->server );
+		
+		serv_got_im( GJ_GC(gjc), from, m, 0, time_sent, -1 );
+		
+		g_free( from );
+		g_free( subject );
+		g_free( body );
+		g_free( url );
 	}
 }
