summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdam <Adam@drink-coca-cola.info>2010-05-17 20:33:28 -0400
committerAdam <Adam@anope.org>2010-06-18 21:03:41 -0400
commit17ab4104005cc5098d9152e6c90d54977222dd06 (patch)
treed8ffffedcf5537292a4f19faeb5f1e7796969132 /include
parent2a22d9c2fdf6978858055f1143af0ec40e417424 (diff)
Removed process_numlist and having to mark everything as "in use" and constantly checking it. Replaced with a better system.
Diffstat (limited to 'include')
-rw-r--r--include/extern.h6
-rw-r--r--include/modules.h14
-rw-r--r--include/regchannel.h22
-rw-r--r--include/services.h28
4 files changed, 39 insertions, 31 deletions
diff --git a/include/extern.h b/include/extern.h
index 757bac3dc..100aceaa3 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -81,6 +81,7 @@ E User *nc_on_chan(Channel * c, NickCore * nc);
E char *chan_get_modes(Channel * chan, int complete, int plus);
E int get_access_level(ChannelInfo * ci, NickAlias * na);
+E int get_access_level(ChannelInfo *ci, NickCore *nc);
E const char *get_xop_level(int level);
E void do_cmode(const char *source, int ac, const char **av);
@@ -262,6 +263,7 @@ E char *sstrdup(const char *s);
E void ms_init();
E void memoserv(User * u, char *buf);
+E void rsend_notify(User *u, Memo *m, const char *chan);
E void check_memos(User * u);
E MemoInfo *getmemoinfo(const char *name, int *ischan, int *isforbid);
E void memo_send(User * u, const char *name, const char *text, int z);
@@ -302,10 +304,6 @@ E const char *duration(NickCore *nc, char *buf, int bufsize, time_t seconds);
E const char *expire_left(NickCore *nc, char *buf, int len, time_t expires);
E int doValidHost(const char *host, int type);
-typedef int (*range_callback_t) (User * u, int num, va_list args);
-E int process_numlist(const char *numstr, int *count_ret,
- range_callback_t callback, User * u, ...);
-
E int isValidHost(const char *host, int type);
E int isvalidchar(const char c);
diff --git a/include/modules.h b/include/modules.h
index d76b8f70b..98dfd6d3e 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -790,18 +790,18 @@ class CoreExport Module
/** Called when access is changed
* @param ci The channel
* @param u The user who changed the access
- * @param na The nick whos access was changed
+ * @param nc The nick whos access was changed
* @param level The level of the new access
*/
- virtual void OnAccessChange(ChannelInfo *ci, User *u, NickAlias *na, int level) { }
+ virtual void OnAccessChange(ChannelInfo *ci, User *u, NickCore *nc, int level) { }
/** Called when access is added
* @param ci The channel
* @param u The user who added the access
- * @para na The nick who was added to access
+ * @para nc The nick who was added to access
* @param level The level they were added at
*/
- virtual void OnAccessAdd(ChannelInfo *ci, User *u, NickAlias *na, int level) { }
+ virtual void OnAccessAdd(ChannelInfo *ci, User *u, NickCore *nc, int level) { }
/** Called when the access list is cleared
* @param ci The channel
@@ -858,16 +858,18 @@ class CoreExport Module
virtual void OnChannelDelete(Channel *c) { }
/** Called after adding an akick to a channel
+ * @param u The user adding the akick
* @param ci The channel
* @param ak The akick
*/
- virtual void OnAkickAdd(ChannelInfo *ci, AutoKick *ak) { }
+ virtual void OnAkickAdd(User *u, ChannelInfo *ci, AutoKick *ak) { }
/** Called before removing an akick from a channel
+ * @param u The user removing the akick
* @param ci The channel
* @param ak The akick
*/
- virtual void OnAkickDel(ChannelInfo *ci, AutoKick *ak) { }
+ virtual void OnAkickDel(User *u, ChannelInfo *ci, AutoKick *ak) { }
/** Called when a user requests info for a channel
* @param u The user requesting info
diff --git a/include/regchannel.h b/include/regchannel.h
index 474b6f79a..e4c6fa6f5 100644
--- a/include/regchannel.h
+++ b/include/regchannel.h
@@ -161,12 +161,6 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag>
*/
void EraseAccess(unsigned index);
- /** Cleans the channel access list
- *
- * Cleans up the access list so it no longer contains entries no longer in use.
- */
- void CleanAccess();
-
/** Clear the entire channel access list
*
* Clears the entire access list by deleting every item and then clearing the vector.
@@ -203,18 +197,14 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag>
const unsigned GetAkickCount() const;
/** Erase an entry from the channel akick list
- * @param akick The akick
+ * @param index The index of the akick
*/
- void EraseAkick(AutoKick *akick);
+ void EraseAkick(unsigned index);
/** Clear the whole akick list
*/
void ClearAkick();
- /** Clean all of the nonused entries from the akick list
- */
- void CleanAkick();
-
/** Add a badword to the badword list
* @param word The badword
* @param type The type (SINGLE START END)
@@ -234,18 +224,14 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag>
const unsigned GetBadWordCount() const;
/** Remove a badword
- * @param badword The badword
+ * @param index The index of the badword
*/
- void EraseBadWord(BadWord *badword);
+ void EraseBadWord(unsigned index);
/** Clear all badwords from the channel
*/
void ClearBadWords();
- /** Clean all of the nonused entries from the badwords list
- */
- void CleanBadWords();
-
/** Check if a mode is mlocked
* @param Name The mode
* @param status True to check mlock on, false for mlock off
diff --git a/include/services.h b/include/services.h
index 6d7669e63..7db58e3fb 100644
--- a/include/services.h
+++ b/include/services.h
@@ -530,7 +530,6 @@ enum AccessLevel
/* Access levels for users. */
struct ChanAccess
{
- uint16 in_use; /* 1 if this entry is in use, else 0 */
int16 level;
NickCore *nc; /* Guaranteed to be non-NULL if in use, NULL if not */
time_t last_seen;
@@ -551,7 +550,6 @@ enum AutoKickFlag
class AutoKick : public Flags<AutoKickFlag>
{
public:
- bool InUse;
/* Only one of these can be in use */
std::string mask;
NickCore *nc;
@@ -579,7 +577,6 @@ enum BadWordType
/* Structure used to contain bad words. */
struct BadWord
{
- bool InUse;
std::string word;
BadWordType type;
};
@@ -1164,4 +1161,29 @@ class ChanServTimer : public Timer
void Tick(time_t);
};
+/** A class to process numbered lists (passed to most DEL commands).
+ * The function HandleNumber is called for every number in the list. Note that
+ * it *always* gets called in descending order. This is so deleting the index passed
+ * to the function from an array will not cause the other indexes passed to the function
+ * to be incorrect. This keeps us from having to have an 'in use' flag on everything.
+ */
+class NumberList
+{
+ private:
+ std::set<unsigned> numbers;
+ public:
+ /** Processes a numbered list
+ * @param list The list
+ */
+ NumberList(const std::string &list);
+
+ virtual ~NumberList();
+
+ void Process();
+
+ virtual void HandleNumber(unsigned Number);
+
+ virtual bool InvalidRange(const std::string &list);
+};
+
#endif /* SERVICES_H */