changeset 15663:b5c5fbe365d2

merge of '2f881bb7bad3beb5ec8384245c1350050d4b73a1' and 'f8222d7e7629ab348f5b757d931ecfb874f9794d'
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 19 Feb 2007 15:31:32 +0000
parents 94a19bde141d (diff) 80944a182710 (current diff)
children 95c4dee525f0
files libpurple/util.c
diffstat 3 files changed, 58 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/gaim-remote	Mon Feb 19 04:52:43 2007 +0000
+++ b/libpurple/gaim-remote	Mon Feb 19 15:31:32 2007 +0000
@@ -30,6 +30,38 @@
             raise "Error: " + self.attr + " " + str(args) + " returned " + str(result)
         return result
             
+def show_help():
+    print """This program uses DBus to communicate with gaim.
+
+Usage:
+
+    %s "command1" "command2" ...
+
+Each command is of one of the three types:
+
+    [protocol:]commandname?param1=value1&param2=value2&...
+    FunctionName?param1=value1&param2=value2&...
+    FunctionName(value1,value2,...)
+
+The second and third form are provided for completeness but their use
+is not recommended; use gaim-send or gaim-send-async instead.  The
+second form uses introspection to find out the parameter names and
+their types, therefore it is rather slow.
+
+Examples of commands:
+
+    jabber:goim?screenname=testone@localhost&message=hi
+    jabber:gochat?room=TestRoom&server=conference.localhost
+    jabber:getinfo?screenname=testone@localhost
+    jabber:addbuddy?screenname=my friend
+
+    setstatus?status=away&message=don't disturb
+    quit
+
+    GaimAccountsFindConnected?name=&protocol=prpl-jabber
+    GaimAccountFindConnected(,prpl-jabber)
+""" % sys.argv[0]
+
 cgaim = CheckedObject(gaim)
 
 urlregexp = r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?"
@@ -169,40 +201,11 @@
                             else:
                                 raise "Don't know how to handle type \"%s\"" % type
                     return gaim.__getattr__(command)(*methodparams)
+            show_help()
             raise "Unknown command: %s" % command
 
-
 if len(sys.argv) == 1:
-    print """This program uses DBus to communicate with gaim.
-
-Usage:
-
-    %s "command1" "command2" ...
-
-Each command is of one of the three types:
-
-    [protocol:]commandname?param1=value1&param2=value2&...
-    FunctionName?param1=value1&param2=value2&...
-    FunctionName(value1,value2,...)
-
-The second and third form are provided for completeness but their use
-is not recommended; use gaim-send or gaim-send-async instead.  The
-second form uses introspection to find out the parameter names and
-their types, therefore it is rather slow.
-
-Examples of commands:
-
-    jabber:goim?screenname=testone@localhost&message=hi
-    jabber:gochat?room=TestRoom&server=conference.localhost
-    jabber:getinfo?screenname=testone@localhost
-    jabber:addbuddy?screenname=my friend
-
-    setstatus?status=away&message=don't disturb
-    quit
-
-    GaimAccountsFindConnected?name=&protocol=prpl-jabber
-    GaimAccountFindConnected(,prpl-jabber)
-""" % sys.argv[0]
+    show_help()
 
 for arg in sys.argv[1:]:
     output = execute(arg)
--- a/libpurple/protocols/jabber/message.c	Mon Feb 19 04:52:43 2007 +0000
+++ b/libpurple/protocols/jabber/message.c	Mon Feb 19 15:31:32 2007 +0000
@@ -85,13 +85,30 @@
 		} else if(JM_STATE_GONE == jm->chat_state) {
 			GaimConversation *conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM,
 					from, jm->js->gc->account);
-			if (conv) {
-#if 0  /* String freeze */
-				gaim_conversation_write(conv, "",
-						  "So and so has left the conversation.",
-						  GAIM_MESSAGE_INFO, time(NULL));
+			if (conv && jid->node && jid->domain) {
+#if 0  /* String freeze... make sure to mark the message for translation */
+				char buf[256];
+				GaimBuddy *buddy;
+
+				g_snprintf(buf, sizeof(buf), "%s@%s", jid->node, jid->domain);
+
+				if ((buddy = gaim_find_buddy(jm->js->gc->account, buf))) {
+					const char *who;
+					char *escaped;
+
+					who = gaim_buddy_get_alias(buddy);
+					escaped = g_markup_escape_text(who, -1);
+
+					g_snprintf(buf, sizeof(buf),
+					           "%s has left the conversation.", escaped);
+
+					/* At some point when we restructure GaimConversation,
+					 * this should be able to be implemented by removing the
+					 * user from the conversation like we do with chats now. */
+					gaim_conversation_write(conv, "", buf,
+					                        GAIM_MESSAGE_SYSTEM, time(NULL));
+				}
 #endif
-				
 			}
 			serv_got_typing_stopped(jm->js->gc, from);
 			
--- a/libpurple/util.c	Mon Feb 19 04:52:43 2007 +0000
+++ b/libpurple/util.c	Mon Feb 19 15:31:32 2007 +0000
@@ -4133,6 +4133,7 @@
 	signal(SIGEMT,  SIG_DFL);	/* 7:  EMT instruction (Non-POSIX) */
 #endif /* SIGEMT */
 
+#endif
 	signal(SIGFPE,  SIG_DFL);	/* 8:  floating point exception */
 	signal(SIGBUS,  SIG_DFL);	/* 10: bus error */
 	signal(SIGSEGV, SIG_DFL);	/* 11: segmentation violation */