changeset 3559:119b8950a1c8

[gaim-migrate @ 3653] gaim-remote quit Thanks John Silvestri. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Thu, 26 Sep 2002 21:51:34 +0000
parents ea617b23ddac
children b26ff17b506b
files src/gaim-remote.c
diffstat 1 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/gaim-remote.c	Thu Sep 26 21:46:53 2002 +0000
+++ b/src/gaim-remote.c	Thu Sep 26 21:51:34 2002 +0000
@@ -35,7 +35,8 @@
 	     "       convo                    Open a new conversation window\n"
 	     "       send                     Send message\n"
 	     "       add                      Add buddy to buddy list\n"
-	     "       remove                   Remove buddy from list\n\n"
+	     "       remove                   Remove buddy from list\n"
+	     "       quit                     Close running copy of Gaim\n\n"
 		 
 	     "    OPTIONS:\n"
 	     "       -m, --message=MESG       Message to send or show in conversation window\n"
@@ -135,9 +136,24 @@
 	return 0;
 }
 
+int command_quit() {
+	int fd = 0;
+	struct gaim_cui_packet *p = NULL;
+	fd = gaim_connect_to_session(0);
+	if (!fd) {
+		fprintf(stderr, "Gaim not running (on session 0)\n");
+		return 1;
+	}
+	p = cui_packet_new(CUI_TYPE_META, CUI_META_QUIT);
+	cui_send_packet (fd, p);
+	close(fd);
+	cui_packet_free(p);
+	return 0;
+}
+
 int command_info(){}
 
-int main (int argc, char *argv[]) 
+int main (int argc, char *argv[])
 {
 
 	if (get_options(argc, argv)) {
@@ -150,6 +166,8 @@
 		return command_uri();
 	} else if (!strcmp(opts.command, "info")) {
 		return command_info();
+	} else if (!strcmp(opts.command, "quit")) {
+		return command_quit();
 	} else {
 		show_remote_usage(argv[0]);
 		return 1;