This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

making pubm work on only one channel? - Linked to loops thrd

Old posts that have not been replied to for several years.
Locked
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

making pubm work on only one channel? - Linked to loops thrd

Post by Weirdo »

Code: Select all

#bind pubm - * pubm:pubnotc

proc pubm:pubnotc {nick uhost handle chan text} {
	global chanl network notice active
	if {$active == 1} {
		putnotc $nick $notice(public)
		putlog "Notice sent to $nick" 
	}
}
This is what i have so far. I want to make it so that it doesnt flood out the bot, ie, make a queue, so that multiple notices wont be queued for one person, and so that it will only read the text on the $chanl specified, instead of all channels.

Any way of doing this?

This is the option i have to the other thread i made, the figuring out loops.
the basic outocme of this is a way to tell people in channel, that we are moving networks. Since this is happening tomorrow night, i have to find a way through this pretty quickly :)
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Re: making pubm work on only one channel? - Linked to loops

Post by strikelight »

Weirdo wrote:

Code: Select all

#bind pubm - * pubm:pubnotc

proc pubm:pubnotc {nick uhost handle chan text} {
	global chanl network notice active
	if {$active == 1} {
		putnotc $nick $notice(public)
		putlog "Notice sent to $nick" 
	}
}
This is what i have so far. I want to make it so that it doesnt flood out the bot, ie, make a queue, so that multiple notices wont be queued for one person, and so that it will only read the text on the $chanl specified, instead of all channels.

Any way of doing this?

This is the option i have to the other thread i made, the figuring out loops.
the basic outocme of this is a way to tell people in channel, that we are moving networks. Since this is happening tomorrow night, i have to find a way through this pretty quickly :)
Are you sure you want to send a notice to someone everytime text is typed in the channel? (btw, your bind is commented out, so this won't happen anyways at the moment).

But in any event, I would recommend using 'puthelp "NOTICE $nick :text...' as opposed to putnotc.. I'm not sure, but I believe the putnotc procedure uses the putserv queue which could allow the bot to flood itself off irc.

As for a simple queue... You could either make a list or an array... I'd recommend an array, as it would be easier to maintain (ie. deletion of an element after x amount of time), such as:

Code: Select all

bind pubm - * pubm:pubnotc

proc pubm:pubnotc {nick uhost handle chan text} {
   global chanl network notice active netchange
   if {($active == 1) && (![info exists netchange($uhost)])} {
     puthelp "NOTICE $nick :$notice(public)"
     putlog "Notice sent to $nick"
     set netchange($uhost) 1
    #unset the value after an hour (i find utimers more stable than timers)
     utimer 3600 [list unset netchange($uhost)]
   }
}
Hope this helps
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

as for making it only react in one channel.... unless you have multiple channels in $chanl... you could just use

Code: Select all

bind pubm - "#channel *" pubm:pubnotc
Elen sila lúmenn' omentielvo
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

that works nicely, thank you very much :)
Locked