[cvslog] (2006-12-15 09:30:57 UTC) Module eggdrop1.9: Change committed!

cvslog cvs at tsss.org
Fri Dec 15 03:30:58 CST 2006


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.9
Commit time: 2006-12-15 09:30:57 UTC
Commited by: sven

Modified files:
     lib/eggdrop/botnet.c lib/eggdrop/botnet.h lib/eggdrop/script.c
     lib/eggdrop/users.c src/core_binds.c

Log message:

 * Added a function to delete all bots by owner.
 * Documented the user binds.

I did not fix the various oddities of the user binds because a lot of other
binds have similar problems and they should be fixed all at the same time
to get consistent behaviour.

---------------------- diff included ----------------------
Index: eggdrop1.9/lib/eggdrop/botnet.c
diff -u eggdrop1.9/lib/eggdrop/botnet.c:1.3 eggdrop1.9/lib/eggdrop/botnet.c:1.4
--- eggdrop1.9/lib/eggdrop/botnet.c:1.3	Fri Dec  1 22:05:11 2006
+++ eggdrop1.9/lib/eggdrop/botnet.c	Fri Dec 15 03:30:47 2006
@@ -28,7 +28,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: botnet.c,v 1.3 2006-12-02 04:05:11 sven Exp $";
+static const char rcsid[] = "$Id: botnet.c,v 1.4 2006-12-15 09:30:47 sven Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
@@ -495,6 +495,43 @@
 }
 
 /*!
+ * \brief Deletes all bots with a given owner.
+ *
+ * Calls botnet_delete() for every bot with a given owner. In the first search
+ * only the list of local bots is searched. After that the whole list is searched
+ * but it'd be a really wyrd botnet if a match was found there.
+ *
+ * \param module The module whose bots should be deleted.
+ * \param script The script whose bots should be deleted. NULL matches everything.
+ *
+ * \return The number of deleted bots. (Not counting recursive deletes.
+ */
+
+int botnet_delete_by_owner(struct egg_module *module, void *script)
+{
+	int ret = 0;
+	botnet_bot_t *tmp;
+
+	for (tmp = localbot_head; tmp; tmp = tmp->next_local) {
+		if (tmp->flags & BOT_DELETED) continue;
+		if (tmp->owner && tmp->owner->module == module && (!script || tmp->owner->client_data == script)) {
+			++ret;
+			botnet_delete(tmp, _("Module unloaded"));
+		}
+	}
+
+	for (tmp = bot_head; tmp; tmp = tmp->next_local) {
+		if (tmp->flags & BOT_DELETED) continue;
+		if (tmp->owner && tmp->owner->module == module && (!script || tmp->owner->client_data == script)) {
+			++ret;
+			botnet_delete(tmp, _("Module unloaded"));
+		}
+	}
+
+	return ret;
+}
+
+/*!
  * \brief For internal use by botnet_replay_net().
  *
  * \warning Don't call this unless you're botnet_replay_net().
Index: eggdrop1.9/lib/eggdrop/botnet.h
diff -u eggdrop1.9/lib/eggdrop/botnet.h:1.1 eggdrop1.9/lib/eggdrop/botnet.h:1.2
--- eggdrop1.9/lib/eggdrop/botnet.h:1.1	Tue Nov 14 08:51:23 2006
+++ eggdrop1.9/lib/eggdrop/botnet.h	Fri Dec 15 03:30:47 2006
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * $Id: botnet.h,v 1.1 2006-11-14 14:51:23 sven Exp $
+ * $Id: botnet.h,v 1.2 2006-12-15 09:30:47 sven Exp $
  */
 
 #ifndef _EGG_BOTNET_H_
@@ -79,6 +79,7 @@
 botnet_bot_t *botnet_lookup(const char *name);
 botnet_bot_t *botnet_new(const char *name, user_t *user, botnet_bot_t *uplink, botnet_bot_t *direction, botnet_handler_t *handler, void *client_data, event_owner_t *owner, int netburst);
 void botnet_count_subtree(botnet_bot_t *bot, int *bots, int *members);
+int botnet_delete_by_owner(struct egg_module *module, void *script);
 int botnet_delete(botnet_bot_t *bot, const char *reason);
 int botnet_unlink(partymember_t *from, botnet_bot_t *bot, const char *reason);
 int botnet_link(user_t *user);
Index: eggdrop1.9/lib/eggdrop/script.c
diff -u eggdrop1.9/lib/eggdrop/script.c:1.24 eggdrop1.9/lib/eggdrop/script.c:1.25
--- eggdrop1.9/lib/eggdrop/script.c:1.24	Mon Oct  2 23:02:12 2006
+++ eggdrop1.9/lib/eggdrop/script.c	Fri Dec 15 03:30:47 2006
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: script.c,v 1.24 2006-10-03 04:02:12 sven Exp $";
+static const char rcsid[] = "$Id: script.c,v 1.25 2006-12-15 09:30:47 sven Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
@@ -89,10 +89,27 @@
 	return (0);
 }
 
+/*!
+ * \brief Delete all asyncronous events of a module or script.
+ *
+ * This functions kills all asyncronous events of a given module or script
+ * by calling the *_delete_by_owner() functions of all event types.
+ *
+ * \param module The module whose bots should be deleted.
+ * \param script The script whose bots should be deleted. NULL matches everything.
+ *
+ * \return The number of deleted events.
+ *
+ * \bug Not all event types have a *_delete_by_owner() function yet.
+ *      partymembers, sockets, socketfilters and scripting functions are
+ *      missing.
+ */
+
 int script_remove_events_by_owner(egg_module_t *module, void *script)
 {
 	int removed = 0;
 
+	removed += botnet_delete_by_owner(module, script);
 	removed += kill_binds_by_owner(module, script);
 	removed += timer_destroy_by_owner(module, script);
 	removed += egg_dns_cancel_by_owner(module, script);
Index: eggdrop1.9/lib/eggdrop/users.c
diff -u eggdrop1.9/lib/eggdrop/users.c:1.52 eggdrop1.9/lib/eggdrop/users.c:1.53
--- eggdrop1.9/lib/eggdrop/users.c:1.52	Tue Nov 14 08:51:23 2006
+++ eggdrop1.9/lib/eggdrop/users.c	Fri Dec 15 03:30:47 2006
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: users.c,v 1.52 2006-11-14 14:51:23 sven Exp $";
+static const char rcsid[] = "$Id: users.c,v 1.53 2006-12-15 09:30:47 sven Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
@@ -64,10 +64,56 @@
 /* List to keep all users' ircmasks in. */
 static ircmask_list_t ircmask_list = {NULL};
 
-/* Bind tables. */
-static bind_table_t *BT_uflags = NULL,	/* user flags */
-	*BT_uset = NULL,	/* settings */
-	*BT_udelete = NULL;	/* user got deleted */
+/*!
+ * \bind
+ * This flag is triggered every time the flags of a user are changed.
+ * \name uflags
+ * \flags ignored
+ * \match "channel oldflags newflags"
+ * \param string The user's handle.
+ * \param string The channel.
+ * \param string The old flags.
+ * \param string The new flags.
+ * \stackable
+ * \return The return value is broken.
+ * \bug The flags are ignored, the return value is treated as if the bind is
+ *      breakable, the user is passed as a string.
+ */
+
+static bind_table_t *BT_uflags = NULL;
+
+/*!
+ * \bind
+ * This flag is triggered every time a user's settings are changed.
+ * \name uset
+ * \flags ignored
+ * \match "channel setting"
+ * \param string The user's handle.
+ * \param string The channel.
+ * \param string The setting.
+ * \param string The value.
+ * \stackable
+ * \return The return value is broken.
+ * \bug The flags are ignored, the return value is treated as if the bind is
+ *      breakable, the user is passed as a string.
+ */
+
+static bind_table_t *BT_uset = NULL;
+
+/*!
+ * \bind
+ * This flag is triggered every time a user is deleted.
+ * \name udelete
+ * \flags ignored
+ * \match Nothing.
+ * \param user The deleted user.
+ * \stackable
+ * \noreturn
+ * \bug The flags are ignored, nothing is matched, the bind is triggered after
+ *      the user was deleted.
+ */
+
+static bind_table_t *BT_udelete = NULL;
 
 /* Prototypes for internal functions. */
 static user_t *real_user_new(const char *handle, int uid);
Index: eggdrop1.9/src/core_binds.c
diff -u eggdrop1.9/src/core_binds.c:1.19 eggdrop1.9/src/core_binds.c:1.20
--- eggdrop1.9/src/core_binds.c:1.19	Mon Nov 20 19:38:41 2006
+++ eggdrop1.9/src/core_binds.c	Fri Dec 15 03:30:47 2006
@@ -23,7 +23,7 @@
 /*!
  * \bind
  * This bind is triggered once a minute. It is similar to ::BT_event minutely
- * but lets you match a specified date and time.
+ * but allows you to match a specified date and time.
  * \name time
  * \flags Ignored.
  * \match The currect date and time in the format: "minute hour day month year".
----------------------- End of diff -----------------------



More information about the Changes mailing list