[FrontPage] [TitleIndex] [WordIndex]

dAmn

dAmn/Clients

  1. About
  2. How to use
    1. /authtoken
    2. /damn
    3. /join channel
    4. /me something
    5. whois
  3. Source Code
  4. BetaVersions
    1. Beta 0.6

About

For mIRC, written by `rnx, first version.

alot more code than iceshaman's,but still working in order :|

still beta, lots of bugs

How to use

/authtoken

use to paste cookie info and set nickname/auth

(if you know them, you can manually set %danickname to your nickname and %pk to your authtoken

/damn

to connect to damn

you are connected when you get a message such as:

Connection initialized

handshake done

errors:

Server authentication failed. (Username: xyxy Pk: xyxy)

means your authentication info is wrong. use /authtoken or manually set settings

/join channel

(only works when connected)

errors:

xyxy doesn't exist. (e=chatroom doesn't exist)

means the chatroom dosen't exist.

/me something

(only works in channel)

do the action command

whois

where: in the nicklist, select one or more nicknames, right click and select "whois"

returns user info

Source Code

alias curdamnchan {
  return @ $+ %damnchannel
}
alias damn {
  ;;;PREPARING VARS AND STUFF
  {
    window -c @damn
    ;;;CACHERESET
    damn-cachereset
    ;;;CHANNEL INFO RESET
    %damnchannel = damn
    ;;;CLOSE SOCKET
    sockclose damn
  }
  ;;;PREPARING INFO
  {
    window -e @damn @damn
    ;;window -el10S @damn @damn
    font @damn 12 tahoma
    sockopen damn jasper.deviantart.com 3900
    echo @damn 4Initializing jasper.deviantart.com:3900
    window -a @damn @damn
  }
}
on *:sockopen:damn:{
  if ($sockerr) { aline -a Error! | return }
  echo @damn 4Connection initialized
  ;;; HANDSHAKE
  sockwrite damn dAmnClient 0.1 $+ $lf | bset &null 1 0 | sockwrite damn &null
  echo @damn 4Sending handshake
  ;;; LOGIN INFO
  sockwrite damn login %danickname $+ $lf | sockwrite damn pk= $+ %pk $+ $lf | bset &null 1 0 | sockwrite damn &null
  echo @damn 4Sending login info ( $+ %danickname $+ : $+ %pk $+ )
}
on *:sockclose:damn:{
  ;write -c damndump.txt
  ;write -c damnlist.txt
  ;write -c damndump.ini
  echo @damn 4damn socket got closed.
}
alias setpk {
  %pk = $?="Pk?"
}
alias damncode {
  unset %dec
  bset &nul 1 0
  %dec = $replace($1-,\n,$chr(10),\t,$chr(09))
  return %dec
}
on *:sockread:damn:{
  ;On stock l'information dans la variable %a (qui est une variable global)
  :damnread
  sockread -f %a
  if (%a = property c) { %a = property chat:devart }
  if (%a = hat:devart) { %a = property chat:devart }
  %ba = %a $+ %b
  if ($sockbr == 0) { return }
  if (%a != $null) {
    ;echo @damn RECV: %a
    write -a damndump.txt %a
    write -a damndumpbinary &a
    parsetextformat %a
    parseicon %a
    parsedev %a
    parsethumb %a
    parseurl %a
    parseurl2 %a
    parseurl3 %a
    parsesmileys %a
    ;echo @damn PARSED: %a
    %a = $replace(%a,¤and¤,$chr(38))
    damnparse %a

  }
  goto damnread

}
alias parsetextformat {
  %a = $1-
  %a = $replace(%a,&b   ,)
  %a = $replace(%a,&/b  ,)
  %a = $replace(%a,&u   ,)
  %a = $replace(%a,&/u  ,)
  %a = $replace(%a,Ø,$chr(248))
  %a = $replace(%a,å,$chr(229))
  %a = $replace(%a,&,¤and¤)
  %a = $replace(%a,<,$chr(60))
  %a = $replace(%a,>,$chr(62))
  %a = $replace(%a,&i   ,")
  %a = $replace(%a,&/i  ,")
  %a = $remove(%a,&a;)
  %a = $remove(%a,&/a;)
  %a = $remove(%a,/a;)
}
alias parsethumb {
  %a = $1-
  if ($chr(38) $+ thumb !isin %a) { goto thumb-skip } 
  :thumb-redo 
  %rep = $right(%a,$calc($len(%a) - $pos(%a,&thumb) + 1))
  %rep = $left(%rep,$pos(%rep,$chr(9),8))
  %data = %rep
  %filter = &thumb $+ $chr(9) $+ £thumbnumber£ $+ $chr(9) $+ £thumbname£ $+ $chr(9) $+ £thumbusername£ $+ $chr(9) $+ £resolution£ $+ $chr(9) $+ £unknown£ $+ $chr(9) $+ £thumburl£ $+ $chr(9) $+ £stats£ $+ $chr(9) 
  parse
  %a = $replace(%a,%rep,$chr(91) $+ THUMB: %thumbname %resolution by %thumbusername - http://www.deviantart.com/view/ $+ %thumbnumber $+ $chr(93))
  if ($chr(38) $+ thumb isin %a) { goto thumb-redo }
  :thumb-skip
}
alias parseicon {
  %a = $1-
  if ($chr(38) $+ avatar !isin %a) { goto avatar-skip } 
  :avatar-redo 
  %rep = $right(%a,$calc($len(%a) - $pos(%a,&avatar) + 1))
  %rep = $left(%rep,$pos(%rep,$chr(9),3))
  %data = %rep
  %filter = &avatar $+ $chr(9) $+ £username£ $+ $chr(9) $+ £number£ $+ $chr(9)
  parse
  %a = $replace(%a,%rep,$chr(91) $+ Avatar $readini(damndump.ini,%username,symbol) $+ %username $+ : http://a.deviantart.com/avatars/ $+ $left(%username,1) $+ / $+ $right($left(%username,2),1) $+ / $+ %username $+ .gif $+ $chr(93))
  if ($chr(38) $+ avatar isin %a) { goto avatar-redo }
  :avatar-skip
  %lastavatar = http://a.deviantart.com/avatars/ $+ $left(%username,1) $+ / $+ $right($left(%username,2),1) $+ / $+ %username $+ .gif
}
alias parsedev {
  %a = $1-
  if ($chr(38) $+ dev !isin %a) { goto dev-skip } 
  :dev-redo 
  %rep = $right(%a,$calc($len(%a) - $pos(%a,&dev) + 1))
  %rep = $left(%rep,$pos(%rep,$chr(9),3))
  %data = %rep
  %filter = &dev $+ $chr(9) $+ £symbol£ $+ $chr(9) $+ £username£ $+ $chr(9)
  parse
  %a = $replace(%a,%rep,$chr(91) $+ %symbol $+ %username $+ : http:// $+ %username $+ .deviantart.com $+ $chr(93))
  if ($chr(38) $+ a isin %a) { goto dev-redo }
  :dev-skip
}
alias parseurl {
  %a = $1-
  %b = %a
  %a = %b
  if ($chr(38) $+ a !isin %a) { goto link-skip } 
  :link-redo 
  %rep = $right(%a,$calc($len(%a) - $pos(%a,&a) + 1))
  %rep = $left(%rep,$pos(%rep,$chr(9),4))
  %data = %rep
  %filter = &a $+ $chr(9) $+ £link£ $+ $chr(9) $+ $chr(9) $+ £linkname£&/a      
  parse
  %a = $replace(%a,%rep,$chr(91) $+ %linkname $+ : %link $+ $chr(93))
  if ($chr(38) $+ a isin %a) { goto link-redo }
  :link-skip
}
alias parseurl2 {
  %a = $1-
  if ($chr(38) $+ link !isin %a) { goto url-skip }
  :url-redo
  %rep = $right(%a,$calc($len(%a) - $pos(%a,&link) + 1))
  %rep = $left(%rep,$pos(%rep,$chr(9),4))
  %data = %rep
  %filter = &link $+ $chr(9) $+ £link£ $+ $chr(9) $+ £linkname£ $+ $chr(9) $+ & $+ $chr(9)
  parse
  %a = $replace(%a,%rep,$chr(91) $+ %linkname $+ : %link $+ $chr(93))
  if ($chr(38) $+ a isin %a) { goto url-redo }
  :url-skip
}
alias parseurl3 {
  %a = $1-
  if ($chr(38) $+ link !isin %a) { goto url-skip }
  :url-redo
  %rep = $right(%a,$calc($len(%a) - $pos(%a,&link) + 1))
  %rep = $left(%rep,$pos(%rep,$chr(9),3))
  %data = %rep
  %filter = &link $+ $chr(9) $+ £link£ $+ $chr(9) $+ & $+ $chr(9)
  parse
  %a = $replace(%a,%rep,$chr(91) $+ link $+ : %link $+ $chr(93))
  if ($chr(38) $+ a isin %a) { goto url-redo }
  :url-skip
}
alias damnparse {
  if ($gettok($1-,1,58) = property chat) %damnchannel = $gettok($1-,2,58)
  if ($gettok($1-,1,58) == recv chat) {
    %recvchat = $gettok($1-,2,58)
  }
  if ($1 == part) && (chat: !isin $2) { 
    echo @damn- $+ %recvchat $timestamp 3* $2 has left $chr(35) $+ %recvchat
    dline -l @damn- $+ %recvchat $fline(@damn- $+ %recvchat,$2,1,1)     
  }
  if ($1 == part) && (chat: isin $2) {
    echo @damn 4You have parted $chr(35) $+ $gettok($1-,2,58)
  }
  ;;;Messages 
  if ($1- == msg main) {
    %msg = on
  }
  if (%msg = on) {
    if (%msg-from != $null) {
      if (%msg-from !isin %daignored) {
        if (%msg-from isin $1-) echo @damn- $+ %recvchat $timestamp 4< $+ %msg-from $+ > $1-
        if (%msg-from !isin $1-) && (%msg-from !isin %dawatched) echo @damn- $+ %recvchat $timestamp < $+ %msg-from $+ > $1-
        if (%msg-from isin %dawatched) && (%msg-from !isin $1-) {
          echo @damn- $+ %recvchat $timestamp 12< $+ %msg-from $+ > $1-
        }
      }
      unset %msg
      unset %msg-from
    }
    if ($left($1-,5) = from=) {
      %msg-from = $gettok($1,2,61)
    }

  }
  ;;;Actions
  if ($1- == action main) {
    %action = on
  }
  if (%action = on) {
    if (%action-from != $null) {
      echo @damn- $+ %recvchat $timestamp 6* %action-from $1-
      unset %action
      unset %action-from
    }
    if ($left($1-,5) = from=) {
      %action-from = $gettok($1,2,61)
    }

  }
  ;;;PING
  if ($1 == ping) {
    ;bset &nul 1 0
    ;sockwrite -b damn $null
    ;echo @damn 4PING? PONG!
  }
  ;;;DAMNSERVER
  if ($1- == damnserver 0.1) {
    echo @damn 4Received handshake from the server
  }
  ;;;LOGIN xxxxxx
  if ($1- == login %danickname) {
    echo @damn 4Received login confirmation
    %login = true
  }
  ;;;JOING CHAT
  if ($1- = join chat: $+ %damnchannel) {
    echo @damn 4Received joinning confirmation
    %joinning = true
  }
  ;;;Errors
  ;;;;;E=
  if ($left($1,2) == e=) {
    ;;LOGIN ERRORS
    if (%login = true) {
      if ($1 == e=ok) {
        echo @damn 4Login successfull
        unset %login
      }
      if ($1- == e=authentication failed) {
        echo @damn 4Login failed (Wrong username/pk, update your info using /authtoken)
        sockclose @damn
        unset %login
      }
    }
    ;;JOIN ERRORS
    if (%joinning = true) {
      if ($1 == e=ok) {
        window -el10S @damn- $+ %damnchannel @damn- $+ %damnchannel
        font @damn- $+ %damnchannel  12 tahoma
        echo @damn- $+ %damnchannel 4Joinning %damnchannel successfull
        unset %joinning
      }
    }
  }
  ;;;JOINS
  if ($1 = join) && (%joinning = $null) && ($gettok($1-,1,58) != join chat) && ($numtok($1-,32) = 2) {
    %j = on
    %j-nick = $2
  }
  if (%j = on)  {
    If ($left($1,2) = pc) {
      writeini damndump.ini %j-nick pc $gettok($1,2,61)
    }
    if ($left($1,8) = usericon) {
      writeini damndump.ini %j-nick usericon $gettok($1,2,61)
    }
    if ($left($1,6) = symbol) {
      if ($gettok($1,2,61) == $chr(35)) { writeini damndump.ini %j-nick symbol $chr(35) | goto 11 }
      writeini damndump.ini %j symbol $gettok($1,2,61)
      :11
      %j-symbol = $gettok($1,2,61)
    }
    if ($left($1,1) = l) {
      if ($gettok($1,2,61) == $chr(35)) { writeini damndump.ini %j-nick symbol $chr(35) | goto 22 }
      if ($readini(damndump.ini,%member-nick,symbol) == $null) writeini damndump.ini %j-nick symbol $replace($gettok($1,2,61),$chr(35),$chr(35))
      :22
      %j-symbol = $gettok($1,2,61)
    }
    if ($left($1,8) = realname) {
      if ($right($1-,$calc($len($1-) - 9)) != $null) writeini damndump.ini %j-nick realname $right($1-,$calc($len($1-) - 9))
    }
    if ($left($1,8) = typename) {
      writeini damndump.ini %j-nick typename $right($1-,$calc($len($1-) - 9))
      ;aline -l @damn- $+ %damnchannel $readini(damndump.ini,%j-nick,symbol) $+ %j-nick
      if (%j-nick != $null) aline -l @damn- $+ %recvchat %j-nick
      echo @damn- $+ %recvchat $timestamp 3* %j-nick has joined $chr(35) $+ %recvchat
      unset %j
      unset %j-nick
    }
  }

  ;;;USERS

  if ($1 = member) && ($2 != $null) {
    %member = on
    %member-nick = $2
  }
  if (%member = on)  {
    If ($left($1,2) = pc) {
      writeini damndump.ini %member-nick pc $gettok($1,2,61)
    }
    if ($left($1,8) = usericon) {
      writeini damndump.ini %member-nick usericon $gettok($1,2,61)
    }
    if ($left($1,6) = symbol) {
      if ($gettok($1,2,61) == $chr(35)) { writeini damndump.ini %member-nick symbol $chr(35) | goto 1 }
      writeini damndump.ini %member-nick symbol $gettok($1,2,61)
      :1
      %member-symbol = $gettok($1,2,61)
    }
    if ($left($1,1) = l) {
      if ($gettok($1,2,61) == $chr(35)) { writeini damndump.ini %member-nick symbol $chr(35) | goto 2 }
      if ($readini(damndump.ini,%member-nick,symbol) == $null) writeini damndump.ini %member-nick symbol $replace($gettok($1,2,61),$chr(35),$chr(35))
      :2
      %member-symbol = $gettok($1,2,61)
    }
    if ($left($1,8) = realname) {
      if ($right($1-,$calc($len($1-) - 9)) != $null) writeini damndump.ini %member-nick realname $right($1-,$calc($len($1-) - 9))
    }
    if ($left($1,8) = typename) {
      writeini damndump.ini %member-nick typename $right($1-,$calc($len($1-) - 9))
      ;aline -l @damn- $+ %damnchannel $readini(damndump.ini,%member-nick,symbol) $+ %member-nick
      aline -l @damn- $+ %damnchannel %member-nick
      unset %member
      unset %member-nick
    }
  }

  ;;;PROPERTIES
  if ($left($1,2) == p=) {
    if ($1 = p=title) {
      if (%topic-content == $null) && (%topic-did != on) {
        echo @damn- $+ %damnchannel $timestamp 3* No topic set
        unset %topic
      }
      unset %topic-did
    }
    if ($1 = p=topic) {
      %topic = on
    }
  }
  if (%topic = on) {
    ;;echoes
    if (%topic-writer != $null) && (%topic-ts != $null) {
      set %topic-content $1-
      echo @damn- $+ %damnchannel $timestamp 3* Topic is ' $+ %topic-content $+ '
      echo @damn- $+ %damnchannel $timestamp 3* Set by %topic-writer on %topic-ts
      unset %topic-write
      unset %topic-ts
      unset %topic-content
      unset %topic
      %topic-did = on
    }
    ;;writer
    if ($left($1,3) = by=) {
      %topic-writer = $gettok($1,2,61)
    }
    ;;time
    if ($left($1,3) = ts=) {
      %topic-ts  = $asctime($gettok($1,2,61))
    }
  }
}
on *:close:@damn:{
  if (%exiting != true) {
    if ($portfree(3900) == $chr(36) $+ false) {
      ;damnexit
      echo -a 4closed damn socket due to window closure
      %conn = false
    }
  }
}
;alias damnexit {
;  if ($portfree(3900) == $chr(36) $+ false) {
;    sockclose damn
;  }
; %exiting = true
; :closeall 
; if ($window(@damn*,1) != $null) {
;   window -c $window(@damn*,1)
;   goto closeall
;  }
;  unset %exiting
;}
on *:close:@damn-*:{
  damnpart $gettok($target,2,45)
}
alias damnjoin { 
  dline -l @damn [1 $+ - $+ $line(@damn,0,1)]
  write -c damndump.txt
  %damnchannel = $remove($1,$chr(35))
  sockwrite damn join chat: $+ %damnchannel
  sockwrite damn $lf
  bset &null 1 0 
  sockwrite damn &null
  echo @damn 4Trying to join %damnchannel
  %conn = true
  halt
  haltdef
}
alias damnpart { 
  /window -c @damn- $+ $1
  write -c damndump.txt
  sockwrite damn part chat: $+ $1
  sockwrite damn $lf
  bset &null 1 0 
  sockwrite damn &null
  echo @damn 4Trying to join $1
  halt
  haltdef
}
alias parsesmileys {
  %a = $1-
  %b = %a
  %a = %b
  if ($chr(38) $+ emote !isin %a) { goto emote-skip }
  :emote-redo  
  %rep = $right(%a,$calc($len(%a) - $pos(%a,&) + 1))
  %rep = $left(%rep,$pos(%rep,$chr(9),6))
  %data = %rep
  %filter = &emote      £emotename£     £emotenumbers£  £emotemeaning£  £emotefile£
  parse
  %a = $replace(%a,%rep,%emotename)
  if ($chr(38) $+ emote isin %a) { goto emote-redo }
  :emote-skip
}
on *:input:@damn*:{
  if (/whois isin $1) {
    damnwhois $2
  }
  if ($1 == /w) {
    damnwhois $2
    hamt
  }
  if (/join isin $1) {
    damnjoin $2
  }
  if (/exit isin $1) {
    damnexit
    halt
  }
  if (/quit isin $1) {
    damnexit
    halt
  }
  if (/part isin $1) {
    damnpart $2
    halt
  }
  if ($1 == /me) {
    damnme $2-
    halt
  }
  if ($1 != me) && (($left($1,1) != /) && ($left($1,1) != $readini(mirc.ini,text,commandchar))) {
    sockwrite damn send chat: $+ $right($active,$calc($len($active) - 6)) $+ $lf $+ $lf $+ msg main $+ $lf $+ $lf $+ $1-
    bset &null 1 0 
    sockwrite damn &null
    halt
  }
}
alias damnmsg {
  sockwrite damn send chat: $+ $1 $+ $lf $+ $lf $+ msg main $+ $lf $+ $lf $+ $2-
  bset &null 1 0 
  sockwrite damn &null
  halt
}
alias damnme {
  sockwrite damn send chat: $+ $right($active,$calc($len($active) - 6)) $+ $lf $+ $lf $+ action main $+ $lf $+ $lf $+ $1-
  bset &null 1 0 
  sockwrite damn &null
}
menu @damn*,menubar {
  dAmn
  .authtoken:authtoken
  .connect:damn
  .join channel:/damnjoin $$?="Enter a channel to join:"
  -
  whois selected:damnwhois
  -
  slap:damnme slaps $sline($active,1) $sline($active,2) $sline($active,3) around a bit with a large trout
  -
  ads
  .add for damnIP:damnme is using rnx's irc client for damn available @ http://moeffju.net/w/dAmn/moin.cgi
  -

  control
  .watch
  ..add:%dawatched = %dawatched $sline($active,1)
  ..remove: %dawatched = $remove(%dawatched,$sline(@damn,1))
  .Ignore
  ..add:%daignored = %daignored $sline($active,1)
  ..remove: %daignored = $remove(%daignored,$sline(@damn,1))
}
menu channel {
  dAmn
  .authtoken:authtoken
  .connect:damn
  .join channel:/damnjoin $$?="Enter a channel to join:"
}
alias damnwhois {
  if ($sline($active,0) = 1) {
    damnwhois2 $sline($active,1)
  }
  if ($sline($active,0) > 1) {
    %a = 1
    while (%a <= $sline($active,0)) {
      damnwhois2 $sline($active,%a)
      inc %a
    }
  }
}
alias damnwhois2 {
  if ($1 != $null) {
    echo $active $readini(damndump.ini,$1,symbol) $+ $1 ( $+ $readini(damndump.ini,$1,realname) $+ )
    echo $active is an $readini(damndump.ini,$1,typename)
    echo $active is with the $readini(damndump.ini,$1,pc)
  }
}
dialog getauthtoken {
  title "GetAuthToken.mrc"
  size -1 -1 196 26
  option dbu
  edit "Username", 1, 1 4 79 10
  edit "Password", 2, 83 4 86 10, pass
  edit "", 3, 1 15 168 10, read
  button "Get", 4, 169 4 24 21, default
  button "Button", 5, 238 9 37 12, ok
}
alias authtoken {
  dialog -dm getauthtoken getauthtoken
}
alias getauthtokenwrite {
  sockwrite -n getauthtoken $1-
}
on *:dialog:getauthtoken:sclick:4:{
  if ($did(getauthtoken,1) == username) { halt }
  if ($did(getauthtoken,1) == $null) { halt }
  if ($did(getauthtoken,2) == password) { halt }
  if ($did(getauthtoken,2) == $null) { halt }
  unset %authtoken
  did -o getauthtoken 3 1 Connecting...
  %danickname = $did(getauthtoken,1)
  %dapass = $did(getauthtoken,2)
  sockclose getauthtoken
  sockopen getauthtoken www.deviantart.com 80
}
on *:sockopen:getauthtoken:{
  if ($sockerr > 0) { did -o getauthtoken 3 1 error }
  %payload = username= $+ %danickname $+ $chr(38) $+ password= $+ %dapass $+ $chr(38) $+ reusetoken=1
  %1 = $len(%payload)
  getauthtokenwrite POST /users/login HTTP/1.1
  getauthtokenwrite Host: www.deviantart.com
  getauthtokenwrite User-Agent: getauth.mrc/0.1
  getauthtokenwrite Accept: text/html
  getauthtokenwrite Cookie: skipintro=1
  getauthtokenwrite Content-Type: application/x-www-form-urlencoded
  getauthtokenwrite Content-Length: %1
  getauthtokenwrite $lf
  getauthtokenwrite %payload
  did -o getauthtoken 3 1 Sending HTTP header...
}
on *:sockread:getauthtoken:{
  sockread %a
  if (authtoken isin %a) {
    %a = $right(%a,$calc($len(%a) - 21))
    %a = $left(%a,$calc($pos(%a,;) - 1))
    %data = $replace(%a,$chr(37) $+ 3A,:,$chr(37) $+ 7b,$chr(123),$chr(37) $+ 22,$chr(34),$chr(37) $+ 3b,$chr(59),$chr(37) $+ 7D,$chr(125))
    %filter = a:6:{s:8:"uniqueid";s:32:"£uniqueid£";s:10:"visitcount";i:£visitcount£;s:9:"visittime";i:£visittime£;s:10:"firstvisit";i:£firstvisit£;s:8:"username";s:3:"£username£";s:9:"authtoken";s:32:"£authtoken£";}
    if ($parse = done) && (%authtoken != $null) {
      ;did -o getauthtoken 3 1 Token: %authtoken
      %pk = %authtoken
    }
    unset %a
  }
}
on *:sockclose:getauthtoken:{
  did -c getauthtoken 2
  unset %dapass
  unset %payload
  if (%authtoken != $null) {
    did -o getauthtoken 3 1 Token: %authtoken
  }
  else {
    did -o getauthtoken 3 1 E: make sure you entered correct username/passwd
  }
}
alias parse {
  %data-copy = %data
  %filter-copy = %filter
  if ($chr(163) isin %filter) && (%data != $null) && (%filter != $null) {
    :parse-redo
    %rem = $left(%filter,$calc($pos(%filter,£) - 1))
    %data = $right(%data,$calc($Len(%data) - $len(%rem)))
    %filter = $right(%filter,$calc($Len(%filter) - $len(%rem)))
    %var1 = $left(%filter,$pos(%filter,£,2))
    %var2 = $right($left($left(%filter,$pos(%filter,£,2)),$calc($len($left(%filter,$pos(%filter,£,2))) - 1)),$calc($len($left(%filter,$pos(%filter,£,2))) - 2))
    %var2 = $chr(37) $+ %var2
    %left = $right(%filter,$calc($len(%filter) - $len(%var1)))
    %leftd = $right(%data,$calc(1 + $len(%data) - $pos(%data,$left(%left,1))))
    [ set [ %var2 $left(%data,$calc($len(%data) - $len(%leftd))) ] ]
    %data = $right(%data,$len(%leftd))
    %filter = $right(%filter,$len(%left))
    if ($chr(163) isin %filter) goto parse-redo
  }
  unset %rem
  unset %var1
  unset %var2
  unset %left
  unset %leftd
  %data = %data-copy
  %filter = %filter-copy
  unset %data-copy
  unset %filter-copy
  return done
}
alias damn-cachereset {
  write -c damndump.txt
  write -c damndump.ini
  write -c damnlist.txt
  unset %damnchannel
  unset %dec
  unset %a
  unset %ba
  unset %rep
  unset %thumbname
  unset %resolution
  unset %thumbusername
  unset %thumbnumber
  unset %username
  unset %symbol
  unset %b
  unset %linkname
  unset %link
  unset %recvchat
  unset %msg
  unset %msg-from
  unset %action
  unset %action-from
  unset %login
  unset %joinning
  unset %j
  unset %j-nick
  unset %j-symbol
  unset %member-nick
  unset %member
  unset %member-symbol
  unset %topic-content
  unset %topic-did
  unset %topic
  unset %topic-writer
  unset %topic-ts
  unset %conn
  unset %emotename
}

BetaVersions

Beta 0.6

you need smilesview.dll in your mirc.exe directory

;;     damnecho windowname color text
alias damnecho {
  ;;  if dll exists */
  if (true isin $exists($mircdir $+ \dlls\ $+ dll $+ $window($1).hwnd $+ .dll)) { 
    dll " $+ $mircdir $+ \Dlls\ $+ dll $+ $window($1).hwnd $+ .dll" writeln <basefont color=" $+ $2 $+ " size=2 face=Tahoma Border="5"><span style="background-color: #BBC2BB"><br> $+ $3-
    window -g1 $1
  }
  ;;  error message saying dll dosen't exists */
  else { damnerror 1 " $+ $mircdir $+ \Dlls\ $+ dll $+ $window($1).hwnd $+ .dll" }
}


;;    damnerror errornumber additionalinformation
alias -l damnerror {
  if ($1 = 1) echo -s 4ERROR # $+ $1 $+ :The following dll does not exists: $2- (dAmn)
  if ($1 = 2) echo -s 4ERROR # $+ $1 $+ :Cannot find smilesview.dll in any of the mirc directory (dAmn)
  if ($1 = 3) echo -s 4ERROR # $+ $1 $+ :The following dll cannot be created: $2- $+ . Abording procedure. (dAmn)
  if ($1 = 4) echo -s 4ERROR # $+ $1 $+ :There was an error while connecting to jasper.deviantart.com:3900. Procedure was aborded. (dAmn)
  if ($1 = 5) echo -s 4ERROR # $+ $1 $+ :Deviant nickname not found. try /damnsettings. Procedure aborded. (dAmn)
  if ($1 = 6) echo -s 4ERROR # $+ $1 $+ :Deviant authorisation token not found. try /damnsettings. Procedure aborded. (dAmn)
  if ($1 = 7) echo -s 4ERROR # $+ $1 $+ :Damn is not connected or you tryed to send an empty/invalid message. (Message: $+ $2- $+ ) (dAmn)
}



alias damn {
  unset %b
  unset %a
  write -c damndump.txt
  if ($window(@damn)) { window -c @damn }
  sockclose damn
  if ($hget(damn)) { hfree damn }
  hmake damn 100
  if ($findfile($mircdir,smilesview.dll,0,50) > 0) { hadd damn smilesviewdll $findfile($mircdir,smilesview.dll,1) }
  else { damnerror 2 | halt }
  window -e @damn @damn
  if (!$exists($mircdirdlls)) { mkdir dlls }
  .copy -o " $+ $hget(damn,smilesviewdll) $+ " " $+ $mircdir $+ dlls/Dll $+ $window(@damn).hwnd  $+ .dll"
  if (true !isin $exists( $+ $mircdir $+ dlls/Dll $+ $window(@damn).hwnd  $+ .dll)) { damnerror 3 $mircdir $+ dlls/Dll $+ $window(@damn).hwnd  $+ .dll | halt }
  ;;  Attach procedure
  dll " $+ $mircdir $+ dlls/Dll $+ $window(@damn).hwnd $+ .dll" attach $window(@damn).hwnd
  dll " $+ $mircdir $+ dlls/Dll $+ $window(@damn).hwnd $+ .dll" navigate about:blank
  dll " $+ $mircdir $+ dlls/dll $+ $window(@damn).hwnd $+ .dll" writeln <body bgcolor="#BBC2BB">
  ;; Connect socket 
  getauth $1 $2
}
on *:sockopen:damn:{
  if ($sockerr) { damnerror 4 | return }
  damnecho @damn blue $timestamp * Connection initialized
  sockwrite damn dAmnClient 0.2 $+ $lf $+ agent= $+ nrx $+ $lf | bset &null 1 0 | sockwrite damn &null
  damnecho @damn blue $timestamp * Sending handshake
  var %login = $gettok($sock($sockname).mark,2,32)
  var %auth = $gettok($sock($sockname).mark,1,32)
  if (!%login) { damnerror 5 | sockclose damn | return }
  if (!%auth) { damnerror 6 | sockclose damn | return }
  sockwrite damn login %login $+ $lf | sockwrite damn pk= $+ %auth $+ $lf | bset &null 1 0 | sockwrite damn &null
  damnecho @damn blue $timestamp * Sending login info ( $+ %login $+ : $+ %auth $+ )
}
on *:sockread:damn:{
  :damnread
  if (%b) && (%a) { %b = %b $+ $chr(2) $+ %a }
  if (!%b) && (%a) { %b = %a }  
  sockread -f %a
  if (!%a) { 
    %c = %b
    if (%debug) {
      damnecho @damn green %c 
      write -a damndump.txt %c
    }
    :recheck
    if ($regex(%c,&((?:[^       \&]+    +)|(?:  ))) >= 1) {
      %a = 0
      while (%a <= $regml(0)) {
        if (%debug) {
          damnecho @damn blue Tablump found: $regml(%a)
          write -a damndump.txt Tablump found: $regml(%a)

        }
        damn_tablumps %a
        inc %a
      }
      if (%debug) {
        damnecho @damn blue Tablumps were in: %c
        write -a damndump.txt Tablumps were in: %c
      }
      goto recheck
    }
    unset %b
    unset %a
    damn_exec %c
  }
  if ($sockbr == 0) { return }
  goto damnread
}
alias -l damn_tablumps {
  var %tablump_style = $left($regml($1),$calc($len($regml($1)) - 1))
  if (%tablump_style = dev) {
    var %tablump_whole = $right(%c,$calc($len(%c) - $calc($regml($1).pos) + 2))
    var %tablump_whole = $left(%tablump_whole,$pos(%tablump_whole,$chr(9),3))
    %c = $replace(%c,%tablump_whole,<a href="http:// $+ $gettok(%tablump_whole,3,9) $+ .deviantart.com" target="_blank"> $+ $gettok(%tablump_whole,2,9) $+ $gettok(%tablump_whole,3,9) $+ </a>)
  }
  if (%tablump_style = emote) {
    var %tablump_whole = $right(%c,$calc($len(%c) - $calc($regml($1).pos) + 2))
    var %tablump_whole = $left(%tablump_whole,$pos(%tablump_whole,$chr(9),6))
    %c = $replace(%c,%tablump_whole,<img src="http://e.deviantart.com/emoticons/ $+ $gettok(%tablump_whole,6,9) $+ " width=" $+ $gettok(%tablump_whole,3,9) $+  " height=" $+ $gettok(%tablump_whole,4,9) $+  " alt=" $+ $gettok(%tablump_whole,2,9) $+  " title=" $+ $gettok(%tablump_whole,5,9) $+ " />)
  }
  if (%tablump_style = link) {
    var %tablump_whole = $right(%c,$calc($len(%c) - $calc($regml($1).pos) + 2))
    var %a = 1
    while ($right($left(%tablump_whole,$calc($pos(%tablump_whole,&,%a) + 1)),1) != $chr(9)) {
      inc %a
    }
    %tablump_whole = $left(%tablump_whole,$calc($pos(%tablump_whole,&,%a) + 1))
    if ($numtok(%tablump_whole,9) = 4) %c = $replace(%c,%tablump_whole,<a href=" $+ $gettok(%tablump_whole,2,9) $+ " target="_blank"> $+ $gettok(%tablump_whole,3,9) $+ </a>)
    if ($numtok(%tablump_whole,9) = 3) %c = $replace(%c,%tablump_whole,<a href=" $+ $gettok(%tablump_whole,2,9) $+ " target="_blank"> $+ $gettok(%tablump_whole,2,9) $+ </a>)
  }
  if (%tablump_style = avatar) {
    var %tablump_whole = $right(%c,$calc($len(%c) - $calc($regml($1).pos) + 2))
    var %tablump_whole = $left(%tablump_whole,$pos(%tablump_whole,$chr(9),3))
    if ($gettok(%tablump_whole,3,9) == 0) %c = $replace(%c,%tablump_whole,<a href="http:// $+ $gettok(%tablump_whole,2,9) $+ .deviantart.com/"><img src="http://a.deviantart.com/avatars/default.gif" width="50" height="50" alt=" $+ $gettok(%tablump_whole,2,9) $+ " title=" $+ $gettok(%tablump_whole,2,9) $+ " /></a>)
    if ($gettok(%tablump_whole,3,9) == 1) %c = $replace(%c,%tablump_whole,<a href="http:// $+ $gettok(%tablump_whole,2,9) $+ .deviantart.com/"><img src="http://a.deviantart.com/avatars/ $+ $left( $+ $gettok(%tablump_whole,2,9) $+,1) $+ / $+ $right($left( $+ $gettok(%tablump_whole,2,9) $+,2),1) $+ / $+  $+ $gettok(%tablump_whole,2,9) $+ $+ .gif" width="50" height="50" alt=" $+  $+ $gettok(%tablump_whole,2,9) $+ $+ " title=" $+ $gettok(%tablump_whole,2,9) $+ " /></a>)
  }
  if (%tablump_style = thumb) {
    var %tablump_whole = $right(%c,$calc($len(%c) - $calc($regml($1).pos) + 2))
    var %tablump_whole = $left(%tablump_whole,$pos(%tablump_whole,$chr(9),8))
    if (: !isin $gettok(%tablump_whole,7,9)) %c = $replace(%c,%tablump_whole,<a href="http://http://www.deviantart.com/view/ $+ $gettok(%tablump_whole,2,9) $+ " target="_blank"><img src="http://tn $+ $gettok(%tablump_whole,6,9) $+ .deviantart.com/100/ $+ $replace($gettok(%tablump_whole,7,9),:,.deviantart.com/) $+ " title=" $+ $gettok(%tablump_whole,3,9) by $gettok(%tablump_whole,4,9) $gettok(%tablump_whole,5,9) $+ " ></a>)
    if (: isin $gettok(%tablump_whole,7,9)) %c = $replace(%c,%tablump_whole,<a href="http://http://www.deviantart.com/view/ $+ $gettok(%tablump_whole,2,9) $+ " target="_blank"><img src="http:// $+ $replace($gettok(%tablump_whole,7,9),:,.deviantart.com/) $+ " title=" $+ $gettok(%tablump_whole,3,9) by $gettok(%tablump_whole,4,9) $gettok(%tablump_whole,5,9) $+ " ></a>)
  }
  if (%tablump_style = a) {
    var %tablump_whole = $right(%c,$calc($len(%c) - $calc($regml($1).pos) + 2))
    var %tablump_whole = $left(%tablump_whole,$pos(%tablump_whole,$chr(9),4))
    %c = $replace(%c,%tablump_whole,<a href=" $+ $gettok(%tablump_whole,2,9) $+ " target="_blank"> $+ $remove($gettok(%tablump_whole,4,9),&/a) $+ </a>)
  }
  if (%tablump_style = b) {
    %c = $replace(%c,&b ,<b>,&/b        ,</b>)
  }
  if (%tablump_style = i) {
    %c = $replace(%c,&i ,<i>,&/i        ,</i>)
  }
  if (%tablump_style = u) {
    %c = $replace(%c,&u ,<u>,&/u        ,</u>)
  }
  if (%tablump_style = s) {
    %c = $replace(%c,&s ,<s>,&/s        ,</s>)
  }
  if (%tablump_style = sub) {
    %c = $replace(%c,&sub       ,<sub>,&/sub    ,</sub>)
  } 
  if (%tablump_style = sup) {
    %c = $replace(%c,&sup       ,<sup>,&/sup    ,</sup>)
  }
  if (%tablump_style = code) {
    %c = $replace(%c,&code      ,<code>,&/code  ,</code>)
  }
  %c = $replace(%c,&br,<br>)
}

alias -l damn_exec {
  if (!$1) { return }
  if (%topicst = true) {
    damnecho @damn- $+ %topicds green $timestamp * %topicwr changes topic to: " $+ $1- $+ "
    unset %topicst %topicwr %topicds %topicwr
  }

  if ($1 == property) && ($window(@damn- $+ $gettok($gettok($1-,1,2),2,58)).hwnd != $null) {
    if ($gettok($1-,2,2) == p=topic) {
      %topicds = $gettok($gettok($1-,1,2),2,58)
      %topicwr = $gettok($gettok($1-,3,2),2,61)
      %topicts = $gettok($gettok($1-,4,2),2,61)
      %topicst = true
    }
  }
  if ($gettok($1-,1,58) == recv chat) {
    hadd damn channeljoin $gettok($1-,2,58)
    unset %property_*
  }
  if (%writer) {
    damnecho @damn- $+ $hget(damn,channeljoin) black $timestamp &lt; $+ %writer $+ &gt; $1-
    unset %writer
  }
  if (%action) {
    damnecho @damn- $+ $hget(damn,channeljoin) black $timestamp * %action $1-
    unset %action
  }
  if ($1 == join) && (chat: !isin $2) {
    %join = on
    %member = $2
  }
  if ($1 == ping) {
    if (%hidepingpong) damnecho @damn green $timestamp * Ping? Pong!
    bset &null 1 0
    sockwrite damn pong $+ $chr(10)
    sockwrite damn &null
  }
  if ($1 == part) && ($numtok($1-,32) = 2) && ($2 != $gettok($sock(damn).mark,2,32)) && ($window(@damn- $+ $gettok($gettok($1-,1,2),2,58)).hwnd == $null) {
    dline -l @damn- $+ $hget(damn,channeljoin) $fline(@damn- $+ $hget(damn,channeljoin),$2,1,1)
    damnecho @damn- $+ $hget(damn,channeljoin) green $timestamp * $2 has left $chr(35) $+ $hget(damn,channeljoin)
  } 
  if ($1 == part) && ($window(@damn- $+ $gettok($gettok($1-,1,2),2,58)).hwnd != $null) {
    if ($gettok($1-,2,2) == e=ok) {
      close -@ @damn- $+ $gettok($gettok($1-,1,2),2,58)
      damnecho @damn green $timestamp * You have left $chr(35) $+ $gettok($gettok($1-,1,2),2,58)
    }
  }
  if (pc isin $1-) && (usericon isin $1-) && (symbol isin $1-) && (%join = on) {
    damn-member member %member $+ $chr(2) $+ $1-
    aline -l @damn- $+ $hget(damn,channeljoin)) %member
    damnecho @damn- $+ $hget(damn,channeljoin)) green $timestamp * %member has joined $chr(35) $+ $hget(damn,channeljoin)
    unset %join %member
  }
  if ($1- == damnserver 0.1) { damnecho @damn blue $timestamp * Connection confirmed. }
  if ($gettok($1-,1,2) == login $gettok($sock(damn).mark,2,32)) { 
    if ($gettok($1-,2,2) == e=ok) { damnecho @damn blue $timestamp * Login confirmed. }
    if ($gettok($1-,2,2) == e=authentication failed) { damnecho @damn red $timestamp * Login rejected. Update login information. }
  }
  if ($gettok($1-,1,2) == join chat: $+ $hget(damn,channeljoin)) {
    if ($gettok($1-,2,2) == e=ok) { damnecho @damn green $timestamp * Joinning $chr(35) $+ $hget(damn,channeljoin) | damn-pop $hget(damn,channeljoin) }
    if ($gettok($1-,2,2) == e=already joined) { damnecho @damn blue $timestamp * Can't join $chr(35) $+ $hget(damn,channeljoin) (Already joined) }
    if ($gettok($1-,2,2) == e=chatroom doesn't exist) { damnecho @damn blue $timestamp * Can't join $chr(35) $+ $hget(damn,channeljoin) (Channel dosen't exist) }
  }
  if ($gettok($1-,1,2) == property chat: $+ $hget(damn,channeljoin)) {
    %property = on
    %topic-writer = $gettok($gettok($1-,3,2),2,61)
    %topic-timestamp = $asctime($gettok($gettok($1-,4,2),2,61))
  }
  if ($gettok($1-,1,2) == p=topic) && ($numtok($1-,2) == 3) {
    %property = on
    %topic-writer = $gettok($gettok($1-,2,2),2,61)
    %topic-timestamp = $asctime($gettok($gettok($1-,3,2),2,61))
  }
  if ($gettok($1-,1,2) == property userinfo) {
    %property_userinfo = on
    %property_user = $gettok($gettok($1-,2,2),2,61)
  }
  if (%property_userinfo == on) {
    if (usericon isin $1-) && (symbol isin $1-) && ($numtok($1-,2) == 5) {
      ;usericon=1symbol=*realname=knows.typename=Wise Assgpc=guest 
      damnecho $active blue $timestamp ====================
      damnecho $active blue $timestamp Whois: $gettok($gettok($1-,2,2),2,61) $+ %property_user ( $+ $gettok($gettok($1-,3,2),2,61) $+ ) - $gettok($gettok($1-,4,2),2,61)
      damnecho $active blue $timestamp Global: $gettok($gettok($1-,5,2),2,61)
    }
    if (conn isin $1-) && (login isin $1-) && (active isin $1-) && ($numtok($1-,2) == 3) && (%property_login != done) {
      damnecho $active blue $timestamp Login info: Logged in $duration($calc($CTIME - $gettok($gettok($1-,2,2),2,61)))) ago $+ , Last action: $duration($calc($CTIME - $gettok($gettok($1-,3,2),2,61)))) ago
      %property_login = done
      .timer -m 1 100 unset %property_*
    }
    if (ns chat isin $1-) {
      damnecho $active blue $timestamp Is in: $gettok($1-,2,58)
    }
  }
  if ($gettok($1-,1,2) == msg main) && ($numtok($1-,2) = 2) {
    %writer = $gettok($gettok($1-,2,2),2,61)
  }
  if ($gettok($1-,1,2) == action main) && ($numtok($1-,2) = 2) {
    %action = $gettok($gettok($1-,2,2),2,61)
  }
  if (%property = on) {
    if (p=title = $gettok($1-,2,2)) {
      damnecho @damn- $+ $hget(damn,channeljoin)) green $timestamp * Topic is " $+ $gettok($1-,1,2) $+ "
      damnecho @damn- $+ $hget(damn,channeljoin)) green $timestamp * Set by %topic-writer on %topic-timestamp
      unset %topic-writer
      unset %topic-timestamp
    }
    if (p=title = $gettok($1-,1,2)) {
      damnecho @damn- $+ $hget(damn,channeljoin) green $timestamp * No topic set
      unset %topic-writer
      unset %topic-timestamp
    }
    if ($gettok($gettok($1-,1,2),1,32) == member) {
      damn-member $1-
      aline -l @damn- $+ $hget(damn,channeljoin) %member | unset %member
    }
  }
  if ($1 == set) && ($window(@damn- $+ $gettok($gettok($1-,1,2),2,58)).hwnd != $null) {
    if ($gettok($1-,2,2) == p=topic) {
      if ($gettoK($1-,3,2) == e=not privileged) {
        damnecho @damn- $+ $gettok($gettok($1-,1,2),2,58) green $timestamp * You cannot set Topic here. You are not priviledged.
      }
    }
  }
  if ($1 == privchg) && (by isin $gettok($1-,2,2)) && (pc isin $gettok($1-,3,2)) {
    if ($gettok($gettok($1-,3,2),2,61) == banned) {
      damnecho @damn- $+ $hget(damn,channeljoin) green $timestamp $gettok($gettok($1-,2,2),2,61) sets mode: +b $gettok($gettok($1-,1,2),2,32)
    }
    else {
      damnecho @damn- $+ $hget(damn,channeljoin) green $timestamp $gettok($gettok($1-,2,2),2,61) has priviledged $gettok($gettok($1-,1,2),2,32) to $gettok($gettok($1-,3,2),2,61)
    }
    writeini damndump.ini $gettok($gettok($1-,1,2),2,32) pc $+ $hget(damn,channeljoin) $gettok($gettok($1-,3,2),2,61)
  }
  if ($1 == kicked) && ($window(@damn- $+ $gettok($gettok($1-,1,2),2,58)).hwnd != $null) {
    close -@ @damn- $+ $gettok($gettok($1-,1,2),2,58)
    damnecho @damn green $timestamp * You where kicked from $chr(35) $+ $gettok($gettok($1-,1,2),2,58) by $gettok($gettok($1-,2,2),2,61)
  }
  if ($1 == kick) && ($window(@damn- $+ $gettok($gettok($1-,1,2),2,58)).hwnd != $null) && (u= isin $gettok($1-,2,2)) {
    if ($gettok($1-,3,2) == e=not privileged) {
      damnecho @damn green $timestamp * Cannot kick 
    }
  }
}
alias -l damn-member { 
  %member = $gettok($gettok($1-,1,2),2,32)
  writeini damndump.ini %member pc $+ $hget(damn,channeljoin) $gettok($gettok($1-,2,2),2,61)
  writeini damndump.ini %member usericon $gettok($gettok($1-,3,2),2,61)
  writeini damndump.ini %member symbol $gettok($gettok($1-,4,2),2,61)
  writeini damndump.ini %member realname $gettok($gettok($1-,5,2),2,61)
  writeini damndump.ini %member typename $gettok($gettok($1-,6,2),2,61)
}
alias -l damn-pop {
  window -del10S @damn- $+ $1 @damn- $+ $1
  if (!$exists($mircdirdlls)) { mkdir dlls }
  .copy -o " $+ $hget(damn,smilesviewdll) $+ " " $+ $mircdir $+ dlls/Dll $+ $window(@damn- $+ $1).hwnd  $+ .dll"
  if (true !isin $exists( $+ $mircdir $+ dlls/Dll $+ $window(@damn- $+ $1).hwnd  $+ .dll)) { damnerror 3 $mircdir $+ dlls/Dll $+ $window(@damn- $+ $1).hwnd  $+ .dll | halt }
  dll " $+ $mircdir $+ dlls/Dll $+ $window(@damn- $+ $1).hwnd $+ .dll" attach $window(@damn- $+ $1).hwnd
  dll " $+ $mircdir $+ dlls/Dll $+ $window(@damn- $+ $1).hwnd $+ .dll" navigate about:blank
  dll " $+ $mircdir $+ dlls/Dll $+ $window(@damn- $+ $1).hwnd $+ .dll" writeln <body bgcolor="#BBC2BB">
  font @damn- $+ $1  12 tahoma
  damnecho @damn- $+ $1 green $timestamp * Now talking in $chr(35) $+ $1
}
alias whois {
  if (@damn isin $active) {
    if ($1 != $null) {
      sockwrite damn get userinfo $+ $Lf $+ p= $+ $1 $+ $lf
      bset &null 1 0
      sockwrite damn &null
      damnecho $active blue $timestamp * Retrieving information about $1 $+ ...
    }
  }
}
alias join {
  if (@damn isin $active) {
    damnecho @damn blue $timestamp * Trying to join $chr(35) $+ $remove($1,$chr(35)) $+ ...
    hadd damn channeljoin $remove($1,$chr(35))
    sockwrite damn join chat: $+ $remove($1,$chr(35)) | sockwrite damn $lf | bset &null 1 0 | sockwrite damn &null
  }
}
alias me {
  if (@damn- isin $active) {
    sockwrite damn send chat: $+ $right($active,$calc($len($active) - 6)) $+ $lf $+ $lf $+ action main $+ $lf $+ $lf $+ $1-
    bset &null 1 0 
    sockwrite damn &null
    halt
  }
}
alias promote {
  if (@damn- isin $active) {
    sockwrite damn send chat: $+ $right($active,$calc($len($active) - 6)) $+ $lf $+ $lf
    sockwrite damn promote $1 $+ $lf $+ $lf $+ $2
    bset &null 1 0
    sockwrite damn &null
  }
}
alias demote {
  if (@damn- isin $active) {
    sockwrite damn send chat: $+ $right($active,$calc($len($active) - 6)) $+ $lf $+ $lf
    sockwrite damn demote $1 $+ $lf $+ $lf $+ $2
    bset &null 1 0
    sockwrite damn &null
  }
}
alias topic {
  if (@damn- isin $active) {
    sockwrite damn set chat: $+ $right($active,$calc($len($active) - 6)) $+ $lf
    sockwrite damn p=topic $+ $lf $+ $lf $+ $1-
    bset &null 1 0
    sockwrite damn &null
  }
}
alias kick {
  if (@damn- isin $active) {
    if ($2 != $null) {
      sockwrite damn kick chat: $+ $right($active,$calc($len($active) - 6)) $+ $lf
      sockwrite damn u= $+ $1 $+ $lf $+ $lf $+ $2-
      bset &null 1 0
      sockwrite damn &null
    }
  }
}
alias clean {
  if (@damn isin $active) {
    dll " $+ $mircdir $+ dlls/Dll $+ $window($active).hwnd $+ .dll" navigate about:blank
    dll " $+ $mircdir $+ dlls/dll $+ $window($active).hwnd $+ .dll" writeln </body>
    dll " $+ $mircdir $+ dlls/dll $+ $window($active).hwnd $+ .dll" writeln <body bgcolor="#BBC2BB">
    .timer -m 1 40 damn_clear $active
  }
}
alias damn_clear {
  dll " $+ $mircdir $+ dlls/dll $+ $window($1).hwnd $+ .dll" writeln </body>
  dll " $+ $mircdir $+ dlls/dll $+ $window($1).hwnd $+ .dll" writeln <body bgcolor="#BBC2BB">
  damnecho $1 black $timestamp * Cleared cache
}
alias part {
  if (@damn- isin $active) && ($2 == $null) {
    if ($sock(damn) != $null) { sockwrite damn part chat: $+ $right($active,$calc($len($active) - 6)) | sockwrite damn $lf | bset &null 1 0 | sockwrite damn &null }
    damnecho @damn green $timestamp * You have left $chr(35) $+ $+ $right($active,$calc($len($active) - 6))
  }
  if (@damn == $active) && ($2 == $null) {
    sockclose damn
  }
  if ($2 != $null) && ($window(@damn- $+ $2).hwnd != $null) {
    if ($sock(damn) != $null) { sockwrite damn part chat: $+ $2 | sockwrite damn $lf | bset &null 1 0 | sockwrite damn &null }
    damnecho @damn green $timestamp * You have left $chr(35) $+ $2
  }
}
on *:close:@damn-*:{
  if ($sock(damn) != $null) { sockwrite damn part chat: $+ $gettok($target,2,45) | sockwrite damn $lf | bset &null 1 0 | sockwrite damn &null }
  damnecho @damn green $timestamp * You have left $chr(35) $+ $gettok($target,2,45)
}
on *:close:@damn:{
  sockclose damn
}
on *:input:@damn-*:{
  if ($left($1-,1) != /) {
    if ($sock(damn) != $null) {
      sockwrite damn send chat: $+ $right($active,$calc($len($active) - 6)) $+ $lf $+ $lf $+ msg main $+ $lf $+ $lf $+ $1-
      bset &null 1 0 
      sockwrite damn &null
      halt
    }
    else { 
      damn-error 7 $1-
    }
  }
}



;;                 Damn-Theme
;;                 $damncommand(file,command)
alias damncommand {
  if (false isin $exists($1)) { return }
  if (true isin $exists($1)) {
    %command_lines = $read($1, s, $2)
    if (!%command_lines) { return }
    %command_start = $gettok(%command_lines,1,45)
    %command_end = $gettok(%command_lines,2,45)
    %a = %command_start
    while (%a <= %command_end) {
      [ $read($1, %a) ]
      inc %a
    }
    return done
  }
}
;;                 $damnconfirm(file)
alias damnconfirm {
  if (!$1) { return }
  if (false isin $exists($1)) { return }
  if ($1) {
    if ($read($1,1) == SDamnTH) { return true }
    else { return false }
  }
}

;;                 PARSE                     
alias parse {
  var %data, %filter
  set %data $chr(37) $+ $1
  [ set %data [ [ %data ] ] ]
  set %filter $chr(37) $+ $2
  [ set %filter [ [ %filter ] ] ]
  var %data-copy = %data
  var %filter-copy = %filter
  if ($chr(163) isin %filter) && (%data != $null) && (%filter != $null) {
    :parse-redo
    var %rem = $left(%filter,$calc($pos(%filter,£) - 1))
    %data = $right(%data,$calc($Len(%data) - $len(%rem)))
    %filter = $right(%filter,$calc($Len(%filter) - $len(%rem)))
    var %var1 = $left(%filter,$pos(%filter,£,2))
    var %var2 = $right($left($left(%filter,$pos(%filter,£,2)),$calc($len($left(%filter,$pos(%filter,£,2))) - 1)),$calc($len($left(%filter,$pos(%filter,£,2))) - 2))
    %var2 = $chr(37) $+ parsed_ $+ %var2
    .timer -m 1 500 unset [ %var2 ]
    var %left = $right(%filter,$calc($len(%filter) - $len(%var1)))
    var %leftd = $right(%data,$calc(1 + $len(%data) - $pos(%data,$left(%left,1))))
    [ set [ %var2 ] $left(%data,$calc($len(%data) - $len(%leftd))) ]
    %data = $right(%data,$len(%leftd))
    %filter = $right(%filter,$len(%left))
    if ($chr(163) isin %filter) goto parse-redo
  }
  unset %rem %var1 %var2 %left %leftd
  var %var3
  %var3 = $chr(37) $+ parsed_ $+ $3
  %data = %data-copy
  %filter = %filter-copy
  set %var3 [ [ %var3 ] ]
  if (%var3) //return %var3
  else return invalid
}
;;                       GET AUTHTOKEN                  
alias getauthtokenwrite {
  sockwrite -n getauthtoken $1-
}
alias getauth {
  damnecho @damn blue $timestamp * Connecting...
  %danickname = $1
  %dapass = $2
  sockclose getauthtoken
  sockopen getauthtoken www.deviantart.com 80
}
on *:sockopen:getauthtoken:{
  if ($sockerr) { echo -a Sock error in getting autorisation | unset %danickname | unset %dapass | return }
  var %payload = username= $+ %danickname $+ $chr(38) $+ password= $+ %dapass $+ $chr(38) $+ reusetoken=1
  unset %dapass
  var %1 = $len(%payload)
  getauthtokenwrite POST /users/login HTTP/1.1
  getauthtokenwrite Host: www.deviantart.com
  getauthtokenwrite User-Agent: getauth.mrc/0.1
  getauthtokenwrite Accept: text/html
  getauthtokenwrite Cookie: skipintro=1
  getauthtokenwrite Content-Type: application/x-www-form-urlencoded
  getauthtokenwrite Content-Length: %1
  getauthtokenwrite $lf
  getauthtokenwrite %payload
  damnecho @damn blue $timestamp * Posting login...
}
on *:sockread:getauthtoken:{
  var %a
  sockread %a
  if (authtoken isin %a) {
    %a = $right(%a,$calc($len(%a) - 21))
    %a = $left(%a,$calc($pos(%a,;) - 1))
    %arr = $replace(%a,$chr(37) $+ 3A,:,$chr(37) $+ 7b,$chr(123),$chr(37) $+ 22,$chr(34),$chr(37) $+ 3b,$chr(59),$chr(37) $+ 7D,$chr(125))
    %arrr = a:6:{s:8:"uniqueid";s:32:"£uniqueid£";s:10:"visitcount";i:£visitcount£;s:9:"visittime";i:£visittime£;s:10:"firstvisit";i:£firstvisit£;s:8:"username";s:3:"£username£";s:9:"authtoken";s:32:"£authtoken£";}
    sockopen damn jasper.deviantart.com 3900
    sockmark damn $parse(arr,arrr,authtoken) %danickname
    unset %arr
    unset %arrr
    unset %danickname
    damnecho @damn blue $timestamp * Connecting to jasper.deviantart.com (3900)
    set %correct true
  }
}
on *:sockclose:getauthtoken:{
  if (%correct != true) {
    damnecho @damn blue $timestamp * Error in login. (wrong username or password)
  }
  unset %correct
}

2013-03-28 12:59