#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "serv_extensions.h"
#include "serv_chat.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
#include "snprintf.h"
#endif
+
+#include "ctdl_module.h"
+
+
+
struct ChatLine *ChatQueue = NULL;
int ChatLastMsg = 0;
if (is_room_aide()) {
cprintf(":|/kick (kick another user out of this room) \n");
}
- cprintf(":|/quit (return to the BBS) \n");
+ cprintf(":|/quit (exit from this chat) \n");
cprintf(":|\n");
ok_cmd = 1;
}
cprintf("Message ");
cprintf("from %s:\n", ptr->sender);
if (ptr->text != NULL)
- memfmout(80, ptr->text, 0, "\n");
+ memfmout(ptr->text, 0, "\n");
holdptr = ptr->next;
if (ptr->text != NULL) free(ptr->text);
cprintf("%d %d|%ld|%d|%s|%s\n",
LISTING_FOLLOWS,
((ptr->next != NULL) ? 1 : 0), /* more msgs? */
- (long)ptr->timestamp, /* time sent */
+ (long)ptr->timestamp, /* time sent */
ptr->flags, /* flags */
ptr->sender, /* sender of msg */
- config.c_nodename); /* static for now */
+ config.c_nodename /* static for now */
+ );
+
if (ptr->text != NULL) {
- memfmout(80, ptr->text, 0, "\n");
+ memfmout(ptr->text, 0, "\n");
if (ptr->text[strlen(ptr->text)-1] != '\n') cprintf("\n");
free(ptr->text);
- }
+ }
+
cprintf("000\n");
free(ptr);
}
int send_instant_message(char *lun, char *x_user, char *x_msg)
{
int message_sent = 0; /* number of successful sends */
-
struct CitContext *ccptr;
struct ExpressMessage *newmsg;
char *un;
*/
struct savelist *sl = NULL; /* list of rooms to save this page */
struct savelist *sptr;
- struct CtdlMessage *logmsg;
+ struct CtdlMessage *logmsg = NULL;
long msgnum;
if (strlen(x_msg) > 0) {
msglen = strlen(x_msg) + 4;
do_send = 1;
- }
+ }
/* find the target user's context and append the message */
begin_critical_section(S_SESSION_TABLE);
for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
- if (ccptr->fake_username[0]) /* <bc> */
+ if (ccptr->fake_username[0]) {
un = ccptr->fake_username;
- else
+ }
+ else {
un = ccptr->user.fullname;
+ }
if ( ((!strcasecmp(un, x_user))
|| (!strcasecmp(x_user, "broadcast")))
/* Now save a copy in the global log room, if configured */
if (strlen(config.c_logpages) > 0) {
create_room(config.c_logpages, 3, "", 0, 1, 1, VIEW_BBS);
- CtdlSaveMsgPointerInRoom(config.c_logpages, msgnum, 0);
+ CtdlSaveMsgPointerInRoom(config.c_logpages, msgnum, 0, NULL);
}
/* Save a copy in each recipient's log room, creating those
*/
while (sl != NULL) {
create_room(sl->roomname, 5, "", 0, 1, 1, VIEW_BBS);
- CtdlSaveMsgPointerInRoom(sl->roomname, msgnum, 0);
+ CtdlSaveMsgPointerInRoom(sl->roomname, msgnum, 0, NULL);
sptr = sl->next;
free(sl);
sl = sptr;
}
/*
- * send instant messages <bc>
+ * send instant messages
*/
void cmd_sexp(char *argbuf)
{
int message_sent = 0;
char x_user[USERNAME_SIZE];
char x_msg[1024];
- char *lun; /* <bc> */
+ char *lun;
char *x_big_msgbuf = NULL;
if ((!(CC->logged_in)) && (!(CC->internal_pgm))) {
-char *serv_chat_init(void)
+CTDL_MODULE_INIT(chat)
{
CtdlRegisterProtoHook(cmd_chat, "CHAT", "Begin real-time chat");
CtdlRegisterProtoHook(cmd_pexp, "PEXP", "Poll for instant messages");
CtdlRegisterSessionHook(cmd_gexp_async, EVT_ASYNC);
CtdlRegisterSessionHook(delete_instant_messages, EVT_STOP);
CtdlRegisterXmsgHook(send_instant_message, XMSG_PRI_LOCAL);
+
+ /* return our Subversion id for the Log */
return "$Id$";
}