All pastes #168691 Raw Edit

Someone

public text v1 · immutable
·published 2006-09-13 06:03 UTC
rendered paste body
alias AltInfo dialog $iif($dialog(AltInfo),-v,-m) AltInfo AltInfo

dialog -l AltInfo {
  title "Altscripts info dialog"
  size -1 -1 150 160
  option dbu

  tab "Recent Posts", 1, 0 0 149 139
  text "Currently viewing post:", 2, 4 19 59 8, tab 1
  text "", 3, 64 19 25 8, tab 1
  text "", 4, 4 27 142 4, tab 1
  text "Id:", 5, 4 34 35 8, tab 1
  edit "", 6, 40 33 105 10, tab 1 readonly autohs
  text "Time:", 7, 4 44 35 8, tab 1
  edit "", 8, 40 43 105 10, tab 1 readonly autohs
  text "Subject:", 9, 4 54 35 8, tab 1
  edit "", 10, 40 53 105 10, tab 1 readonly autohs
  text "Link:", 11, 4 64 35 8, tab 1
  edit "", 12, 40 63 105 10, tab 1 readonly autohs
  text "Poster:", 13, 4 74 35 8, tab 1
  edit "", 14, 40 73 105 10, tab 1 readonly autohs
  text "Topic:", 15, 4 84 35 8, tab 1
  edit "", 16, 40 83 105 10, tab 1 readonly autohs
  text "Topic Starter:", 17, 4 94 35 8, tab 1
  edit "", 18, 40 93 105 10, tab 1 readonly autohs
  text "Board:", 19, 4 104 35 8, tab 1
  edit "", 20, 40 103 105 10, tab 1 readonly autohs
  link "View Body of post", 21, 45 114 47 8, tab 1
  button "Previous", 22, 3 125 37 12, tab 1
  button "Go To...", 23, 57 125 37 12, tab 1
  button "Next", 24, 109 125 37 12, tab 1


  button "Refresh", 36, 4 143 37 15
  button "Close", 37, 110 143 37 15, ok
}


on *:dialog:AltInfo:init:*: {
  did -a $dname 4 $str(-,75)
}

on *:dialog:AltInfo:sclick:*: {
  ;  echo -a $did
  if ($did == 1) SetVars Recent limit $iif($did(3) isnum 5-255,$did(3),5)
  elseif ($did == 5) SetVars News limit $iif($did(7) isnum 1-,$did(3),5)
  elseif ($did == 9) SetVars Members limit $iif($did(7) isnum 1-,$did(3),5)
  elseif ($did == 13) SetVars Profile u $iif($did(7) isnum 1-,$did(3),1)
  elseif ($did == 36) sockopen AltInfo altscripts.trap17.com 80

  elseif ($did == 22) {
    var %current = $gettok($did(3),1,47), %total = $gettok($did(3),2,47)
    if (%current == 1) ViewPost %total
    else ViewPost $calc(%current - 1)
  }
  elseif ($did == 23) {
    var %post = $$?="What number post do you want to view?"
    if (%post > 0) && (%post <= %total) Viewpost %post
    else var %x = $input(Error: Invalid post number,oh,Error)
  }
  elseif ($did == 24) {
    var %current = $gettok($did(3),1,47), %total = $gettok($did(3),2,47)
    if (%current == %total) ViewPost 1
    else ViewPost $calc(%current + 1)
  }
}
alias -l ViewPost {
  var -s %data = $hget(Posts,$1), %dname = AltInfo, %post = $1
  tokenize 164 %data

  did -ra %dname 3 $+(%post,/,$hget(Posts,0).item)
  did -ra %dname 6 $2
  did -ra %dname 8 $1
  did -ra %dname 10 $3
  did -ra %dname 12 / $+ $gettok($8,4-,47)
  did -ra %dname 14 $5
  did -ra %dname 16 $6
  did -ra %dname 18 $4
  did -ra %dname 20 $7
}
alias SetVars {
  set %AltInfo.action $1
  set %AltInfo.extraParam $2
  set %AltInfo.extraData $3
}
on *:dialog:AltInfo:edit:*: {

}

on *:sockopen:AltInfo: { 
  if ($hget(Posts)) hfree Posts
  var %sa = %AltInfo.action, %ex = %AltInfo.extraParam, %exData = %AltInfo.extraData
  sockwrite -nt $sockname GET $+(/forum/index.php?action=.xml;sa=,%sa,;,%ex,=,%exData) HTTP/1.0
  sockwrite -nt $sockname HOST: altscripts.trap17.com
  sockwrite -nt $sockname $crlf
}

on *:sockread:Altinfo: {
  var %read 
  sockread %read
  echo -a %read
  if (%AltInfo.action == recent) {
    if ($regex(%read,/<time>(.+)<\/time>/Si)) set %AltInfoData.Time $regml(1)
    elseif ($regex(%read,/<link>(.+#msg.+)<\/link>/Si)) set %AltInfoData.Link $regml(1)
    elseif ($regex(%read,/<id>(.+)<\/id>/Si)) {
      if (!%AltInfoData.Id) set %AltInfoData.id $regml(1)
    }
    elseif ($regex(%read,/<subject><!\[CDATA\[(.+)\]\]><\/subject>/Si)) {
      if (%AltInfoData.Subject) set %AltInfoData.Post $regml(1)
      else set %AltInfoData.Subject $regml(1)
    }
    elseif ($regex(%read,/<name><!\[CDATA\[(.+)\]\]><\/name>/Si)) {
      if (%AltInfoData.LastPoster) set %AltInfoData.Board $regml(1)
      elseif (%AltInfoData.Starter) set %AltInfoData.LastPoster $regml(1)
      else set %AltInfoData.Starter $regml(1)
    }
    elseif (</recent-post> isin %read) {
      var %x = 1, %total = $var(%AltInfoData.*,0)
      while (%x <= %total) {
        var %data = $addtok(%data,$($var(%AltInfoData.*,%x),2),164)
        inc %x
      }
      echo 4 -a $numtok(%data,164)
      unset %AltInfoData.*
      hadd -m Posts $calc($hget(Posts,0).item + 1) %data
    }
  }
}

on *:sockclose:AltInfo: {
  if (%AltInfo.action == recent) ViewPost 1
}








/*
tab "News", 5
text "View how many news items?", 6, 4 18 70 8, tab 5
edit "", 7, 75 17 15 10, tab 5 center
list 8, 4 30 142 106, tab 5 vsbar

tab "New Members", 9
text "View how many new members?", 10, 4 18 76 8, tab 9
edit "", 11, 81 17 15 10, tab 9 center
list 12, 4 30 142 106, tab 9 vsbar

tab "Profiles", 13
text "View profile of which user ID?", 14, 4 18 73 8, tab 13
edit "", 15, 79 17 15 10, tab 13 center
text "User name:", 16, 4 34 30 8, tab 13
text "", 17, 40 34 106 8, tab 13
text "Name:", 18, 4 44 30 8, tab 13
text "", 19, 40 44 106 8, tab 13
text "Post count:", 20, 4 54 30 8, tab 13
text "", 21, 40 54 106 8, tab 13
text "Last login:", 22, 4 64 30 8, tab 13
text "", 23, 40 64 106 8, tab 13
text "Registered:", 24, 4 74 30 8, tab 13
text "", 25, 40 74 106 8, tab 13
text "Language:", 26, 4 84 30 8, tab 13
text "", 27, 40 84 106 8, tab 13
text "Gender:", 28, 4 94 30 8, tab 13
text "", 29, 40 94 106 8, tab 13
text "Email:", 30, 4 104 30 8, tab 13
text "", 31, 40 104 106 8, tab 13
text "Link:", 32, 4 114 30 8, tab 13
text "", 33, 40 114 106 8, tab 13
text "Position:", 34, 4 124 30 8, tab 13
text "", 35, 40 124 106 8, tab 13

*/