summaryrefslogtreecommitdiff
path: root/include/lists.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lists.h')
-rw-r--r--include/lists.h61
1 files changed, 22 insertions, 39 deletions
diff --git a/include/lists.h b/include/lists.h
index beb7c55b5..377f66a4c 100644
--- a/include/lists.h
+++ b/include/lists.h
@@ -1,16 +1,23 @@
/*
+ * Anope IRC Services
*
- * (C) 2003-2017 Anope Team
- * Contact us at team@anope.org
+ * Copyright (C) 2012-2017 Anope Team <team@anope.org>
*
- * Please read COPYING and README for further details.
+ * This file is part of Anope. Anope is free software; you can
+ * redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software
+ * Foundation, version 2.
*
- * Based on the original code of Epona by Lara.
- * Based on the original code of Services by Andy Church.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see see <http://www.gnu.org/licenses/>.
*/
-#ifndef LISTS_H
-#define LISTS_H
+#pragma once
#include "services.h"
#include "anope.h"
@@ -24,39 +31,16 @@
*/
class CoreExport NumberList
{
- private:
- bool is_valid;
-
- std::set<unsigned> numbers;
+ std::function<void(void)> endf;
- bool desc;
public:
/** Processes a numbered list
* @param list The list
- * @param descending True to make HandleNumber get called with numbers in descending order
+ * @param descending True to call the number handler callback with the numbers in descending order
*/
- NumberList(const Anope::string &list, bool descending);
+ NumberList(const Anope::string &list, bool descending, std::function<void(unsigned int)> nf, std::function<void(void)> ef);
- /** Destructor, does nothing
- */
- virtual ~NumberList();
-
- /** Should be called after the constructors are done running. This calls the callbacks.
- */
- void Process();
-
- /** Called with a number from the list
- * @param number The number
- */
- virtual void HandleNumber(unsigned number);
-
- /** Called when there is an error with the numbered list
- * Return false to immediately stop processing the list and return
- * This is all done before we start calling HandleNumber, so no numbers will have been processed yet
- * @param list The list
- * @return false to stop processing
- */
- virtual bool InvalidRange(const Anope::string &list);
+ ~NumberList();
};
/** This class handles formatting LIST/VIEW replies.
@@ -66,11 +50,11 @@ class CoreExport ListFormatter
public:
typedef std::map<Anope::string, Anope::string> ListEntry;
private:
- NickCore *nc;
+ NickServ::Account *nc;
std::vector<Anope::string> columns;
std::vector<ListEntry> entries;
public:
- ListFormatter(NickCore *nc);
+ ListFormatter(NickServ::Account *nc);
ListFormatter &AddColumn(const Anope::string &name);
void AddEntry(const ListEntry &entry);
bool IsEmpty() const;
@@ -81,14 +65,13 @@ class CoreExport ListFormatter
*/
class CoreExport InfoFormatter
{
- NickCore *nc;
+ NickServ::Account *nc;
std::vector<std::pair<Anope::string, Anope::string> > replies;
unsigned longest;
public:
- InfoFormatter(NickCore *nc);
+ InfoFormatter(NickServ::Account *nc);
void Process(std::vector<Anope::string> &);
Anope::string &operator[](const Anope::string &key);
void AddOption(const Anope::string &opt);
};
-#endif // LISTS_H