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.

Help to add/post date

Old posts that have not been replied to for several years.
Locked
B
Black|Man
Voice
Posts: 21
Joined: Fri Oct 25, 2002 8:49 am
Location: Denmark

Help to add/post date

Post by Black|Man »

how to set from nickname to Date
that post this -> News by nick:
and this i need -> News 16/09-2003:

Code: Select all

# add news

proc nws:addnews {nick uhost handle chan arg} {
    global nws
    if {$chan != $nws(chan)} {return 0}
    set file $nws(file) ; set arg [mirc_strip "$nick $arg"]
    set nws(fd) [open $file a+]
    puts $nws(fd) $arg
    close $nws(fd)
    putserv "NOTICE $nick :News has been added"
    putcmdlog "<<$nick>> !$handle! Added news in $chan."
    return 1
}

# read news
proc nws:news {nick uhost handle chan arg} {
    global nws
    if {$chan != $nws(chan)} {return 0}
    set file $nws(file)
    if {![file exists $file]} {putserv "NOTICE $nick :No news found, $file does not exist" ; return}
    set nws(fd) [open $file r]
    set nws(list) ""
    while { ![eof $nws(fd)] } {
     set tmp [gets $nws(fd)]
     if { $tmp != ""} {lappend nws(list) $tmp }
    }
    close $nws(fd)
    if {[llength $nws(list)] == 0} {putserv "NOTICE $nick :No news found, $file is empty"; return}
    set arg [split $arg]
    if {$arg=="" || ![string is integer $arg]} {
       putserv "NOTICE $nick :[exec grep -c "" $file] news items:"
       foreach news $nws(list) {
	 set place [expr [lsearch -exact $nws(list) $news] + 1]
	 set name [lindex [split $news] 0]
	 set comments [expr [llength [split $news |]] - 1]
         putserv "NOTICE $nick :$place.\002 [lrange [split $news] 1 4]...\002 ($comments comments)"
       }
    } else {
       if {$arg > [llength $nws(list)] || $arg <= 0} {return}
       set news [split [lindex [split [lindex $nws(list) [expr $arg - 1]] |] 0]]
       set cmnt [lrange [split [lindex $nws(list) [expr $arg - 1]] |] 1 end]
       putserv "NOTICE $nick :\002News\002 by \002[lindex $news 0]\002: [lrange $news 1 end]"
       foreach line $cmnt {
          putserv "NOTICE $nick :\002Comment\002 by \002[lindex [split $line] 1]\002: [lrange [split $line] 2 end]"
       }
    }
}
Locked