changed spamserv,chanserv and watchdog messages to privmsgs
[srvx.git] / src / chanserv.c
index 3ddfaf6874822d50451a596628451b53c73dcef1..44f6d9d5f1488f88c0b24d06260e0fce960e1eb9 100644 (file)
@@ -156,6 +156,7 @@ static const struct message_entry msgtab[] = {
     { "CSMSG_MUST_BE_OPPED", "You must be a channel operator in $b%s$b to register it." },
     { "CSMSG_PROXY_FORBIDDEN", "You may not register a channel for someone else." },
     { "CSMSG_OWN_TOO_MANY", "%s already owns enough channels (at least %d); use FORCE to override." },
+    { "CMSG_ALERT_REGISTERED" "%s registered to %s by %s." },
 
 /* Do-not-register channels */
     { "CSMSG_NOT_DNR", "$b%s$b is not a valid channel name or *account." },
@@ -178,6 +179,7 @@ static const struct message_entry msgtab[] = {
     { "CSMSG_UNREG_NODELETE", "$b%s$b is protected from unregistration." },
     { "CSMSG_CHAN_SUSPENDED", "$b$C$b access to $b%s$b has been temporarily suspended (%s)." },
     { "CSMSG_CONFIRM_UNREG", "To confirm this unregistration, you must use 'unregister %s'." },
+    { "CMSG_ALERT_UNREGISTERED" "%s %s" },
 
 /* Channel moving */
     { "CSMSG_MOVE_SUCCESS", "Channel registration has been moved to $b%s$b." },
@@ -548,6 +550,9 @@ static const struct message_entry msgtab[] = {
 DECLARE_LIST(dnrList, struct do_not_register *);
 DEFINE_LIST(dnrList, struct do_not_register *)
 
+#define chanserv_notice(target, format...) send_message(target , chanserv , ## format)
+#define chanserv_oper_message(format...) do { if(chanserv_conf.oper_channel) send_channel_message(chanserv_conf.oper_channel , chanserv , ## format); } while(0)
+
 static int eject_user(struct userNode *user, struct chanNode *channel, unsigned int argc, char *argv[], struct svccmd *cmd, int action);
 
 struct userNode *chanserv;
@@ -601,6 +606,8 @@ static struct
     const char          *new_channel_authed;
     const char          *new_channel_unauthed;
     const char          *new_channel_msg;
+
+    struct chanNode    *oper_channel;
 } chanserv_conf;
 
 struct listData
@@ -1517,10 +1524,9 @@ unregister_channel(struct chanData *channel, const char *reason)
     channel->channel->channel_info = NULL;
 
     dict_delete(channel->notes);
-    sprintf(msgbuf, "%s %s", channel->channel->name, reason);
     if(!IsSuspended(channel))
         DelChannelUser(chanserv, channel->channel, msgbuf, 0);
-    global_message(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, msgbuf);
+    chanserv_oper_message(CSMSGL_CHANNEL_UNREGISTERED, channel->channel->name, reason);
     UnlockChannel(channel->channel);
     free(channel);
     registered_channels--;
@@ -2271,8 +2277,7 @@ static CHANSERV_FUNC(cmd_register)
     else
         reply("CSMSG_REG_SUCCESS", channel->name);
 
-    sprintf(reason, "%s registered to %s by %s.", channel->name, handle->handle, user->handle_info->handle);
-    global_message(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, reason);
+    chanserv_oper_message(CSMSG_ALERT_REGISTERED, channel->name, handle->handle, user->handle_info->handle);
     return 1;
 }
 
@@ -7980,6 +7985,16 @@ chanserv_conf_read(void)
     chanserv_conf.old_ban_names = strlist;
     str = database_get_data(conf_node, "off_channel", RECDB_QSTRING);
     off_channel = str ? atoi(str) : 0;
+
+    str = database_get_data(conf_node, "oper_chan", RECDB_QSTRING);
+       if(str)
+       {
+               chanserv_conf.oper_channel = AddChannel(str, now, "+tinms", NULL);
+       }
+       else
+       {
+               chanserv_conf.oper_channel = NULL;
+       }
 }
 
 static void