Eggdev: Re: [cvslog] (2007-05-12 02:04:34 UTC) Module eggdrop1.9: Change committed!

Will Buckner wcc at techmonkeys.org
Fri May 11 20:23:40 CST 2007


cvslog wrote:
> CVSROOT    : /usr/local/cvsroot
> Module     : eggdrop1.9
> Commit time: 2007-05-12 02:04:34 UTC
> Commited by: sven
>
> Modified files:
>      modules/oldbotnet/oldbotnet.c modules/oldbotnet/oldbotnet.h
>
> Log message:
>
> Took care of the temp users that were spawned every time someone who wasn't
> on any channel did something on the partyline. The oldbotnet module should
> be finished now.
>
> ---------------------- diff included ----------------------
> Index: eggdrop1.9/modules/oldbotnet/oldbotnet.c
> diff -u eggdrop1.9/modules/oldbotnet/oldbotnet.c:1.20 eggdrop1.9/modules/oldbotnet/oldbotnet.c:1.21
> --- eggdrop1.9/modules/oldbotnet/oldbotnet.c:1.20	Tue May  8 20:39:24 2007
> +++ eggdrop1.9/modules/oldbotnet/oldbotnet.c	Fri May 11 21:04:24 2007
> @@ -18,7 +18,7 @@
>   */
>  
>  #ifndef lint
> -static const char rcsid[] = "$Id: oldbotnet.c,v 1.20 2007-05-09 01:39:24 sven Exp $";
> +static const char rcsid[] = "$Id: oldbotnet.c,v 1.21 2007-05-12 02:04:24 sven Exp $";
>  #endif
>  
>  #include <eggdrop/eggdrop.h>
> @@ -29,6 +29,7 @@
>  static int oldbotnet_close(int why);
>  static int do_link(user_t *u, const char *text);
>  static int bot_on_delete(event_owner_t *owner, void *client_data);
> +static int anonymous_on_delete(event_owner_t *owner, void *client_data);
>  //static int sock_on_delete(event_owner_t *owner, void *client_data);
>  
>  /* Partyline commands. */
> @@ -73,6 +74,12 @@
>  	bot_on_delete
>  };
>  
> +static event_owner_t anonymous_owner = {
> +	"oldbotnet", NULL,
> +	NULL, NULL,
> +	anonymous_on_delete
> +};
> +
>  static event_owner_t generic_owner = {
>  	"oldbotnet", NULL,
>  	NULL, NULL,
> @@ -271,6 +278,8 @@
>  
>  static int get_entity(botnet_bot_t *bot, botnet_entity_t *src, char *word)
>  {
> +	oldbotnet_t *obot = bot->client_data;
> +
>  	if (!strchr(word, '@')) {
>  		botnet_bot_t *b = botnet_lookup(word);
>  		if (botnet_check_direction(bot, b)) return -1;
> @@ -296,7 +305,9 @@
>  		id = atoi(word);
>  		nick = ptr + 1;
>  	}
> -	p = partymember_new(id, NULL, srcbot, nick, "temp", "user.on.an.old.bot", NULL, NULL, &generic_owner);
> +	if (obot->anonymous) partymember_delete(obot->anonymous, NULL, "Temp user expired");
> +	obot->anonymous = p = partymember_new(id, NULL, srcbot, nick, "temp", "user.on.an.old.bot", NULL, obot, &anonymous_owner);
> +	if (!p) return 0;
>  	set_user_entity(src, p);
>  	return 1;
>  }
> @@ -392,6 +403,7 @@
>  	else data->password = NULL;
>  	data->idx = egg_connect(host, port, -1);
>  	data->idle = 0;
> +	data->anonymous = NULL;
>  
>  	sockbuf_set_handler(data->idx, &oldbotnet_handler, data);
>  	linemode_on(data->idx);
> @@ -629,8 +641,9 @@
>  
>  	src = partymember_lookup(word[2], srcbot, -1);
>  	if (!src) {
> -		int id;
> +		int id = -1;
>  		char *ptr = strchr(word[2], ':');
> +		oldbotnet_t *obot = bot->client_data;
>  
>  		if (ptr) {
>  			*ptr = 0;
> @@ -638,8 +651,9 @@
>  			++ptr;
>  		} else {
>  			ptr = word[2];
> -			src = partymember_new(id, NULL, srcbot, ptr, "temp", "user.on.an.old.bot", NULL, NULL, &generic_owner);
>  		}
> +		if (obot->anonymous) partymember_delete(obot->anonymous, NULL, "Temp user expired");
> +		obot->anonymous = src = partymember_new(id, NULL, srcbot, ptr, "temp", "user.on.an.old.bot", NULL, obot, &anonymous_owner);
>  	}
>  	botnet_entity_t e = user_entity(src);
>  
> @@ -732,7 +746,7 @@
>   *
>   * \param bot The bot the msg came from.
>   * \param cmd "pong" or "po".
> - * \param text Nothing.
> + * \param next Nothing.
>   *
>   * \format \b pong
>   */
> @@ -881,9 +895,14 @@
>  	id = btoi(word[3] + 1);
>  
>  	p = partymember_lookup(NULL, frombot, id);
> -	if (p && strcmp(p->nick, word[1])) {
> -		partymember_delete(p, NULL, "Botnet desync");
> -		p = NULL;
> +	if (p) {
> +		if (p == obot->anonymous) {
> +			partymember_delete(p, NULL, "Temp user expired");
> +			p = NULL;
> +		} else if (strcmp(p->nick, word[1])) {
> +			partymember_delete(p, NULL, "Botnet desync");
> +			p = NULL;
> +		}
>  	}
>  
>  	if (p) {
> @@ -1258,6 +1277,15 @@
>  	return 0;
>  }
>  
> +static int anonymous_on_delete(event_owner_t *owner, void *client_data)
> +{
> +	oldbotnet_t *bot = client_data;
> +
> +	bot->anonymous = NULL;
> +
> +	return 0;
> +}
> +
>  static int oldbotnet_on_delete(void *client_data, int idx)
>  {
>  	oldbotnet_t *bot = client_data;
> @@ -1303,7 +1331,7 @@
>  
>  int oldbotnet_LTX_start(egg_module_t *modinfo)
>  {
> -	bot_owner.module = generic_owner.module = modinfo;
> +	bot_owner.module = anonymous_owner.module = generic_owner.module = modinfo;
>  	modinfo->name = "oldbotnet";
>  	modinfo->author = "eggdev";
>  	modinfo->version = "1.0.0";
> Index: eggdrop1.9/modules/oldbotnet/oldbotnet.h
> diff -u eggdrop1.9/modules/oldbotnet/oldbotnet.h:1.6 eggdrop1.9/modules/oldbotnet/oldbotnet.h:1.7
> --- eggdrop1.9/modules/oldbotnet/oldbotnet.h:1.6	Tue May  8 20:32:32 2007
> +++ eggdrop1.9/modules/oldbotnet/oldbotnet.h	Fri May 11 21:04:24 2007
> @@ -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: oldbotnet.h,v 1.6 2007-05-09 01:32:32 sven Exp $
> + * $Id: oldbotnet.h,v 1.7 2007-05-12 02:04:24 sven Exp $
>   */
>  
>  #ifndef _EGG_MOD_OLDBOTNET_OLDBOTNET_H_
> @@ -43,6 +43,7 @@
>  	int handlen;
>  	int version;
>  	int idle;
> +	partymember_t *anonymous;
>  } oldbotnet_t;
>  
>  /* From events.c */
> ----------------------- End of diff -----------------------
>
>   




More information about the Eggdev mailing list