| View previous topic :: View next topic |
| Author |
Message |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Wed Jul 28, 2004 1:25 am Post subject: |
|
|
All my scripts related to network services, such as ChanServ, Nickserv.. etc are mainly for use on DALnet, as I myself use DALnet.
./awyeah @ DALnet _________________ ·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
================================== |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Wed Jul 28, 2004 2:05 am Post subject: |
|
|
Anyway ... back to Sergios problem.
| Quote: | It continuous have the problem.
when i do | Quote: |
/msg eirhnh !chanserv sop #parea list |
and i open the file i see this part
| Code: |
-ChanServ Access List Records- |
|
accesslist.txt contains just that one line of text. _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
Sergios Voice
Joined: 23 Jul 2004 Posts: 14
|
Posted: Wed Jul 28, 2004 2:52 am Post subject: |
|
|
Did it work?Mine doesnt. I know that it must say
| Code: | | -ChanServ Access List Records- |
but after that it must say and the list. Me too, it say that message and 2 blank lines.  |
|
| Back to top |
|
 |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Wed Jul 28, 2004 2:55 am Post subject: |
|
|
Okay tell you what, Alchera use this.
Since DALnet has a dffierent output of channel access lists, like:
| Quote: |
-ChanServ- SOp list for #user
-ChanServ- 1 - Abort (abort@jhb-152-101.tm.net.my)
-ChanServ- 2 - Debora (jaysee@202.158.58.228)
-ChanServ- 3 - FrEe-sTyLe (~FreE-StYL@208.155.67.177)
-ChanServ- 4 - Kevmart (kevmart@noIRC.org)
-ChanServ- 5 - MiRiNdA (mirinda@mirinda.nu)
-ChanServ- 6 - Point (pointzero@pix142166196119.nbtel.net)
-ChanServ- End of list.
|
So then, we can modify our code, accordingly to:
| Code: |
#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 equal $nick "ChanServ"])} {
if{(([string match "*/[0-9]/*" [lindex $text 0]]) && ([string match "*(*@*)*" [lindex $text 2]])) || ([string match "*list for #*" $text]) || ([string match "*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
}
}
}
|
DALnet's access list doesn't show the (added by: bla bla at 0:00pm) stuff.
So then we dont need to get that matched. For DALnet I would suggest use matching "(*@*)". _________________ ·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Last edited by awyeah on Fri Jul 30, 2004 6:59 am; edited 2 times in total |
|
| Back to top |
|
 |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Wed Jul 28, 2004 3:06 am Post subject: |
|
|
For Sergios:
If you have quit upon everything use this.
But this will record every notice sent to the bot by ChanServ.
This should definately work!
| Code: |
#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 equal $nick "ChanServ"])} {
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
}
}
}
|
_________________ ·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
================================== |
|
| Back to top |
|
 |
Sergios Voice
Joined: 23 Jul 2004 Posts: 14
|
Posted: Wed Jul 28, 2004 3:52 am Post subject: |
|
|
I test it but the result was the same. I remove one } cause it crash the bot. Well, nevermind. It dont want to work. I have change and the services to see if the notice of chanserv have something wrong. Thanks for reply all of you,and lets continue programming others tcls  |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Wed Jul 28, 2004 9:55 pm Post subject: |
|
|
Oki... much playing etc awyeah and the result does not change, it just does nothing but write one line of text to a file.
So, as an experiment I started from scratch which does get a result of sorts ie. the AOp/SOp list this time is received by the bot which was not happening with your code. The following test code is far far from complete, or working 100%. It does, however, manage to write the first line of text received from ChanServ when the command is triggered (in this case via public command). The problem is having all that is received written to the file and I am sure this is an array "thingie" which is going straight over my head at this point in time.
Anyway, here's the code.
| Code: | # File name of the storage file for the access list.
set accesslist "accesslist.txt"
# Full name of channel services
set chanserv "chanserv@Services.dal.net"
# Create the storage file for the access list.
if {![file exists $accesslist]} {
set acc_fd [open $accesslist w]
close $acc_fd
unset acc_fd
if {![file exists $accesslist]} {
putloglev c "*** (notes) ERROR: Unable to write to $accesslist ***"
return 0
}
}
bind pub n test access:list
bind notc - "* list for *" write:list
proc write:list {nick host hand arg {dest ""}} {
set msg [ctrl:filter $arg]
if {[string equal $dest $::botnick]} {
set acc_fd [open $::accesslist a]
puts $acc_fd $msg
close $acc_fd
}
}
proc access:list {nick uhost hand chan text} {
set type [string tolower $text]
if {[string match $type "aop"]} {
putserv "PRIVMSG $::chanserv :aop $chan list"
} else {
putserv "PRIVMSG $::chanserv :sop $chan list"
}
return
}
# ctrl:filter <string>
# Strip all control characters. Thanks to Ppslim.
proc ctrl:filter {str} {
regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026|\006|\007} $str "" str
return $str
} |
Any assistance to get this working properly will be greatly appreciated.  _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
Sergios Voice
Joined: 23 Jul 2004 Posts: 14
|
Posted: Thu Jul 29, 2004 12:28 am Post subject: |
|
|
| Ok, i will test it. Thanks for the reply. |
|
| Back to top |
|
 |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Thu Jul 29, 2004 1:18 am Post subject: |
|
|
You will have todo a string match. As I already did alchera.
| Code: |
bind notc - "*list for*" << is good
|
How about:
| Code: |
bind notc - "*(*@*)*" << ???
|
The output is like:
| Quote: |
-ChanServ- 1 - awyeah (awyeah@dal.net)
-ChanServ- 2 - Alchera (Alchera@forum.egghelp.org)
|
[1] Second index is a number. ===> match "*/[0-9/]*"
[2] Third index is an nick. ===> match "*/[A-Z/]* (bec a nick cannot consist of numbers only, so theres gotta be some alphabets or chars!)
[3] Fourth index is an (ident@ip.address). ===> match "(*@*)"
Then we can match them to the $text, or even to each list index, like [lindex $text number]. But matching it with the lindex is far better!
Logically something like this should definately work.
So we will have to match these in some/all sort of way.
As for the DALnet one which I tried to make earler I matched the wrong indexes. Try this, errr:
index 0 = -
index 1 = number(s)
index 2 = nick
index 3 = ident@ip.address
| Code: |
proc save:access:list {nick uhost hand text {dest ""}} {
global botnick accesslist
if {([string equal -nocase $botnick $dest]) && ([string equal $nick "ChanServ"])} {
if{((string equal "-" [lindex $text 0]]) && ([string match "*/[0-9]/*" [lindex $text 1]]) && ([string match "*(*@*)*" [lindex $text 3]])) || ([string match -nocase "*list for*" $text]) || ([string match -nocase "*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
}
}
}
|
_________________ ·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Last edited by awyeah on Thu Jul 29, 2004 1:43 am; edited 2 times in total |
|
| Back to top |
|
 |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Thu Jul 29, 2004 1:26 am Post subject: |
|
|
If you want to write every notice which is sent by ChanServ.
*** BIND ***
[1] Bind to notc without any matching. (bind notc - "*" procedure:here)
*** PROCEDURE ***
[2] Check if the destination is the bots nick.
[3] Check if the nick which is noticing is only ChanServ.
[4] Do not match any text.
[5] Just open the file, write to it and close it.
This should do it.
As I mentioned earlier, it would write any notice it receives.
Earlier, I released a script 'ChanServ Verbose Logging Script' something on egghelp.org's TCL Archive. Basically it catches all channel verbose notices sent, and writes them to a file (Also records /chanserv why of the person doing the access list modification). You can take a look at that, from which you can get an idea or help regarding this. _________________ ·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
================================== |
|
| Back to top |
|
 |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Thu Jul 29, 2004 1:48 am Post subject: |
|
|
| Quote: |
Well, nevermind. It dont want to work. I have change and the services to see if the notice of chanserv have something wrong. Thanks for reply all of you,and lets continue programming others tcls. |
Try and try.....untill you succeed.
Even it's daddy will work, just wait n see.
I haven't logged onto IRC since a few days so I'm not testing anything I paste over here, its just what comes in my mind and I write it down.  _________________ ·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
================================== |
|
| Back to top |
|
 |
Sergios Voice
Joined: 23 Jul 2004 Posts: 14
|
Posted: Thu Jul 29, 2004 2:23 am Post subject: |
|
|
| Ok guys, thanks for the help and the replies, i will set it manually cause if it writes every notice from chanserv we will have a problem. I have a question, i want a script to delete all the lines from accesslist.txt. I have read the FAQ but i want to erase all the lines, not the file. Thanks |
|
| Back to top |
|
 |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Thu Jul 29, 2004 3:08 am Post subject: |
|
|
One easy thing is to delete the file itself, and then make an empty one.
Deleting all the lines could be a messy job... on the other hand.
| Code: |
#To delete the old file
exec rm $myfile
#To make/open a new file
set deletefile [open $myfile "w"]
#To close and save the file just made
close $deletefile
|
_________________ ·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
================================== |
|
| Back to top |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Thu Jul 29, 2004 7:02 am Post subject: |
|
|
Why do you keep doing that? Use 'file delete' to delete files. _________________ Have you ever read "The Manual"? |
|
| Back to top |
|
 |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Thu Jul 29, 2004 7:53 am Post subject: |
|
|
Sorry, I wasn't aware of that command, heh.  _________________ ·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
================================== |
|
| Back to top |
|
 |
|