]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/proto-p10.c
Added hg revision information to VERSION reply to match version strings everywhere...
[irc/evilnet/x3.git] / src / proto-p10.c
index 23b2fa0f0748b898682b849ec4ec6702b8270441..88989bf8fef590d045d24db02198c1a9e798e70a 100644 (file)
@@ -80,6 +80,7 @@
 #define CMD_PROTO               "PROTO"
 #define CMD_QUIT                "QUIT"
 #define CMD_REHASH              "REHASH"
+#define CMD_REMOVE             "REMOVE"
 #define CMD_RESET              "RESET"
 #define CMD_RESTART             "RESTART"
 #define CMD_RPING               "RPING"
 #define CMD_WHO                 "WHO"
 #define CMD_WHOIS               "WHOIS"
 #define CMD_WHOWAS              "WHOWAS"
+#define CMD_ZLINE              "ZLINE"
 
 /* Tokenized commands. */
 #define TOK_ACCOUNT            "AC"
 #define TOK_PROTO               "PROTO"
 #define TOK_QUIT                "Q"
 #define TOK_REHASH              "REHASH"
+#define TOK_REMOVE             "RM"
 #define TOK_RESET              "RESET"
 #define TOK_RESTART             "RESTART"
 #define TOK_RPING               "RI"
 #define TOK_WHO                 "H"
 #define TOK_WHOIS               "W"
 #define TOK_WHOWAS              "X"
+#define TOK_ZLINE              "ZL"
 
 /* Protocol messages; aliased to full commands or tokens depending
    on compile-time configuration. ircu prefers tokens WITH THE
 #define P10_PROTO               TYPE(PROTO)
 #define P10_QUIT                TYPE(QUIT)
 #define P10_REHASH              TYPE(REHASH)
+#define P10_REMOVE             TYPE(REMOVE)
 #define P10_RESET              TYPE(RESET)
 #define P10_RESTART             TYPE(RESTART)
 #define P10_RPING               TYPE(RPING)
 #define P10_WHO                 TYPE(WHO)
 #define P10_WHOIS               TYPE(WHOIS)
 #define P10_WHOWAS              TYPE(WHOWAS)
+#define P10_ZLINE              TYPE(ZLINE)
 #define P10_EXEMPT             TYPE(EXEMPT)
 
 /* Servers claiming to have a boot or link time before PREHISTORY
@@ -343,8 +349,8 @@ static const char *his_servername;
 static const char *his_servercomment;
 static int extended_accounts;
 
-/* These correspond to 1 << X:      012345678901234567 */
-const char irc_user_mode_chars[] = "o iw dkgn        I";
+/* These correspond to 1 << X:      01234567890123456789012345 */
+const char irc_user_mode_chars[] = "oOiw dkgh    x  BnIX  azDRWHLq";
 
 static struct userNode *AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, time_t timestamp, const char *realip);
 
@@ -514,7 +520,7 @@ irc_p10_pton(irc_in_addr_t *ip, const char *input)
         do {
             if (*input == '_') {
                 unsigned int left;
-                for (left = (25 - strlen(input)) / 3; left; left--)
+                for (left = (25 - strlen(input)) / 3 - pos; left; left--)
                     ip->in6[pos++] = 0;
                 input++;
             } else {
@@ -1247,7 +1253,7 @@ static CMD_FUNC(cmd_whois)
     else
         irc_numeric(from, RPL_WHOISUSER, "%s %s %s * :%s", who->nick, who->ident, who->hostname, who->info);
 
-    if (IsService(who) || (from == who)) {
+    if (!IsService(who) || (from == who)) {
         struct modeNode *mn;
         mlen = strlen(self->name) + strlen(from->nick) + 12 + strlen(who->nick);
         len = 0;
@@ -1771,7 +1777,8 @@ static CMD_FUNC(cmd_privs)
             for (tmp = x3_strtok(&p, argv[i], ","); tmp;
                  tmp = x3_strtok(&p, NULL, ",")) {
                 if (!strcmp(tmp, "PRIV_NONE")) {
-                    clear_privs(user);
+                    if (now > user->timestamp+5)
+                        clear_privs(user);
                     break;
                 } else
                     client_modify_priv_by_name(user, tmp, what);
@@ -1794,7 +1801,9 @@ static CMD_FUNC(cmd_burst)
     struct modeNode *mNode;
     long mode;
     int oplevel = -1;
+    int type = 0;
     char *user, *end, sep;
+    char *tstr;
     time_t in_timestamp;
     char* parm = NULL;
 
@@ -1802,6 +1811,11 @@ static CMD_FUNC(cmd_burst)
         return 0;
     modes[0] = 0;
 
+    tstr = conf_get_data("server/type", RECDB_QSTRING);
+    if(tstr) {
+        type = atoi(tstr);
+    }
+
     exemptlist[0] = 0;
     banlist[0] = 0;
 
@@ -1812,7 +1826,7 @@ static CMD_FUNC(cmd_burst)
             int n_modes;
             for (pos=argv[next], n_modes = 1; *pos; pos++)
                 if ((*pos == 'k') || (*pos == 'l') || (*pos == 'A')
-                    || (*pos == 'U'))
+                    || (*pos == 'U') || ((type > 7) && (*pos == 'L')))
                     n_modes++;
             if (next + n_modes > argc)
                 n_modes = argc - next;
@@ -2699,6 +2713,11 @@ init_parse(void)
     /* We have reliable clock!  Always!  Wraaa! */
     dict_insert(irc_func_dict, CMD_SETTIME, cmd_dummy);
     dict_insert(irc_func_dict, TOK_SETTIME, cmd_dummy);
+    /* Ignore ZLINE/ZL/REMOVE/RM */
+    dict_insert(irc_func_dict, CMD_ZLINE, cmd_dummy);
+    dict_insert(irc_func_dict, TOK_ZLINE, cmd_dummy);
+    dict_insert(irc_func_dict, CMD_REMOVE, cmd_dummy);
+    dict_insert(irc_func_dict, TOK_REMOVE, cmd_dummy);
 
     /* ignore /trace and /motd commands targetted at us */
     dict_insert(irc_func_dict, TOK_TRACE, cmd_dummy);
@@ -3076,7 +3095,7 @@ AddUser(struct server* uplink, const char *nick, const char *ident, const char *
 
     tstr = conf_get_data("server/type", RECDB_QSTRING);
     type = atoi(tstr);
-    if (type > 6) {
+    if (type == 7) {
       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);
@@ -3311,6 +3330,14 @@ void mod_usermode(struct userNode *user, const char *mode_change) {
                 assign_fakehost(user, host, 0);
             }
             break;
+        case 'a': do_user_mode(FLAGS_ADMIN); break;
+        case 'z': do_user_mode(FLAGS_SSL); break;
+        case 'D': do_user_mode(FLAGS_PRIVDEAF); break;
+        case 'R': do_user_mode(FLAGS_ACCOUNTONLY); break;
+        case 'W': do_user_mode(FLAGS_WHOIS); break;
+        case 'H': do_user_mode(FLAGS_HIDEOPER); break;
+        case 'L': do_user_mode(FLAGS_NOLINK); break;
+        case 'q': do_user_mode(FLAGS_COMMONCHANSONLY); break;
        }
 #undef do_user_mode
     }
@@ -3608,6 +3635,7 @@ mod_chanmode_announce(struct userNode *who, struct chanNode *channel, struct mod
         DO_MODE_CHAR(NOQUITMSGS, 'Q');
         DO_MODE_CHAR(NOAMSG, 'T');
         DO_MODE_CHAR(OPERSONLY, 'O');
+        DO_MODE_CHAR(ADMINSONLY, 'a');
         DO_MODE_CHAR(REGISTERED, 'z');
         DO_MODE_CHAR(SSLONLY, 'Z');
        DO_MODE_CHAR(HIDEMODE, 'L');
@@ -3664,6 +3692,7 @@ mod_chanmode_announce(struct userNode *who, struct chanNode *channel, struct mod
         DO_MODE_CHAR(NOQUITMSGS, 'Q');
         DO_MODE_CHAR(NOAMSG, 'T');
         DO_MODE_CHAR(OPERSONLY, 'O');
+        DO_MODE_CHAR(ADMINSONLY, 'a');
         DO_MODE_CHAR(REGISTERED, 'z');
         DO_MODE_CHAR(SSLONLY, 'Z');
        DO_MODE_CHAR(HIDEMODE, 'L');
@@ -3739,6 +3768,7 @@ mod_chanmode_format(struct mod_chanmode *change, char *outbuff)
         DO_MODE_CHAR(NOQUITMSGS, 'Q');
         DO_MODE_CHAR(NOAMSG, 'T');
         DO_MODE_CHAR(OPERSONLY, 'O');
+        DO_MODE_CHAR(ADMINSONLY, 'a');
         DO_MODE_CHAR(REGISTERED, 'z');
         DO_MODE_CHAR(SSLONLY, 'Z');
        DO_MODE_CHAR(HIDEMODE, 'L');
@@ -3763,6 +3793,7 @@ mod_chanmode_format(struct mod_chanmode *change, char *outbuff)
         DO_MODE_CHAR(NOQUITMSGS, 'Q');
         DO_MODE_CHAR(NOAMSG, 'T');
         DO_MODE_CHAR(OPERSONLY, 'O');
+        DO_MODE_CHAR(ADMINSONLY, 'a');
         DO_MODE_CHAR(REGISTERED, 'z');
         DO_MODE_CHAR(SSLONLY, 'Z');
        DO_MODE_CHAR(HIDEMODE, 'L');