]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/proto-p10.c
Changed the wording and format of CSMSG_ADDUSER_PENDING
[irc/evilnet/x3.git] / src / proto-p10.c
index 8909ea84fe8d5ee3f6c56939e64db6cc4ed4321f..0cb26091b7b7ce5a65caff3ffab2faee4652ed7e 100644 (file)
@@ -837,8 +837,8 @@ irc_gline(struct server *srv, struct gline *gline, int silent)
 void
 irc_shun(struct server *srv, struct shun *shun)
 {
-    putsock("%s " P10_SHUN " %s +%s " FMT_TIME_T " :<%s> %s",
-            self->numeric, (srv ? srv->numeric : "*"), shun->target, shun->expires-now, shun->issuer, shun->reason);
+    putsock("%s " P10_SHUN " %s +%s " FMT_TIME_T " " FMT_TIME_T " :<%s> %s",
+            self->numeric, (srv ? srv->numeric : "*"), shun->target, shun->expires-now, now, shun->issuer, shun->reason);
 }
 
 void
@@ -853,13 +853,13 @@ irc_settime(const char *srv_name_mask, time_t new_time)
 void
 irc_ungline(const char *mask)
 {
-    putsock("%s " P10_GLINE " * -%s", self->numeric, mask);
+    putsock("%s " P10_GLINE " * -%s " FMT_TIME_T, self->numeric, mask, now);
 }
 
 void
 irc_unshun(const char *mask)
 {
-    putsock("%s " P10_SHUN " * -%s", self->numeric, mask);
+    putsock("%s " P10_SHUN " * -%s " FMT_TIME_T, self->numeric, mask, now);
 }
 
 void
@@ -909,6 +909,10 @@ irc_burst(struct chanNode *chan)
         if ((n+1)<chan->members.used)
             burst_line[pos++] = ',';
     }
+
+    if (len > 0 && (chan->banlist.used > 0 || chan->exemptlist.used > 0))
+        burst_line[pos++] = ' ';
+
     if (chan->banlist.used) {
         /* dump the bans */
         first_ban = 1;
@@ -934,13 +938,18 @@ irc_burst(struct chanNode *chan)
             }
         }
     }
+
     if (chan->exemptlist.used) {
         /* dump the exempts */
         first_exempt = 1;
 
         for (n=0; n<chan->exemptlist.used; ) {
             if (first_exempt && (pos < 500)) {
-                burst_line[pos++] = ' ';
+                if (chan->banlist.used < 1) {
+                    burst_line[pos++] = ':';
+                    burst_line[pos++] = '%';
+                    burst_line[pos++] = ' ';
+                }
                 burst_line[pos++] = '~';
                 burst_line[pos++] = ' ';
             }
@@ -1131,9 +1140,9 @@ irc_topic(struct userNode *service, struct userNode *who, struct chanNode *what,
               safestrncpy(sident, who->ident, sizeof(shost));
 
           safestrncpy(shost, host, sizeof(shost));
-      } else if (IsHiddenHost(who) && (hhtype == 1) && who->handle_info && hhstr) {
+      } else if (IsHiddenHost(who) && ((hhtype == 1) || (hhtype == 3)) && who->handle_info && hhstr) {
           snprintf(shost, sizeof(shost), "%s.%s", who->handle_info->handle, hhstr);
-      } else if (IsHiddenHost(who) && (hhtype == 2) && who->crypthost[0]) {
+      } else if (IsHiddenHost(who) && ((hhtype == 2) || (hhtype == 3)) && who->crypthost[0]) {
           safestrncpy(shost, who->crypthost, sizeof(shost));
       } else
           safestrncpy(shost, who->hostname, sizeof(shost));
@@ -1172,6 +1181,34 @@ void
 irc_mark(struct userNode *user, char *mark)
 {
     char *host = user->hostname;
+    int type = 4;
+    const char *tstr = NULL;
+    unsigned int ii = 0;
+    int markfound = 0;
+
+    tstr = conf_get_data("server/type", RECDB_QSTRING);
+    if(tstr)
+        type = atoi(tstr);
+    else
+        type = 4;
+
+    if (user->marks)
+        for (ii=0; ii<user->marks->used; ii++)
+            if (!irccasecmp(user->marks->list[ii], mark))
+                markfound = 1;
+
+    if (!markfound)
+    {
+        if (!user->marks)
+            user->marks = alloc_string_list(1);
+        string_list_append(user->marks, strdup(mark));
+    }
+
+    if (type >= 9)
+    {
+        putsock("%s " CMD_MARK " %s MARK %s", self->numeric, user->nick, mark);
+        return;
+    }
 
     /* TODO: Allow mark overwrite. If they are marked, and their fakehost is oldmark.hostname, update it to newmark.hostname so mark can be called multiple times. Probably requires ircd modification also */
     if(user->mark)
@@ -1969,25 +2006,47 @@ static CMD_FUNC(cmd_burst)
  */
 static CMD_FUNC(cmd_mark)
 {
+    const char *tstr;
+    int type = 4;
     struct userNode *target;
     /* 
      * log_module(MAIN_LOG, LOG_ERROR, "DEBUG: mark, user %s, type %s, arg %s", argv[1], argv[2], argv[3]);
      */
 
+    tstr = conf_get_data("server/type", RECDB_QSTRING);
+    if(tstr)
+       type = atoi(tstr);
+    else
+       type = 4;/* default to 040 style topics */
+
     if(argc < 4)
         return 0;
     if(!strcasecmp(argv[2], "DNSBL")) {
         /* DNSBL <modes> */
         return 1;
     }
-    else if(!strcasecmp(argv[2], "DNSBL_DATA")) {
+    else if(!strcasecmp(argv[2], "DNSBL_DATA") || !strcasecmp(argv[2], "MARK")) {
+        int markfound = 0;
+        unsigned int ii = 0;
         /* DNSBL_DATA name */
         target = GetUserH(argv[1]);
         if(!target) {
             log_module(MAIN_LOG, LOG_ERROR, "Unable to find user %s whose dnsbl mark is changing.", argv[1]);
             return 0;
         }
-        target->mark = strdup(argv[3]);
+        if (type >= 9) {
+            if (target->marks)
+                for (ii=0; ii<target->marks->used; ii++)
+                    if (!irccasecmp(target->marks->list[ii], argv[3]))
+                         markfound = 1;
+            if (!markfound)
+            {
+                if (!target->marks)
+                    target->marks = alloc_string_list(1);
+                string_list_append(target->marks, strdup(argv[3]));
+            }
+        } else
+            target->mark = strdup(argv[3]);
         return 1;
         
     }
@@ -3018,7 +3077,7 @@ AddLocalUser(const char *nick, const char *ident, const char *hostname, const ch
     if (!hostname)
         hostname = self->name;
     make_numeric(self, local_num, numeric);
-    return AddUser(self, nick, ident, hostname, modes, numeric, desc, now, "AAAAAA");
+    return AddUser(self, nick, ident, hostname, modes, numeric, desc, timestamp, "AAAAAA");
 }
 
 struct userNode *
@@ -3233,6 +3292,8 @@ DelUser(struct userNode* user, struct userNode *killer, int announce, const char
         free(user->mark);
         user->mark = NULL;
     }
+    free_string_list(user->marks);
+    user->marks = NULL;
 
     /* clean up geoip data if any */
     if(user->country_code) free(user->country_code);