}
-char express_msgs = 0;
+char instant_msgs = 0;
static void serv_read(CtdlIPC *ipc, char *buf, unsigned int bytes);
static unsigned long id_callback(void);
#endif /* THREADED_CLIENT */
#endif /* HAVE_OPENSSL */
+static void CtdlIPC_getline(CtdlIPC* ipc, char *buf);
+static void CtdlIPC_putline(CtdlIPC *ipc, const char *buf);
/*
*/
int CtdlIPCQuit(CtdlIPC *ipc)
{
- register int ret;
+ register int ret = 221; /* Default to successful quit */
char aaa[128];
CtdlIPC_lock(ipc);
- CtdlIPC_putline(ipc, "QUIT");
- CtdlIPC_getline(ipc, aaa);
- ret = atoi(aaa);
+ if (ipc->sock > -1) {
+ CtdlIPC_putline(ipc, "QUIT");
+ CtdlIPC_getline(ipc, aaa);
+ ret = atoi(aaa);
+ }
+#ifdef HAVE_OPENSSL
+ if (ipc->ssl)
+ SSL_shutdown(ipc->ssl);
+ ipc->ssl = NULL;
+#endif
+ if (ipc->sock)
+ shutdown(ipc->sock, 2); /* Close connection; we're dead */
+ ipc->sock = -1;
CtdlIPC_unlock(ipc);
return ret;
}
if (!qret) return -2;
aaa = (char *)malloc(strlen(qret->QRname) + strlen(qret->QRpasswd) +
- strlen(qret->QRdirname) + 52);
+ strlen(qret->QRdirname) + 64);
if (!aaa) return -1;
- sprintf(aaa, "SETR %s|%s|%s|%d|%d|%d|%d",
+ sprintf(aaa, "SETR %s|%s|%s|%d|%d|%d|%d|%d|%d",
qret->QRname, qret->QRpasswd, qret->QRdirname,
- qret->QRflags, forget, qret->QRfloor, qret->QRorder);
+ qret->QRflags, forget, qret->QRfloor, qret->QRorder,
+ qret->QRdefaultview, qret->QRflags2);
ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
free(aaa);
return ret;
developerid = 8;
clientid = 0;
revision = REV_LEVEL - 600;
- software_name = "Citadel/UX (libcitadel)";
+ software_name = "Citadel (libcitadel)";
}
if (!hostname) return -2;
}
+/* GNET */
+int CtdlIPCGetRoomNetworkConfig(CtdlIPC *ipc, char **listing, char *cret)
+{
+ size_t bytes;
+
+ if (!cret) return -2;
+ if (!listing) return -2;
+ if (*listing) return -2;
+
+ return CtdlIPCGenericCommand(ipc, "GNET", NULL, 0,
+ listing, &bytes, cret);
+}
+
+
+/* SNET */
+int CtdlIPCSetRoomNetworkConfig(CtdlIPC *ipc, const char *listing, char *cret)
+{
+ if (!cret) return -2;
+ if (!listing) return -2;
+
+ return CtdlIPCGenericCommand(ipc, "SNET", listing, strlen(listing),
+ NULL, NULL, cret);
+}
+
+
/* REQT */
int CtdlIPCRequestClientLogout(CtdlIPC *ipc, int session, char *cret)
{
}
/* Pointless flag waving */
#if SSLEAY_VERSION_NUMBER >= 0x0922
- SSL_set_session_id_context(temp_ssl, "Citadel/UX SID", 14);
+ SSL_set_session_id_context(temp_ssl, "Citadel SID", 14);
#endif
if (!access("/var/run/egd-pool", F_OK))
while (1) {
CtdlIPC_getline(ipc, proto_response);
if (proto_response[3] == '*')
- express_msgs = 1;
+ instant_msgs = 1;
ret = atoi(proto_response);
strcpy(proto_response, &proto_response[4]);
switch (ret / 100) {
/*
* input string from socket - implemented in terms of serv_read()
*/
-void CtdlIPC_getline(CtdlIPC* ipc, char *buf)
+static void CtdlIPC_getline(CtdlIPC* ipc, char *buf)
{
int i;
if (buf[i] == 13) buf[i--] = 0;
}
+void CtdlIPC_chat_recv(CtdlIPC* ipc, char* buf)
+{
+ return CtdlIPC_getline(ipc, buf);
+}
/*
* send line to server - implemented in terms of serv_write()
*/
-void CtdlIPC_putline(CtdlIPC *ipc, const char *buf)
+static void CtdlIPC_putline(CtdlIPC *ipc, const char *buf)
{
/* error_printf("< %s\n", buf); */
serv_write(ipc, buf, strlen(buf));
ipc->last_command_sent = time(NULL);
}
+void CtdlIPC_chat_send(CtdlIPC* ipc, const char* buf)
+{
+ return CtdlIPC_putline(ipc, buf);
+}
+
/*
* attach to server
char cithost[SIZ];
char citport[SIZ];
char sockpath[SIZ];
+ CtdlIPC* ipc;
- CtdlIPC *ipc = ialloc(CtdlIPC);
+ ipc = ialloc(CtdlIPC);
if (!ipc) {
return 0;
}
return ipc;
}
+
+/*
+ * Disconnect and delete the IPC class (destructor)
+ */
+void CtdlIPC_delete(CtdlIPC* ipc)
+{
+#ifdef HAVE_OPENSSL
+ if (ipc->ssl) {
+ SSL_shutdown(ipc->ssl);
+ SSL_free(ipc->ssl);
+ ipc->ssl = NULL;
+ }
+#endif
+ if (ipc->sock > -1) {
+ shutdown(ipc->sock, 2); /* Close it up */
+ ipc->sock = -1;
+ }
+ ifree(ipc);
+}
+
+
+/*
+ * Disconnect and delete the IPC class (destructor)
+ * Also NULLs out the pointer
+ */
+void CtdlIPC_delete_ptr(CtdlIPC** pipc)
+{
+ CtdlIPC_delete(*pipc);
+ *pipc = NULL;
+}
+
+
/*
* return the file descriptor of the server socket so we can select() on it.
*