10 struct CtdlServerHandle CtdlAppHandle;
11 struct CtdlServInfo CtdlAppServInfo;
14 void logoff(exitcode) {
19 * Programs linked against the Citadel server extension library need to
20 * be called with the following arguments:
21 * 0 - program name (as always)
22 * 1 - server address (usually 127.0.0.1)
23 * 2 - server port number
24 * 3 - internal program secret
28 * 7 - associated client session
38 /* We're really not interested in stdio */
43 /* Bail out if someone tries to run this thing manually */
44 if (argc < 3) exit(1);
46 /* Zeroing out the server handle neatly sets the values of
47 * CtdlAppHandle to sane default values
49 bzero(&CtdlAppHandle, sizeof(struct CtdlServerHandle));
51 /* Now parse the command-line arguments fed to us by the server */
52 for (a=0; a<argc; ++a) switch(a) {
53 case 1: strcpy(CtdlAppHandle.ServerAddress, argv[a]);
55 case 2: CtdlAppHandle.ServerPort = atoi(argv[a]);
57 case 3: strcpy(CtdlAppHandle.ipgmSecret, argv[a]);
59 case 4: strcpy(CtdlAppHandle.UserName, argv[a]);
61 case 5: strcpy(CtdlAppHandle.Password, argv[a]);
63 case 6: strcpy(CtdlAppHandle.InitialRoom, argv[a]);
65 case 7: CtdlAppHandle.AssocClientSession = atoi(argv[a]);
69 /* Connect to the server */
71 attach_to_server(argc, argv);
73 if (buf[0] != '2') exit(1);
75 /* Set up the server environment to our liking */
77 CtdlInternalGetServInfo(&CtdlAppServInfo, 0);
79 sprintf(buf, "IDEN 0|5|006|CitadelAPI Client");
83 if (strlen(CtdlAppHandle.ipgmSecret) > 0) {
84 sprintf(buf, "IPGM %s", CtdlAppHandle.ipgmSecret);
89 if (strlen(CtdlAppHandle.UserName) > 0) {
90 sprintf(buf, "USER %s", CtdlAppHandle.UserName);
93 sprintf(buf, "PASS %s", CtdlAppHandle.Password);
98 sprintf(buf, "GOTO %s", CtdlAppHandle.InitialRoom);
102 serv_puts("GOTO _BASEROOM_");
106 /* Now do the loop. */
109 /* Clean up gracefully and exit. */