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.

"channel add" from TCL script having problems

Old posts that have not been replied to for several years.
Locked
s
studman

"channel add" from TCL script having problems

Post by studman »

Kinda strange thing here.

Eggdrop 1.6.13 running on FreeBSD 5.1 Current server.

I coded a small TCL to check and see if the eggdrop is on 2 particular channels. If the eggdrop does not have the channel in it's database, it performs a "channel add" command and adds the channel. If the eggdrop does have the channel in the database, it just ignores the script.

I defined one channel (#listen) in the config file (hard coded). The other channel (#invite) was dynamically defined. It seems that every time I .rehash, the dynamically configured channel gets created/erased. If the channel existed, it gets erased. If it didn't exist, it gets created.

Is there something here that I'm missing?

Also, I'm looking to have this proc (chan_setup) run at load. I understand that I'll need to use the "bind load <flags> <mask> <proc>", but I don't know what the mask should be. I was gonna use "bind load - * chan_setup", but I'm not sure if that is correct. Any help here would be appreciated.

Code: Select all

set chan_listen "#listen"
set chan_invite "#invite"

bind evnt - rehash chan_setup

proc chan_setup {chan} {

  global chan_listen chan_invite

  if (![validchan $chan_invite]) {
     putlog "Created channel record for $chan_invite"
     channel add $chan_invite {chanmode "+nt"}
  }

  if (![validchan $chan_listen]) {
     putlog "Created channel record for $chan_listen"
     channel add $chan_listen {chanmode "+nt"}
  }
}
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Re: "channel add" from TCL script having problems

Post by Papillon »

studman wrote:I defined one channel (#listen) in the config file (hard coded). The other channel (#invite) was dynamically defined. It seems that every time I .rehash, the dynamically configured channel gets created/erased. If the channel existed, it gets erased. If it didn't exist, it gets created.
There is nothing in the code that will make your channel be erased.... so I suggest you type .chansave after you add the dynamic channel ;)

bind load - * chan_setup Wouldn't hurt to try.. ;) I've never really used the load bind, so I don't know what the mask is... my guess would be the name of the module beeing loaded
Why you want to check channels when loading a module anyway??
Elen sila lúmenn' omentielvo
s
studman

Post by studman »

The reason I wanted it to check the channels is because if the channel does not exist, the script throws out TCL errors. Rather than coding the script to be silent for those errors (giving a false sense of security), I set it up to check for the channel in the database and add it if it doesn't exist.

The "bind load - * chan_setup" command worked fine.

The ".chansave" command didn't seem to help, but I did a ".restart" once the channel was added, and I've had no problems since then. Must be another thing wrong with the ".rehash" command for the eggdrop.

At least I have a workaround for now.
Locked