X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fwho.c;h=4fb70a56c144a656fa4bca9608c20f68de4b0cf2;hb=c90b9009ad3b2411389d3dad969c19ec17688268;hp=c4a654650616092ca6cba6f6b403f8d349358bb3;hpb=05b7980adba4f517c3fc30d3ce97adb5c337c750;p=citadel.git
diff --git a/webcit/who.c b/webcit/who.c
index c4a654650..4fb70a56c 100644
--- a/webcit/who.c
+++ b/webcit/who.c
@@ -19,24 +19,25 @@ struct whouser {
char roomname[256];
char hostname[256];
char clientsoftware[256];
- };
-
+};
+
/*
* who is on?
*/
-void whobbs(void) {
+void whobbs(void)
+{
struct whouser *wlist = NULL;
struct whouser *wptr = NULL;
- char buf[256],sess,user[256],room[256],host[256];
+ char buf[256], sess, user[256], room[256], host[256];
int foundit;
- printf("HTTP/1.0 200 OK\n");
- output_headers(1, "bottom");
+ printf("HTTP/1.0 200 OK\n");
+ output_headers(1, "bottom");
- wprintf("
");
- wprintf("Users currently on ");
+ wprintf("");
+ wprintf("Users currently on ");
escputs(serv_info.serv_humannode);
- wprintf(" | \n");
+ wprintf(" |
\n");
wprintf("\n\n\n");
wprintf("Session ID | \n");
@@ -45,58 +46,58 @@ void whobbs(void) {
wprintf("From host | \n
\n");
serv_puts("RWHO");
serv_gets(buf);
- if (buf[0]=='1') {
- while(serv_gets(buf), strcmp(buf,"000")) {
+ if (buf[0] == '1') {
+ while (serv_gets(buf), strcmp(buf, "000")) {
sess = extract_int(buf, 0);
extract(user, buf, 1);
extract(room, buf, 2);
extract(host, buf, 3);
foundit = 0;
- for (wptr = wlist; wptr != NULL; wptr = wptr -> next) {
+ for (wptr = wlist; wptr != NULL; wptr = wptr->next) {
if (wptr->sessionnum == sess) {
foundit = 1;
if (strcasecmp(user, wptr->username)) {
- sprintf(buf, "%cBR%c%s",
+ sprintf(buf, "%cBR%c%s",
LB, RB, user);
strcat(wptr->username, buf);
- }
+ }
if (strcasecmp(room, wptr->roomname)) {
- sprintf(buf, "%cBR%c%s",
+ sprintf(buf, "%cBR%c%s",
LB, RB, room);
strcat(wptr->roomname, buf);
- }
+ }
if (strcasecmp(host, wptr->hostname)) {
- sprintf(buf, "%cBR%c%s",
+ sprintf(buf, "%cBR%c%s",
LB, RB, host);
strcat(wptr->hostname, buf);
- }
}
}
+ }
if (foundit == 0) {
wptr = (struct whouser *)
- malloc(sizeof(struct whouser));
+ malloc(sizeof(struct whouser));
wptr->next = wlist;
wlist = wptr;
strcpy(wlist->username, user);
strcpy(wlist->roomname, room);
strcpy(wlist->hostname, host);
wlist->sessionnum = sess;
- }
}
+ }
while (wlist != NULL) {
wprintf("\n\t%d", wlist->sessionnum);
- if ( (is_aide) &&
- (wlist->sessionnum != serv_info.serv_pid) ) {
+ if ((is_aide) &&
+ (wlist->sessionnum != serv_info.serv_pid)) {
wprintf(" sessionnum);
urlescputs(wlist->username);
wprintf("\">(kill)");
- }
+ }
if (wlist->sessionnum == serv_info.serv_pid) {
wprintf(" (edit)");
- }
+ }
/* username */
wprintf(" | \n\tusername);
@@ -108,10 +109,9 @@ void whobbs(void) {
/* room */
wprintf(" | \n\t");
/* handle chat */
- if(strstr(wlist->roomname,"chat") != NULL){
+ if (strstr(wlist->roomname, "chat") != NULL) {
wprintf("<chat>");
- }
- else {
+ } else {
wprintf("roomname);
wprintf("\" onMouseOver=\"window.status='Go to room ");
@@ -119,7 +119,7 @@ void whobbs(void) {
wprintf("'; return true\">");
escputs(wlist->roomname);
wprintf("");
- }
+ }
wprintf(" | ");
/* hostname */
escputs(wlist->hostname);
@@ -127,61 +127,60 @@ void whobbs(void) {
wptr = wlist->next;
free(wlist);
wlist = wptr;
- }
}
+ }
wprintf(" |
\n
\n");
wprintf("\n\n");
wprintf("Refresh\n");
wprintf(" |
\n
\n");
- wDumpContent(1);
- }
+ wDumpContent(1);
+}
-void terminate_session(void) {
+void terminate_session(void)
+{
char buf[256];
if (!strcasecmp(bstr("confirm"), "Yes")) {
serv_printf("TERM %s", bstr("which_session"));
serv_gets(buf);
- if (buf[0]=='2') {
+ if (buf[0] == '2') {
whobbs();
- }
- else {
+ } else {
display_error(&buf[4]);
- }
}
-
- else {
+ } else {
printf("HTTP/1.0 200 OK\n");
output_headers(1, "bottom");
- wprintf("");
- wprintf("Confirm session termination");
- wprintf(" |
\n");
-
+ wprintf("");
+ wprintf("Confirm session termination");
+ wprintf(" |
\n");
+
wprintf("Are you sure you want to terminate session %s",
bstr("which_session"));
- if (strlen(bstr("session_owner"))>0) {
+ if (strlen(bstr("session_owner")) > 0) {
wprintf(" (");
escputs(bstr("session_owner"));
wprintf(")");
- }
+ }
wprintf("?
\n");
-
+
wprintf("",
bstr("which_session"));
wprintf("Yes ");
wprintf("No");
wDumpContent(1);
- }
-
}
+}
+
/*
* Change your session info (fake roomname and hostname)
*/
-void edit_me(void) {
+void edit_me(void)
+{
char buf[256];
printf("HTTP/1.0 200 OK\n");
@@ -191,26 +190,22 @@ void edit_me(void) {
serv_printf("RCHG %s", bstr("fake_roomname"));
serv_gets(buf);
whobbs();
- }
- else if (!strcasecmp(bstr("sc"), "Change host name")) {
+ } else if (!strcasecmp(bstr("sc"), "Change host name")) {
serv_printf("HCHG %s", bstr("fake_hostname"));
serv_gets(buf);
whobbs();
- }
- else if (!strcasecmp(bstr("sc"), "Change user name")) {
+ } else if (!strcasecmp(bstr("sc"), "Change user name")) {
serv_printf("UCHG %s", bstr("fake_username"));
serv_gets(buf);
whobbs();
- }
- else if (!strcasecmp(bstr("sc"), "Cancel")) {
+ } else if (!strcasecmp(bstr("sc"), "Cancel")) {
whobbs();
- }
- else {
+ } else {
- wprintf("");
- wprintf("");
+ wprintf("");
+ wprintf("");
wprintf("Edit your session display");
- wprintf(" | \n");
+ wprintf(" |
\n");
wprintf("");
wprintf("This screen allows you to change the way your\n");
wprintf("session appears in the 'Who is online' listing.\n");
@@ -219,36 +214,34 @@ void edit_me(void) {
wprintf("without typing anything in the corresponding box.\n");
wprintf("
\n\n");
- wprintf("\n");
+ wprintf("\n");
wDumpContent(1);
- }
}
-
+}