comparison 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
comparison
equal deleted inserted replaced
4156:d833bacc054f 4157:9c31ddae80a1
121 #endif 121 #endif
122 122
123 #ifdef USE_PERL 123 #ifdef USE_PERL
124 /* yup, perl too */ 124 /* yup, perl too */
125 perl_end(); 125 perl_end();
126 #endif
127
128 #ifdef USE_SM
129 /* unplug */
130 session_end();
126 #endif 131 #endif
127 132
128 /* and end it all... */ 133 /* and end it all... */
129 gtk_main_quit(); 134 gtk_main_quit();
130 } 135 }
550 int main(int argc, char *argv[]) 555 int main(int argc, char *argv[])
551 #endif 556 #endif
552 { 557 {
553 int opt_acct = 0, opt_help = 0, opt_version = 0, opt_login = 0, opt_nologin = 0, dologin_ret = -1; 558 int opt_acct = 0, opt_help = 0, opt_version = 0, opt_login = 0, opt_nologin = 0, dologin_ret = -1;
554 char *opt_user_arg = NULL, *opt_login_arg = NULL; 559 char *opt_user_arg = NULL, *opt_login_arg = NULL;
560 char *opt_session_arg = NULL;
555 #if HAVE_SIGNAL_H 561 #if HAVE_SIGNAL_H
556 int sig_indx; /* for setting up signal catching */ 562 int sig_indx; /* for setting up signal catching */
557 sigset_t sigset; 563 sigset_t sigset;
558 void (*prev_sig_disp)(); 564 void (*prev_sig_disp)();
559 #endif 565 #endif
568 {"loginwin", no_argument, NULL, 'n'}, 574 {"loginwin", no_argument, NULL, 'n'},
569 {"user", required_argument, NULL, 'u'}, 575 {"user", required_argument, NULL, 'u'},
570 {"file", required_argument, NULL, 'f'}, 576 {"file", required_argument, NULL, 'f'},
571 {"debug", no_argument, NULL, 'd'}, 577 {"debug", no_argument, NULL, 'd'},
572 {"version", no_argument, NULL, 'v'}, 578 {"version", no_argument, NULL, 'v'},
579 {"session", required_argument, NULL, 's'},
573 {0, 0, 0, 0} 580 {0, 0, 0, 0}
574 }; 581 };
575 582
576 #ifdef DEBUG 583 #ifdef DEBUG
577 opt_debug = 1; 584 opt_debug = 1;
701 708
702 /* scan command-line options */ 709 /* scan command-line options */
703 opterr = 1; 710 opterr = 1;
704 while ((opt = getopt_long(argc, argv, 711 while ((opt = getopt_long(argc, argv,
705 #ifndef _WIN32 712 #ifndef _WIN32
706 "adhu:f:vn", 713 "adhu:f:vns:",
707 #else 714 #else
708 "adghu:f:vn", 715 "adghu:f:vn",
709 #endif 716 #endif
710 long_options, NULL)) != -1) { 717 long_options, NULL)) != -1) {
711 switch (opt) { 718 switch (opt) {
719 case 'd': /* debug */ 726 case 'd': /* debug */
720 opt_debug = 1; 727 opt_debug = 1;
721 break; 728 break;
722 case 'f': 729 case 'f':
723 opt_rcfile_arg = g_strdup(optarg); 730 opt_rcfile_arg = g_strdup(optarg);
731 break;
732 case 's': /* use existing session ID */
733 opt_session_arg = g_strdup(optarg);
724 break; 734 break;
725 case 'v': /* version */ 735 case 'v': /* version */
726 opt_version = 1; 736 opt_version = 1;
727 break; 737 break;
728 case 'h': /* help */ 738 case 'h': /* help */
804 core_main(); 814 core_main();
805 #ifndef _WIN32 815 #ifndef _WIN32
806 ui_main(); 816 ui_main();
807 #endif 817 #endif
808 818
819 #ifdef USE_SM
820 session_init(argv[0], opt_session_arg);
821 #endif
822 if (opt_session_arg != NULL) {
823 g_free(opt_session_arg);
824 opt_session_arg = NULL;
825 };
826
809 /* set the default username */ 827 /* set the default username */
810 if (opt_user_arg != NULL) { 828 if (opt_user_arg != NULL) {
811 set_first_user(opt_user_arg); 829 set_first_user(opt_user_arg);
812 g_free(opt_user_arg); 830 g_free(opt_user_arg);
813 opt_user_arg = NULL; 831 opt_user_arg = NULL;