]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/proto-p10.c
Fixed a warning in src/main.c and removed unused old broken host hiding code
[irc/evilnet/x3.git] / src / proto-p10.c
index 314463a66e0fc9a72bb5a4d0a8e306edb98e892c..f59039c987b2ac5915e493102a019d558da2ec59 100644 (file)
@@ -22,7 +22,6 @@
 #include "chanserv.h"
 #include "hash.h"
 #include "helpfile.h"
-#include "hosthiding.h"
 #include "proto-common.c"
 #include "opserv.h"
 
 #define CMD_SVSPART             "SVSPART"
 #define CMD_SVSQUIT             "SVSQUIT"
 #define CMD_SWHOIS              "SWHOIS"
+#define CMD_TEMPSHUN            "TEMPSHUN"
 #define CMD_TIME                "TIME"
 #define CMD_TOPIC               "TOPIC"
 #define CMD_TRACE               "TRACE"
 #define TOK_SVSPART             "SP"
 #define TOK_SVSQUIT             "SX"
 #define TOK_SWHOIS              "SW"
+#define TOK_TEMPSHUN            "TS"
 #define TOK_TIME                "TI"
 #define TOK_TOPIC               "T"
 #define TOK_TRACE               "TR"
 #define P10_SVSPART             TYPE(SVSPART)
 #define P10_SVSQUIT            TYPE(SVSQUIT)
 #define P10_SWHOIS              TYPE(SWHOIS)
+#define P10_TEMPSHUN            TYPE(TEMPSHUN)
 #define P10_TIME                TYPE(TIME)
 #define P10_TOPIC               TYPE(TOPIC)
 #define P10_TRACE               TYPE(TRACE)
@@ -1092,6 +1094,12 @@ irc_swhois(struct userNode *from, struct userNode *target, const char *message)
 
 }
 
+void
+irc_tempshun(struct userNode *from, struct userNode *target, int remove, const char *reason)
+{
+    putsock("%s " P10_TEMPSHUN " %s %s :%s", from->numeric, (remove ? "-" : "+"), target->numeric, reason);
+}
+
 void
 irc_part(struct userNode *who, struct chanNode *what, const char *reason)
 {
@@ -1619,7 +1627,6 @@ static CMD_FUNC(cmd_nick)
         NickChange(user, argv[1], 1);
     } else {
         struct server *serv;
-        struct userNode *nuser;
         char modes[MAXLEN];
         /* new nick */
         if (argc < 9)
@@ -1629,7 +1636,7 @@ static CMD_FUNC(cmd_nick)
             unsplit_string(argv+6, argc-9, modes);
         else
             strcpy(modes, "+");
-        nuser = AddUser(serv, argv[1], argv[4], argv[5], modes, argv[argc-2], argv[argc-1], atoi(argv[3]), argv[argc-3]);
+        AddUser(serv, argv[1], argv[4], argv[5], modes, argv[argc-2], argv[argc-1], atoi(argv[3]), argv[argc-3]);
     }
     return 1;
 }
@@ -2001,7 +2008,7 @@ static CMD_FUNC(cmd_burst)
     return res;
 }
 
-/* TODO: 
+/* TODO:
  * This is a stub that doesn't actually do anything. It should be completed
  * so that bans on *!*@markname.* match users as it does in nefarious
  */
@@ -2010,7 +2017,7 @@ 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]);
      */
 
@@ -2049,7 +2056,7 @@ static CMD_FUNC(cmd_mark)
         } else
             target->mark = strdup(argv[3]);
         return 1;
-        
+
     }
     else if(!strcasecmp(argv[2], "CVERSION")) {
         /* CTCP VERSION mark */
@@ -2084,6 +2091,8 @@ static CMD_FUNC(cmd_mark)
 
         target->sslfp = strdup(sslfp);
 
+        nickserv_do_autoauth(target);
+
         return 1;
     }
     /* unknown type of mark */
@@ -2207,7 +2216,7 @@ static CMD_FUNC(cmd_clearmode)
 static CMD_FUNC(cmd_topic)
 {
     struct chanNode *cn;
-    time_t chan_ts, topic_ts;
+    time_t topic_ts;
     struct userNode *user;
 
     if (argc < 3)
@@ -2220,15 +2229,12 @@ static CMD_FUNC(cmd_topic)
 
     if (argc == 5) {              /* Asuka / Topic Bursting IRCu's */
         user = GetUserH(origin);
-        chan_ts = atoi(argv[2]);
         topic_ts = atoi(argv[3]);
     } else if (argc >= 6) {       /* Nefarious 0.5.0 */
         user = GetUserH(strtok(argv[2], "!"));
-        chan_ts = atoi(argv[3]);
         topic_ts = atoi(argv[4]);
     } else {                      /* Regular IRCu (No Topic Bursting)*/
         user = GetUserH(origin);
-        chan_ts = cn->timestamp;
         topic_ts = now;
     }
 
@@ -2472,14 +2478,11 @@ static CMD_FUNC(cmd_notice)
 {
     struct privmsg_desc pd;
     struct server *srv;
-    int nuser = 0;
 
     if (argc != 3)
         return 0;
 
     pd.user = GetUserH(origin);
-    if(!pd.user)
-        nuser = 1;
     if (!pd.user || (IsGagged(pd.user) && !IsOper(pd.user))) {
     }
     else {
@@ -2738,6 +2741,8 @@ init_parse(void)
     dict_insert(irc_func_dict, TOK_SVSPART, cmd_svspart);
     dict_insert(irc_func_dict, CMD_SWHOIS, cmd_dummy);
     dict_insert(irc_func_dict, TOK_SWHOIS, cmd_dummy);
+    dict_insert(irc_func_dict, CMD_TEMPSHUN, cmd_dummy);
+    dict_insert(irc_func_dict, TOK_TEMPSHUN, cmd_dummy);
     dict_insert(irc_func_dict, CMD_WHOIS, cmd_whois);
     dict_insert(irc_func_dict, TOK_WHOIS, cmd_whois);
     dict_insert(irc_func_dict, CMD_GLINE, cmd_gline);
@@ -3130,8 +3135,6 @@ AddUser(struct server* uplink, const char *nick, const char *ident, const char *
 {
     struct userNode *oldUser, *uNode;
     unsigned int ignore_user, dummy;
-    char *tstr;
-    int type;
 
     if ((strlen(numeric) < 3) || (strlen(numeric) > 5)) {
         log_module(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): numeric %s wrong length!", (void*)uplink, nick, numeric);
@@ -3189,17 +3192,6 @@ 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);
 
-    tstr = conf_get_data("server/type", RECDB_QSTRING);
-    type = atoi(tstr);
-    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);
-      } 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)
         snprintf(uNode->crypthost, sizeof(uNode->crypthost), "%s", strdup(uNode->cryptip));
     uNode->idle_since = timestamp;
@@ -3370,6 +3362,7 @@ void mod_usermode(struct userNode *user, const char *mode_change) {
        case 'g': do_user_mode(FLAGS_GLOBAL); break;
        case 'B': do_user_mode(FLAGS_BOT); break;
        case 'n': do_user_mode(FLAGS_HIDECHANS); break;
+    case 'p': do_user_mode(FLAGS_HIDECHANS); break;
        case 'I': do_user_mode(FLAGS_HIDEIDLE); break;
        case 'X': do_user_mode(FLAGS_XTRAOP); break;
        case 'C': do_user_mode(FLAGS_CLOAKHOST);