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.

Hadace messaging problem

Support & discussion of released scripts, and announcements of new releases.
m
mrhex
Voice
Posts: 12
Joined: Sun Nov 13, 2005 9:57 pm

Post by mrhex »

It by default want to create a folder in botdir/ called data/ , well actually it wants to create the path+file.(see uzeno.tcl code snippet below).

Code: Select all

set message_db "data/h_message.dat"
I joined in his channel as he posted here, and did some bugfinding with him.

When i created the file manually by, mkdir data,
touch data/h_message.dat
Then added the line as below in uzeno.tcl to see if the script could read and continue, in h_message.dat.
Hadace !messaging database file created
It is as the script is able to READ from the file but unable to write to/create the file.

it is not a write rights problem, i even made the file when creating it, rwxrwxrwx just to make shure.

I was to join in on #hadace today, to test a debug version of his script that he was gonna make, but i got RL (workrelated) hindrances.

Bseen is my personal favourite, well havent tried much nor have i needed to try any other seen scripts.
Has all the functions needed and supports wildcard searches on nicknames and such.

It states a database file also just as uzeno.tcl does.

named bs_data.<channame>

In which it stores and sort its data.

It uses this method to create the file.

Code: Select all


proc bs_save {} {
  global bs_list userfile bs ; if {[array size bs_list] == 0} {return}
  if {![string match */* $userfile]} {set name [lindex [split $userfile .] 0]} {
    set temp [split $userfile /] ; set temp [lindex $temp [expr [llength $temp]-1]] ; set name [lindex [split $temp .] 0]
  }
  if {[file exists $bs(path)bs_data.$name]} {catch {exec cp -f $bs(path)bs_data.$name $bs(path)bs_data.$name.bak}}
  set fd [open $bs(path)bs_data.$name w] ; set id [array startsearch bs_list] ; putlog "Backing up seen data..."
  puts $fd "#$bs(updater)"    
  while {[array anymore bs_list $id]} {set item [array nextelement bs_list $id] ; puts $fd "$bs_list($item)"} ; array donesearch bs_list $id ; close $fd
}

Uzeno does this:

Code: Select all

proc mess_write { nick cimzett uzenet } {
        global message_db
        set cimzett [string tolower $cimzett]
        if {![file exists $message_db]} {
                file mkdir [lindex [split $message_db /] 0]
                set filemuvelet [open $message_db w+]  
                puts $filemuvelet "Hadace !messaging database file created"
        } else {
                set filemuvelet [open $message_db a]       
        }
        set systemTime [clock seconds]
        set ido [clock format $systemTime -format {%d.%m.%Y. %H.%M:}]
        puts $filemuvelet "$nick $cimzett $ido [join $uzenet] "
        close $filemuvelet
}
The tcl wiki documentation say this about "open"

Code: Select all



This command opens a file, serial port, or command pipeline and returns a channel identifier that may be used in future invocations of commands like read, puts, and close. If the first character of fileName is not | then the command opens a file: fileName gives the name of the file to open, and it must conform to the conventions described in the filename manual entry. 
The access argument, if present, indicates the way in which the file (or command pipeline) is to be accessed. In the first form access may have any of the following values: 


r
Open the file for reading only; the file must already exist. This is the default value if access is not specified. 

r+
Open the file for both reading and writing; the file must already exist. 

w
Open the file for writing only. Truncate it if it exists. If it doesn't exist, create a new file. 

w+
Open the file for reading and writing. Truncate it if it exists. If it doesn't exist, create a new file. 

a
Open the file for writing only. If the file doesn't exist, create a new empty file. Set the initial access position to the end of the file. 

a+
Open the file for reading and writing. If the file doesn't exist, create a new empty file. Set the initial access position to the end of the file. 
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

mrhex wrote:Bseen is my personal favourite, well havent tried much nor have i needed to try any other seen scripts.
I only use the gseen module; faster, smaller.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
m
mrhex
Voice
Posts: 12
Joined: Sun Nov 13, 2005 9:57 pm

Post by mrhex »

I am trying to but to tired after work today, need to get me sum sleep.

But it cant be that the script cant "open" h_message.dat.
Since it can READ it.

if i create the file and put "Hadace !messaging database file created" in the file. It triggers on !messages and goes through the file.
But it does not go through the file creation/write code when i trigger with
!msg nick message.
Something makes it pass "proc mess_write" part of the script, if i understand it correctly it would have displayed a Notice:

"Message for <nickname> accepted"

If i had written the syntax wrong i would have gotten:

"The right format: !msg <nick> <message(uzenet in code)>"

If something above had displayed the write to file code would have been passed through. So something makes the entire "proc mess_write" code section be bypassed.

I am using the latest "stable" tcl version.
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

BSeen creates the folder that the db file is to be created and this is the method used to create and access that file: $bs(path)bs_data.$name.

If the script you are playing with is "bypassing" an entire proc it would be that it cannot either create the folder or find the folder that the file is in. Either way, there should be a log of any error event.

As for gseen, it's simple and as it is based on BSeen it has all the functions your are used to. :)
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
S
Stella
Voice
Posts: 1
Joined: Mon Jan 02, 2006 2:22 pm

Post by Stella »

In line 4 of the english tcl

Code: Select all

bind pub v|o "!msg" mess_do
change to

Code: Select all

bind pub o|o "!msg" mess_do
Now it will write to the database file..:D

I'm not sure at this stage if "voices" can use it, but ops definately can

Stella
Post Reply