-/*
- * Main source module for the client program.
- *
- * Copyright (c) 1987-2018 by the citadel.org team
- *
- * This program is open source software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+// Main source module for the client program.
+//
+// Copyright (c) 1987-2019 by the citadel.org team
+//
+// This program is open source software. Use, duplication, and/or
+// disclosure are subject to the GNU General Purpose License version 3.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
#include "textclient.h"
}
-void userlist(CtdlIPC * ipc, char *patn)
-{
+void userlist(CtdlIPC * ipc, char *patn) {
char buf[SIZ];
char fl[SIZ];
struct tm tmbuf;
time_t lc;
- int r; /* IPC response code */
+ int r; // IPC response code
char *listing = NULL;
r = CtdlIPCUserListing(ipc, patn, &listing, buf);
/*
* grab assorted info about the user...
*/
-void load_user_info(char *params)
-{
+void load_user_info(char *params) {
extract_token(fullname, params, 0, '|', sizeof fullname);
axlevel = extract_int(params, 1);
timescalled = extract_int(params, 2);
* 'roomname' is set to _FLOOR_, in which case all rooms on the requested
* floor will be removed from the march list.
*/
-void remove_march(char *roomname, int floornum)
-{
+void remove_march(char *roomname, int floornum) {
struct march *mptr, *mptr2;
if (marchptr == NULL)
mptr2->next = mptr->next;
free(mptr);
mptr = mptr2;
- } else {
+ }
+ else {
mptr2 = mptr;
}
}
from_floor = curr_floor;
curr_floor = room->RRfloor;
- /* Determine, based on the room's default view, whether an <E>nter message
- * command will be valid here.
- */
+ // Determine, based on the room's default view, whether an <E>nter message command will be valid here.
switch (room->RRdefaultview) {
- case VIEW_BBS:
- case VIEW_MAILBOX:
- case VIEW_BLOG:
- entmsg_ok = 1;
- break;
- default:
- entmsg_ok = 0;
- break;
+ case VIEW_BBS:
+ case VIEW_MAILBOX:
+ entmsg_ok = ENTMSG_OK_YES;
+ break;
+ case VIEW_BLOG:
+ entmsg_ok = ENTMSG_OK_BLOG;
+ break;
+ default:
+ entmsg_ok = ENTMSG_OK_NO;
+ break;
}
remove_march(room_name, 0);
color(BRIGHT_RED);
if (newmailcount == 1) {
scr_printf("*** A new mail message has arrived.\n");
- } else {
+ }
+ else {
scr_printf("*** %d new mail messages have arrived.\n", newmailcount);
}
color(DIM_WHITE);
ipc->ServInfo.humannode, ipc->ServInfo.site_location, room_name, newmailcount);
}
+
/* Goto next room having unread messages.
* We want to skip over rooms that the user has already been to, and take the
* user back to the lobby when done. The room we end up in is placed in
* newroom - which is set to 0 (the lobby) initially.
*/
-void gotonext(CtdlIPC * ipc)
-{
+void gotonext(CtdlIPC * ipc) {
char buf[SIZ];
struct march *mptr, *mptr2;
char next_room[ROOMNAMELEN];
if (marchptr == NULL) {
CtdlIPCKnownRooms(ipc, SubscribedRoomsWithNewMessages, AllFloors, &marchptr, buf);
-/* add _BASEROOM_ to the end of the march list, so the user will end up
- * in the system base room (usually the Lobby>) at the end of the loop
- */
+ // Add _BASEROOM_ to the end of the march list, so the user will end up
+ // in the system base room (usually the Lobby>) at the end of the loop.
mptr = (struct march *) malloc(sizeof(struct march));
mptr->next = NULL;
mptr->march_order = 0;
mptr2 = mptr2->next;
mptr2->next = mptr;
}
-/*
- * ...and remove the room we're currently in, so a <G>oto doesn't make us
- * walk around in circles
- */
+
+ // ...and remove the room we're currently in, so a <G>oto doesn't make us walk around in circles
remove_march(room_name, 0);
}
if (marchptr != NULL) {
strcpy(next_room, pop_march(curr_floor, marchptr));
- } else {
+ }
+ else {
strcpy(next_room, "_BASEROOM_");
}
remove_march(next_room, 0);
dotgoto(ipc, next_room, 1, 0);
}
+
/*
* forget all rooms on a given floor
*/
-void forget_all_rooms_on(CtdlIPC * ipc, int ffloor)
-{
+void forget_all_rooms_on(CtdlIPC *ipc, int ffloor) {
char buf[SIZ];
struct march *flist = NULL;
struct march *fptr = NULL;
}
}
+
/*
* Indexing mechanism for a room list, called by gotoroomstep()
*/
/* If we're at the first room, wrap to the last room */
if (rmslot == 0) {
rmslot = rmtotal - 1;
- } else {
+ }
+ else {
rmslot--;
}
- } else { /* Next room */
+ }
+ else { /* Next room */
/* If we're at the last room, wrap to the first room */
if (rmslot == rmtotal - 1) {
rmslot = 0;
- } else {
+ }
+ else {
rmslot++;
}
}
/*
* step through floors on system
*/
-void gotofloorstep(CtdlIPC * ipc, int direction, int mode)
-{
+void gotofloorstep(CtdlIPC * ipc, int direction, int mode) {
int tofloor;
if (floorlist[0][0] == 0)
}
}
+
/*
* Display user 'preferences'.
*/
free(user);
}
+
/*
* Display system statistics.
*/
scr_printf("Your system administrator is %s.\n", ipc->ServInfo.sysadm);
}
+
/*
* forget all rooms on current floor
*/
}
-
/*
* get info about the server we've connected to
*/
}
-
/*
* Session username compare function for SortOnlineUsers()
*/
}
-
/*
* Display list of users currently logged on to the server
*/
}
scr_printf("\n");
- } else {
+ }
+ else {
if (isidle == 0) {
if (extract_int(buf, 0) == last_session) {
scr_printf(" ");
- } else {
+ }
+ else {
color(BRIGHT_MAGENTA);
scr_printf("%-3s", flags);
}
if (idlehours > 23999) {
scr_printf("fish");
/* over 10 days */
- } else if (idlehours > 239) {
+ }
+ else if (idlehours > 239) {
scr_printf("%3ldd", idlehours / 24);
/* over 10 hours */
- } else if (idlehours > 9) {
+ }
+ else if (idlehours > 9) {
scr_printf("%1ldd%02ld", idlehours / 24, idlehours % 24);
/* less than 10 hours */
- } else {
+ }
+ else {
scr_printf("%1ld:%02ld", idlehours, idlemins);
}
- } else {
+ }
+ else {
scr_printf(" ");
}
scr_printf(" ");
free(listing);
}
+
void enternew(CtdlIPC * ipc, char *desc, char *buf, int maxlen)
{
char bbb[128];
}
-
-int shift(int argc, char **argv, int start, int count)
-{
+int shift(int argc, char **argv, int start, int count) {
int i;
for (i = start; i < (argc - count); ++i) {
return argc;
}
-static void statusHook(char *s)
-{
+
+static void statusHook(char *s) {
scr_printf(s);
}
+
/*
* main
*/
-int main(int argc, char **argv)
-{
+int main(int argc, char **argv) {
int a, b, mcmd;
char aaa[100], bbb[100]; /* general purpose variables */
char argbuf[64]; /* command line buf */
arg_encrypt = RC_DEFAULT;
#endif
- /*
- * Handle command line options as if we were called like /bin/login
- * (i.e. from in.telnetd)
- */
+ // Handle command line options as if we were called like /bin/login (i.e. from in.telnetd)
for (a = 0; a < argc; ++a) {
if ((argc > a + 1) && (!strcmp(argv[a], "-h"))) {
telnet_client_host = argv[a + 1];
*/
check_screen_dims();
-
-#ifdef __CYGWIN__
- newprompt("Connect to (return for local server): ", hostbuf, 64);
-#endif
-
scr_printf("Attaching to server...\n");
ipc = CtdlIPC_new(argc, argv, hostbuf, portbuf);
if (!ipc) {
case 73:
cli_image_upload(ipc, "_roompic_");
break;
- case 75:
- enternew(ipc, "roomname", aaa, 20);
- r = CtdlIPCChangeRoomname(ipc, aaa, bbb);
- if (r / 100 != 2)
- scr_printf("\n%s\n", bbb);
- break;
- case 76:
- enternew(ipc, "hostname", aaa, 25);
- r = CtdlIPCChangeHostname(ipc, aaa, bbb);
- if (r / 100 != 2)
- scr_printf("\n%s\n", bbb);
- break;
- case 77:
- enternew(ipc, "username", aaa, 32);
- r = CtdlIPCChangeUsername(ipc, aaa, bbb);
- if (r / 100 != 2)
- scr_printf("\n%s\n", bbb);
- break;
-
case 35:
set_password(ipc);
break;
dotknown(ipc, 5, NULL);
break;
- case 126: /* .KShared */
- dotknown(ipc, 6, NULL);
- break;
-
case 127: /* Configure POP3 aggregation */
do_pop3client_configuration(ipc);
break;