Jump to content

Wikipedia:Scripts/Wikimedia RC Watcher

From Wikipedia, the free encyclopedia

Wikimedia RC Watcher, v.1.0

[edit]
on 1:TEXT:*:#: {
  ;Wikimedia RC Watcher, v.1.0
  ;by [[User:Dbl2010]] 
  ;This script watches all the channels that user entered 
  ;in irc.wikimedia.org IRC server and lists the live RC in a
  ;separate list window in a proper format. Right clicking on list
  ;window brings an easy access menu for selected edit.
 
  var %maxline 30

  var %s $strip($1-)
  if ($left(%s,1) != $chr(91)) halt
  if ($nick != rc) halt
  var %e1 $pos(%s,]],1)
  var %tpc �15 $+ $chr(91) $+ $chr(91) $+ �07 $+ $mid(%s,3,$calc(%e1 - 3)) $+ �15 $+ $chr(93) $+ $chr(93)

  if (Log/newusers isin %tpc) {
    if ($chan == #tr.wikipedia) isimsay $chan
  }
  var %s $right(%s,$calc($len(%s) - %e1 - 2))
  var %e2 $pos(%s,http,1)
  var %NorM $chr(32)
  if (M isin $left(%s,%e2)) var %NorM $remove(%NorM,$chr32) $+ �4M
  if (N isin $left(%s,%e2)) var %NorM $remove(%NorM,$chr32) $+ �4N

  var %s $right(%s,$calc($len(%s) - %e2 + 1))
  var %url $left(%s,$pos(%s,$chr(32),1))
  var %s $right(%s,$calc($len(%s) - $pos(%s,$chr(32),2)))
  var %user �03 $+ $left(%s,$calc($pos(%s,$chr(42),1) - 1))
  var %s $right(%s,$calc($len(%s) - $pos(%s,$chr(42),1) - 1))

  if ($left(%s,1) == $null ) halt
  if ($left(%s,1) == $chr(40)) {       ;This is an edit
    if ($pos(%s,$chr(32),1) == $null ) { var %byte %s
      var %summary $chr(32) 
    }
    else {
      var %byte $left(%s,$pos(%s,$chr(32),1))
      var %summary �10 $+ $right(%s,$calc($len(%s) - $pos(%s,$chr(32),1)))
    }
  }
  else {
    ;  Special:   
    halt
  }
  var %Wname @rc: $+ $remove($chan,$chr(35))
  if ($window(%Wname) == $null)  window -alk0 -t6,8,30,39,44,77 %Wname Tahoma 12
  aline %Wname $timestamp $+ $chr(9) $+ %NorM $+ $chr(9) $+ %tpc $+ $chr(9) $+ %user $+ $chr(9) $+ %byte $&
  $+ $chr(9) $+ %summary $+ $chr(9) $+ %url
  if ($line(%Wname,0) == %maxline) dline %Wname 1
}

menu  @rc:* {
  $ayikla($1-,3): {
    echo -s �04----------------------------------------------------------------------- 
    echo -s �07Page:� $ayikla($1-,3)
    echo -s �03User:� $ayikla($1-,4)
    echo -s Byte change: $ayikla($1-,5)
    echo -s �10Summary:� $ayikla($1-,6)
    echo -s �02URL:� $ayikla($1-,7)
  }
  -
  Page: $baglan($1-,$menu,1)
  Diff: $baglan($1-,$menu,2)
  User $+ $chr(58) $+ $ayikla($1-,4) : $baglan($1-,$menu,3)
  User talk $+ $chr(58) $+ $ayikla($1-,4) : $baglan($1-,$menu,4)
}

alias sfm {
  var %sitename $remove($1,rc:,@) $+ .org
  return %sitename
}

alias ayikla {
  return $gettok($strip($1),$2,9)
}

alias baglan {
  var %sayfa $strip($1)
  if ($3 == 1) {
    var %sayfa $gettok(%sayfa,3,9)
    var %sayfa $remove(%sayfa,$chr(91),$chr(93))
    var %sayfa $replace(%sayfa,$chr(32),_)
    var %sayfa http:// $+ $sfm($2) $+ /wiki/ $+ %sayfa
  }
  elseif ($3 == 2) { 
    var %sayfa $gettok(%sayfa,7,9)
  }
  elseif ($3 == 3) { 
    var %sayfa $gettok(%sayfa,4,9)
    var %sayfa http:// $+ $sfm($2) $+ /wiki/User: $+ %sayfa
  }
  elseif ($3 == 4) { 
    var %sayfa $gettok(%sayfa,4,9)
    var %sayfa http:// $+ $sfm($2) $+ /wiki/User_talk: $+ %sayfa
  }

  url -a %sayfa
}