diff src/aim.c @ 4157:9c31ddae80a1

[gaim-migrate @ 4385] I'm commiting this so Robot101 will leave me alone. Here's some session management stuff. Happy Gnome People. committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Tue, 31 Dec 2002 05:22:56 +0000
parents 4b04ecb3eb97
children d3c8d2b40494
line wrap: on
line diff
--- a/src/aim.c	Tue Dec 31 02:53:41 2002 +0000
+++ b/src/aim.c	Tue Dec 31 05:22:56 2002 +0000
@@ -125,6 +125,11 @@
 	perl_end();
 #endif
 
+#ifdef USE_SM
+	/* unplug */
+	session_end();
+#endif
+
 	/* and end it all... */
 	gtk_main_quit();
 }
@@ -552,6 +557,7 @@
 {
 	int opt_acct = 0, opt_help = 0, opt_version = 0, opt_login = 0, opt_nologin = 0, dologin_ret = -1;
 	char *opt_user_arg = NULL, *opt_login_arg = NULL;
+	char *opt_session_arg = NULL;
 #if HAVE_SIGNAL_H
 	int sig_indx;	/* for setting up signal catching */
 	sigset_t sigset;
@@ -570,6 +576,7 @@
 		{"file", required_argument, NULL, 'f'},
 		{"debug", no_argument, NULL, 'd'},
 		{"version", no_argument, NULL, 'v'},
+		{"session", required_argument, NULL, 's'},
 		{0, 0, 0, 0}
 	};
 
@@ -703,7 +710,7 @@
 	opterr = 1;
 	while ((opt = getopt_long(argc, argv,
 #ifndef _WIN32
-				  "adhu:f:vn", 
+				  "adhu:f:vns:", 
 #else
 				  "adghu:f:vn", 
 #endif
@@ -722,6 +729,9 @@
 		case 'f':
 			opt_rcfile_arg = g_strdup(optarg);
 			break;
+		case 's':	/* use existing session ID */
+			opt_session_arg = g_strdup(optarg);
+			break;
 		case 'v':	/* version */
 			opt_version = 1;
 			break;
@@ -806,6 +816,14 @@
 	ui_main();
 #endif
 
+#ifdef USE_SM
+	session_init(argv[0], opt_session_arg);
+#endif
+	if (opt_session_arg != NULL) {
+		g_free(opt_session_arg);
+		opt_session_arg = NULL;
+	};
+
 	/* set the default username */
 	if (opt_user_arg != NULL) {
 		set_first_user(opt_user_arg);