changeset 1316:d5069ad0b6b1

[gaim-migrate @ 1326] getting it to look pretty. this is probably bad, but eh. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 19 Dec 2000 14:48:42 +0000
parents 7f7e3bfb1af7
children e23d0caa9682
files plugins/jabber/jabber.c
diffstat 1 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/jabber/jabber.c	Tue Dec 19 14:31:15 2000 +0000
+++ b/plugins/jabber/jabber.c	Tue Dec 19 14:48:42 2000 +0000
@@ -413,6 +413,7 @@
 static void jabber_handlemessage(gjconn j, jpacket p)
 {
   xmlnode y;
+  char *x, *m;
 
   char *from = NULL, *msg = NULL;
 
@@ -425,6 +426,17 @@
     return;
   }
 
+  x = strchr(from, '@');
+  if (x) {
+	  *x++ = '\0';
+	  m = strchr(x, '/');
+	  *m = '\0';
+	  if (strcmp(j->user->server, x)) {
+		  x--;
+		  *x = '@';
+		  *m = '/';
+	  }
+  }
   debug_printf("jabber: msg from %s: %s\n", from, msg);
 
   serv_got_im(GJ_GC(j), from, msg, 0);
@@ -641,12 +653,19 @@
 
 static void jabber_send_im(struct gaim_connection *gc, char *who, char *message, int away) {
         xmlnode x, y;
+	char *realwho;
+	gjconn j = ((struct jabber_data *)gc->proto_data)->jc;
 
         if (!who || !message)
                 return;
 
         x = xmlnode_new_tag("message");
-        xmlnode_put_attrib(x, "to", who);
+	if (!strchr(who, '@'))
+		realwho = g_strdup_printf("%s@%s", who, j->user->server);
+	else
+		realwho = g_strdup(who);
+        xmlnode_put_attrib(x, "to", realwho);
+	g_free(realwho);
 
         xmlnode_put_attrib(x, "type", "chat");