Ejemplo n.º 1
0
	void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
	{
		User *u = source.GetUser();
		Anope::string nick = !params.empty() ? params[0] : "";
		NickServ::Nick *na = NickServ::FindNick(!nick.empty() ? nick : u->nick);

		if (u->Account()->GetRefs<NickServ::Nick *>().size() == 1)
		{
			source.Reply(_("Your nickname is not grouped to anything, so you can't ungroup it."));
			return;
		}

		if (!na)
		{
			source.Reply(_("\002{0}\002 isn't registered."), !nick.empty() ? nick : u->nick);
			return;
		}

		if (na->GetAccount() != u->Account())
		{
			source.Reply(_("\002{0}\002 is not in your group."), na->GetNick());
			return;
		}


		NickServ::Account *oldcore = na->GetAccount();

		if (na->GetNick().equals_ci(oldcore->GetDisplay()))
			oldcore->SetDisplay(oldcore->GetRef<NickServ::Nick *>());

		NickServ::Account *nc = Serialize::New<NickServ::Account *>();
		nc->SetDisplay(na->GetNick());
		na->SetAccount(nc);

		nc->SetPassword(oldcore->GetPassword());
		if (!oldcore->GetEmail().empty())
			nc->SetEmail(oldcore->GetEmail());
		nc->SetLanguage(oldcore->GetLanguage());

		source.Reply(_("\002{0}\002 has been ungrouped from \002{1}\002."), na->GetNick(), oldcore->GetDisplay());

		User *user = User::Find(na->GetNick());
		if (user)
			/* The user on the nick who was ungrouped may be identified to the old group, set -r */
			user->RemoveMode(source.service, "REGISTERED");
	}
Ejemplo n.º 2
0
	void DoNotify(CommandSource &source, const std::vector<Anope::string> &params, MemoServ::MemoInfo *mi)
	{
		const Anope::string &param = params[1];
		NickServ::Account *nc = source.nc;
		ServiceBot *MemoServ = Config->GetClient("MemoServ");

		if (!MemoServ)
			return;

		if (param.equals_ci("ON"))
		{
			nc->SetS<bool>("MEMO_SIGNON", true);
			nc->SetS<bool>("MEMO_RECEIVE", true);
			source.Reply(_("\002{0}\002 will now notify you of memos when you log on and when they are sent to you."), MemoServ->nick);
		}
		else if (param.equals_ci("LOGON"))
		{
			nc->SetS<bool>("MEMO_SIGNON", true);
			nc->UnsetS<bool>("MEMO_RECEIVE");
			source.Reply(_("\002{0}\002 will now notify you of memos when you log on or unset /AWAY."), MemoServ->nick);
		}
		else if (param.equals_ci("NEW"))
		{
			nc->UnsetS<bool>("MEMO_SIGNON");
			nc->SetS<bool>("MEMO_RECEIVE", true);
			source.Reply(_("\002{0}\002 will now notify you of memos when they are sent to you."), MemoServ->nick);
		}
		else if (param.equals_ci("MAIL"))
		{
			if (!nc->GetEmail().empty())
			{
				nc->SetS<bool>("MEMO_MAIL", true);
				source.Reply(_("You will now be informed about new memos via email."));
			}
			else
				source.Reply(_("There's no email address set for your nick."));
		}
		else if (param.equals_ci("NOMAIL"))
		{
			nc->UnsetS<bool>("MEMO_MAIL");
			source.Reply(_("You will no longer be informed via email."));
		}
		else if (param.equals_ci("OFF"))
		{
			nc->UnsetS<bool>("MEMO_SIGNON");
			nc->UnsetS<bool>("MEMO_RECEIVE");
			nc->UnsetS<bool>("MEMO_MAIL");
			source.Reply(_("\002{0}\002 will not send you any notification of memos."), MemoServ->nick);
		}
		else
			this->OnSyntaxError(source, "");
	}