X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/569587404da2a897f15e6b0d4bd64e8fbe5617c4..d07e3fffd6db5d033193385012d500c7b954f1be:/src/proto-p10.c diff --git a/src/proto-p10.c b/src/proto-p10.c index 7d17423..264c858 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -864,7 +864,7 @@ irc_invite(struct userNode *from, struct userNode *who, struct chanNode *to) void irc_silence(struct userNode *who, const char *mask, int add) { - putsock("%s " P10_SILENCE " %s %s%s", self->numeric, who->numeric, add ? "" : "-", mask); + putsock("%s " P10_SILENCE " %s %s%s", self->numeric, who->numeric, add ? "+" : "-", mask); } void @@ -925,12 +925,15 @@ irc_topic(struct userNode *service, struct userNode *who, struct chanNode *what, int type = 4; const char *str; str = conf_get_data("server/type", RECDB_QSTRING); - type = atoi(str); + if(str) + type = atoi(str); + else + type = 4;/* default to 040 style topics */ if (type == 5) { putsock("%s " P10_TOPIC " %s %s " FMT_TIME_T " " FMT_TIME_T " :%s", service->numeric, what->name, who->nick, what->timestamp, now, topic); } else { - who = service; /* REMOVE LINE FOR NEFARIOUS 0.5.0 */ + who = service; putsock("%s " P10_TOPIC " %s :%s", who->numeric, what->name, topic); } } @@ -1629,6 +1632,48 @@ static CMD_FUNC(cmd_part) return 1; } +static CMD_FUNC(cmd_silence) +{ + struct userNode *user; + char *mask; + unsigned int i; + + if (argc < 2) + return 0; + + user = GetUserN(argv[1]); + + /* Sanity, go nuts if this happens */ + if (!user) + return 0; + + /* We can safely ignore this if a user adding a silence is not + * ignored. However this brings up a TODO. If a user logs in and + * they have silences on the IRCd then we need to set them here + * somehow + */ + if (!user->handle_info) + return 1; + + mask = strdup(argv[2]); + + if (*mask == '-') { + for (i=0; ihandle_info->ignores->used; i++) { + if (!irccasecmp(mask+1, user->handle_info->ignores->list[i])) + user->handle_info->ignores->list[i] = user->handle_info->ignores->list[--user->handle_info->ignores->used]; + } + } else { + for (i=0; ihandle_info->ignores->used; i++) { + if (!strcmp(mask+1, user->handle_info->ignores->list[i])) + return 1; /* Already on the users NickServ ignore list, safely ignore */ + } + + string_list_append(user->handle_info->ignores, mask+1); + } + + return 1; +} + static CMD_FUNC(cmd_kick) { if (argc < 3) @@ -1863,8 +1908,8 @@ init_parse(void) dict_insert(irc_func_dict, TOK_TOPIC, cmd_topic); dict_insert(irc_func_dict, CMD_AWAY, cmd_away); dict_insert(irc_func_dict, TOK_AWAY, cmd_away); - dict_insert(irc_func_dict, CMD_SILENCE, cmd_dummy); - dict_insert(irc_func_dict, TOK_SILENCE, cmd_dummy); + dict_insert(irc_func_dict, CMD_SILENCE, cmd_silence); + dict_insert(irc_func_dict, TOK_SILENCE, cmd_silence); dict_insert(irc_func_dict, CMD_KICK, cmd_kick); dict_insert(irc_func_dict, TOK_KICK, cmd_kick); dict_insert(irc_func_dict, CMD_SQUIT, cmd_squit);