]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/proto-p10.c
Added some bits from check_ctcp into the mark version handling
[irc/evilnet/x3.git] / src / proto-p10.c
index 5e552d07a6d487c6959a4dedf52cf8a1aba8985a..7e85830fc59b30eccd6bc40efec5bd64e01f622e 100644 (file)
@@ -1633,6 +1633,7 @@ static CMD_FUNC(cmd_burst)
     static char exemptlist[MAXLEN], banlist[MAXLEN];
     unsigned int next = 3, res = 1;
     int ctype = 0, echeck = 0, bcheck = 0;
+    struct chanData *cData;
     struct chanNode *cNode;
     struct userNode *un;
     struct modeNode *mNode;
@@ -1716,6 +1717,15 @@ static CMD_FUNC(cmd_burst)
         irc_burst(cNode);
     }
     cNode = AddChannel(argv[1], in_timestamp, modes, banlist, exemptlist);
+    cData = cNode->channel_info;
+
+    if (!cData) {
+        if (cNode->modes & MODE_REGISTERED) {
+            irc_join(opserv, cNode);
+            irc_mode(opserv, cNode, "-z");
+            irc_part(opserv, cNode, "");
+        }
+    }
 
     /* Burst channel members in now. */
     for (user = members, sep = *members, mode = 0; sep; user = end) {
@@ -1780,13 +1790,32 @@ static CMD_FUNC(cmd_mark)
         /* DNSBL_DATA name */
         target = GetUserH(argv[1]);
         if(!target) {
-            log_module(MAIN_LOG, LOG_ERROR, "Unable to find user %s whose mark is changing.", argv[1]);
+            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]);
         return 1;
         
     }
+    else if(!strcasecmp(argv[2], "CVERSION")) {
+        /* DNSBL_DATA name */
+        target = GetUserH(argv[1]);
+        if(!target) {
+            log_module(MAIN_LOG, LOG_ERROR, "Unable to find user %s whose version mark is changing.", argv[1]);
+            return 0;
+        }
+
+        char *version = unsplit_string(argv + 3, argc - 3, NULL);
+        if(!version)
+            version = "";
+
+        target->version_reply = strdup(version);
+
+        if(match_ircglob(version, "WebTV;*"))
+            target->no_notice = true; /* webbies cant see notices */
+
+        return 1;
+    }
     /* unknown type of mark */
     return 1;
 }
@@ -2774,6 +2803,8 @@ AddUser(struct server* uplink, const char *nick, const char *ident, const char *
 {
     struct userNode *oldUser, *uNode;
     unsigned int n, ignore_user;
+    char *tstr;
+    int type;
 
     if ((strlen(numeric) < 3) || (strlen(numeric) > 5)) {
         log_module(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): numeric %s wrong length!", uplink, nick, numeric);
@@ -2822,11 +2853,15 @@ AddUser(struct server* uplink, const char *nick, const char *ident, const char *
     safestrncpy(uNode->numeric, numeric, sizeof(uNode->numeric));
     irc_p10_pton(&uNode->ip, realip);
 
-    if (irc_in_addr_is_ipv4(uNode->ip)) {
-      make_virtip((char*)irc_ntoa(&uNode->ip), (char*)irc_ntoa(&uNode->ip), uNode->cryptip);
-      make_virthost((char*)irc_ntoa(&uNode->ip), uNode->hostname, uNode->crypthost);
-    } else if (irc_in_addr_is_ipv6(uNode->ip)) {
-      make_ipv6virthost((char*)irc_ntoa(&uNode->ip), uNode->hostname, uNode->crypthost);
+    tstr = conf_get_data("server/type", RECDB_QSTRING);
+    type = atoi(tstr);
+    if (type > 6) {
+      if (irc_in_addr_is_ipv4(uNode->ip)) {
+        make_virtip((char*)irc_ntoa(&uNode->ip), (char*)irc_ntoa(&uNode->ip), uNode->cryptip);
+        make_virthost((char*)irc_ntoa(&uNode->ip), uNode->hostname, uNode->crypthost);
+      } else if (irc_in_addr_is_ipv6(uNode->ip)) {
+        make_ipv6virthost((char*)irc_ntoa(&uNode->ip), uNode->hostname, uNode->crypthost);
+      }
     }
 
     if (!uNode->crypthost && uNode->cryptip)
@@ -2981,6 +3016,30 @@ void mod_usermode(struct userNode *user, const char *mode_change) {
        // case 'h': do_user_mode(FLAGS_HELPER); break;
        // I check if there's an 'h' in the first part, and if there, 
        // then everything after the space becomes their new host.
+       case 'C': do_user_mode(FLAGS_CLOAKHOST);
+           if (*word) {
+               char cloakhost[MAXLEN];
+               unsigned int ii;
+               for (ii=0; (*word != ' ') && (*word != '\0'); )
+                   cloakhost[ii++] = *word++;
+               cloakhost[ii] = 0;
+               while (*word == ' ')
+                   word++;
+               safestrncpy(user->crypthost, cloakhost, sizeof(user->crypthost));
+           }
+           break;
+       case 'c': do_user_mode(FLAGS_CLOAKIP);
+           if (*word) {
+               char cloakip[MAXLEN];
+               unsigned int ii;
+               for (ii=0; (*word != ' ') && (*word != '\0'); )
+                   cloakip[ii++] = *word++;
+               cloakip[ii] = 0;
+               while (*word == ' ')
+                   word++;
+               safestrncpy(user->cryptip, cloakip, sizeof(user->cryptip));
+           }
+           break;
        case 'h': do_user_mode(FLAGS_SETHOST);
            if (*word) {
                char sethost[MAXLEN];