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.

Trying to create a sop/vop/aop/akick list

Help for those learning Tcl or writing their own scripts.
Locked
S
Sergios
Voice
Posts: 14
Joined: Fri Jul 23, 2004 2:48 pm

Trying to create a sop/vop/aop/akick list

Post by Sergios »

Hello, i'm trying to create a tcl to write the lists into a someone.txt file and then with a generate.tcl to an html file. My problem is that: i use putquick "PRIVMSG chanserv :sop $arg list" where $arg is #channel. The problem is that it execute the command but how can the result of this command write it to a file? i have try this but it fails :
set file [open $::cfile a]
puts $file "Channel Access List: ^B$arg^B"
putquick "PRIVMSG chanserv :sop $arg list"
close $file

Any help? Thanks
D
DayCuts
Voice
Posts: 37
Joined: Tue Jun 15, 2004 8:43 am

Post by DayCuts »

Code: Select all

puts $file "Channel Access List: ^B $arg ^B"
S
Sergios
Voice
Posts: 14
Joined: Fri Jul 23, 2004 2:48 pm

Post by Sergios »

With puts $file "Channel Access List: ^B $arg ^B" i don't get the sop list of channel that i want ($arg=channel). I really want the text of the command that gives this command : putquick "PRIVMSG chanserv :sop $arg list" , so that can write into acc.txt the access list of #mychannel via chanserv command. Any help?
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Is this what you're after?

Code: Select all

putserv "PRIVMSG ChanServ@services.dal.net :SOP $arg LIST
With the above format one can use all services commands as you would in mIRC etc. :)
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
S
Sergios
Voice
Posts: 14
Joined: Fri Jul 23, 2004 2:48 pm

Post by Sergios »

Well,yes, i know that is the command. That i want is that command you tell to write it to a file. I mean the result of the command(of chanserv), the SOP list is:1)Sergios sergios@something.net
2)Nickname userid@host
I mean the sop list how can i write it to a file?
Any help?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Okay lets see, show me a sample output of one of your chanserv list notices. So we can go ahead and do a string match, then write all of the text to a file.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
S
Sergios
Voice
Posts: 14
Joined: Fri Jul 23, 2004 2:48 pm

Post by Sergios »

Ok, let me give the script that it coded

Code: Select all

##
# DCsoplist2txt.tcl by DrugCheese for sergios
#  7-24-04
#
#    Will write chanservs SOp list for a channel to filesystem
##

# Set the file name, the time of day , and the channel
bind msg n DCtest DCtest
proc DCtest {nick host hand arg} { WriteList 1 2 3 4 5 }
#set the filename to save to
#set SOpList "SOplist.txt"
set qfile soplist.txt
#set the time of day  ( 1:05am )
bind time - "05 01 * * *" WriteList

#set the channel to check
set Channel "#parea"

#################################################

proc WriteList {mi ho dd mo ye} {
                global Channel
                        putlog "DCsoplist2txt - sending request to chanserv"
                                putquick "chanserv :sop $Channel list"
                        }
#       bind notc -|- ** IncomingNotice
proc IncomingNotice {nick host hand arg dest} {
#                       putlog "incoming NOTICE nick $nick $host host hand $hand arg $arg dest $dest"
                        global Channel
                        if {$nick != "ChanServ"} {
                        return 0
        }
               if {[string match *$Channel* $arg]} {
        set file [open $::qfile w]
        puts $file "$arg"
        close $file
          putlog "DCsoplist2txt - retrieved and written"
          return 0
          }
}
                putlog "DCsoplist2txt loaded"
And now i will give you the sop list from chanserv,my chanserv is chanserv!services@irc.net
and the sop list is:

Code: Select all

<10:01am> -ChanServ- SOP list for #parea:
-
<10:01am> -ChanServ-  * 1) TheKeyMaster (~TKM@patra-nirvana-273AAAFA.parea.pwn) (added by Sergios  via: Sergios - (nirvana.netadmin.net) - Sun Feb 22 01:13:32 2004 EST)
-
<10:01am> -ChanServ-  * 2) Jasonpap (fghj@patra-nirvana-F4B0DA7.parea.pwn) (added by Sergios via: Sergios - (nirvana.netadmin.net) - Wed Jan 07 22:29:00 2004 EST)
-
<10:01am> -ChanServ-  * 3) Eirhnh (~Eirhnh@admin.nirvana.net) (added by Sergios via: Sergios - (nirvana.netadmin.net) - Wed Jan 07 22:53:21 2004 EST)
-
<10:01am> -ChanServ- End of List.
-
<10:01am> -ChanServ- Nicks with the aprotect setting enabled are bold and are marked with a '*'. If an access mask has been set for an entry, the mask is also being printed in bold letters.
I dont use the dalnet ircservices, kickservices from kickchat.
If you can help me to edit the script. Now it write only the first line, and i mean this :SOP list for #parea:
Thanks for the reply and sorry for my wrong place which i was posting yesterday.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Okay, lets scrap... (discard) the one you wrote.
I'll write a fresh one right here, right now. :P

Code: Select all

#Set the filename to save the access list records in.
set accesslist "accesslist.txt"

if {![file exists $accesslist]} {
 putlog "ACCESS LIST FILE:\002 $accesslist \002file \002does not exist\002, *creating file*: \002$accesslist\002"
 set file [open $accesslist "w"]
 puts $file "-ChanServ Access List Records-\n"
 close $file
}

bind msgm n !chanserv get:access:list
bind notc - save:access:list

proc get:access:list {nick uhost hand text} {
 set type [lindex $text 0]; set chan [lindex $text 1]
 if {([string equal -nocase "list" [lindex $text 2]])} {
 putquick "PRIVMSG chanserv :$type $chan list"
 }
}

proc save:access:list {nick uhost hand text {dest ""}} {
 global botnick accesslist
  if {(![string equal -nocase $botnick $dest]) || ([string match -nocase "#*" $dest])} { return 0 }
  if {([string equal $nick "ChanServ"]) && ([string equal $uhost "services@irc.net"])} {
  if {(([string match "*)" [lindex $text 1]]) && ([string match "(*@*)" [lindex $text 3]]) &&  ([string equal "(added" [lindex $text 4]]) && ([string equal "by" [lindex $text 5]])) ||  (([string match "*?OP list for*" $text]) || ([string equal "End of List" $text]))} {
  if {![file exists $accesslist]} { set file [open $accesslist "w"]; puts $file "-ChanServ Access List Records-\n"; close $file }
  set file [open $accesslist "a"]; puts $file $text; close $file
  return 0
  }
 }
}
Usage: /msg <botnick> !chanserv <AOP|SOP|AKICK> <#channel> list
Okay, I haven't tested this so.. I am not sure. But something like this should definately work, with the output of your chanserv's access list. :wink:

There might be a few syntax errors, because I wrote this in a hurry! :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
S
Sergios
Voice
Posts: 14
Joined: Fri Jul 23, 2004 2:48 pm

Post by Sergios »

It continuous have the problem.
when i do
/msg eirhnh !chanserv sop #parea list
and i open the file i see this part

Code: Select all

-ChanServ Access List Records-
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Re:Trying to create a sop/vop/aop/akick list

Post by Alchera »

This could have application in other areas also awyeah. You might be able to solve a long standing problem of mine. :D
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

/me confused *Alchera* didn't get what you wanted to say.

As for you sergios, try using putlog, some of the string matching conditions or maybe anyone is not coming true, for which it is not executing it. 8)

Maybe you can reduce the number of matches. :wink:
I've used these types of scripts alot of places, and they've worked
for me, you just have to give them a bit of time and a bit of test. :roll:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

awyeah: verifying that a nick is registered with services via a match with a channel's access list. Using a public commands script the bot could check that the nick being added as a user is actually registered; if not, the bot refuses to add the user to its' user file. :)
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

I had a "fiddle" with your script also awyeah and the variable "$text" contains no information. The end result is a text file with just "-ChanServ Access List Records-" on the first line followed by 2 empty lines; putlog bore no fruit either!
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

The $text variable, should contain the notice sent by chanserv. The procedure is binded on notice, so the $text should be the message. That is very simple logic. :mrgreen:

Check it, after this line:

Code: Select all

  if {(![string equal -nocase $botnick $dest]) || ([string match -nocase "#*" $dest])} { return 0 }
Put this:

Code: Select all

putlog "$text"
It should definately give an output for the variable $text and will indeed not be null. :wink:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

My nick it did. LOL

Maybe paste a DALnet version of it .. might make it simpler. :D
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Locked