daily pastebin goal
20%
SHARE
TWEET

Untitled

a guest Mar 9th, 2013 142 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;shrinklinks by Ford_Lawnmower irc.geekshed.net -j #Script-Help
  2. alias -l shrinklinks {
  3.   if ($wildtok($strip($4-),http://*.*,0,32) == $wildtok($strip($4-),http://tinyurl.com*,0,32)) {
  4.     $eval($1-,1)
  5.     return
  6.   }
  7.   var %count $wildtok($strip($4-),http://*.*,0,32), %text $strip($4-)
  8.   while %count {
  9.     if ($left($wildtok(%text,http://*.*,%count,32),18) != http://tinyurl.com) {
  10.       tiny $1-3 $wildtok(%text,http://*.*,%count,32) $4-
  11.       %count = 0
  12.       return
  13.     }
  14.     dec %count
  15.   }
  16. }
  17. alias -l Tiny {
  18.   var %sockname $+(Tiny,$network,$ticks,$r(1,$ticks))
  19.   sockopen %sockname tinyurl.com 80
  20.   sockmark %sockname $1-3 $+(/create.php?url=,$urlencode($4)) $4 $5-
  21. }
  22. On *:sockopen:Tiny*: {
  23.   if (!$sockerr) {
  24.     sockwrite -nt $sockname GET $gettok($sock($sockname).mark,4,32) HTTP/1.0
  25.     sockwrite -n $sockname Host: tinyurl.com
  26.     sockwrite -n $sockname $crlf
  27.   }
  28.   else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
  29. }
  30. On *:sockread:Tiny*: {
  31.   if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
  32.   else {
  33.     var %Tiny | sockread %Tiny
  34.     if ($regex(%Tiny,/<blockquote><b>(.*)<\/b><br><small>/i)) {
  35.       tokenize 32 $sock($sockname).mark
  36.       shrinklinks $1-3 $replace($6-,$5,$regml(1))
  37.       sockclose $sockname
  38.       return
  39.     }
  40.   }
  41. }
  42. alias -l urlencode return $regsubex($1-,/([^a-z0-9])/ig,% $+ $base($asc(\t),10,16,2))
  43. alias removecdata return $regsubex($remove($1,$chr(124)),/<\!\[CDATA\[(.*)\]\]>/iU,\1)
  44.  
  45. ;on startup the feeds have to be initialized
  46. on *:start: { newsfirststart | news_reset_messages_to_default }
  47.  
  48. ;display info on load
  49. on *:load: {
  50.   if ( $isfile(newstracker-setting.hsh) ) {
  51.     if ( $hget(newstracker-setting) ) { .hfree newstracker-setting }
  52.     .hmake newstracker-setting 100 | .hload newstracker-setting newstracker-setting.hsh
  53.     news_reset_messages_to_default
  54.     news_help load
  55.   }
  56.   else {
  57.     news_resettodefault
  58.     news_help
  59.     dialog -m newstracker newstracker
  60.   }
  61.   newsfirststart
  62. }
  63. on *:unload: {
  64.   if ( $hget(newstracker-setting,lang) != NL ) {
  65.     if ( $exists(newstracker-setting.hsh) ) { /shrinklinks echo -s The file newstracker-setting.hsh can be removed manually if you don't want to keep your settings! }
  66.     echo -s Newstracker is unloaded successfully.
  67.   }
  68.   if ( $hget(newstracker-setting,lang) != EN ) {
  69.     if ( $exists(newstracker-setting.hsh) ) { echo -s Het bestand newstracker-setting.hsh kan met de hand verwijderd worden wanneer je je instellingen niet wilt bewaren }
  70.     echo -s Newstracker is uit je scripts verwijdert.
  71.   }
  72.   if ( $hget(newstracker) ) { .hfree newstracker }
  73.   if ( $hget(newstracker-setting) ) { .hfree newstracker-setting }
  74.   if ( $window(@newstracker) ) { .window -c @newstracker }
  75.   .timernews* off
  76.   unset %trackernews*
  77.   unset %tell.room
  78.   unset %newssaid
  79. }
  80. ;-----------------------menus--------------------------------
  81. menu @newstracker {
  82.   .$iif($hget(newstracker-setting,window),$newstracker-return-text(menu5),):hadd newstracker-setting window 0 | newstracker-save-settings | window -nh @newstracker
  83.   .$iif(!$hget(newstracker-setting,window),$newstracker-return-text(menu6),):hadd newstracker-setting window 1 | newstracker-save-settings | window -w3n @newstracker
  84.   .$newstracker-return-text(menu11):clear
  85. }
  86.  
  87. menu menubar,channel {
  88.   $newstrackerversion
  89.   .$iif($hget(newstracker-setting,0).item == 0,Reset to default/Reset naar beginwaarden):news_resettodefault
  90.   .$iif(!$hget(newstracker-setting,off),$newstracker-return-text(menu9)): hadd -m newstracker-setting off 1
  91.   .$iif($hget(newstracker-setting,off),$newstracker-return-text(menu10)): hadd -m newstracker-setting off 0
  92.   .$iif($chan($active) && !$newschannels(isinall,$chan($active)),$newstracker-return-text(menu3)):newstracker-chans add $chan($active)
  93.   .$iif($chan($active) && !$newschannels(isnotinany,$chan($active)),$newstracker-return-text(menu4)):newstracker-chans remove $chan($active)
  94.   .$newstracker-return-text(menu13): news_help
  95.   .-
  96.   .$newstracker-return-text(menu1):dialog -m newstracker newstracker
  97.   .-  
  98.   .$iif($hget(newstracker-setting,window),$newstracker-return-text(menu5),):hadd newstracker-setting window 0 | newstracker-save-settings | window -nh @newstracker
  99.   .$iif(!$hget(newstracker-setting,window),$newstracker-return-text(menu6),):hadd newstracker-setting window 1 | newstracker-save-settings | window -w3n @newstracker
  100.   .$newstracker-return-text(menu12):hfree newstracker | news_reset_messages_to_default
  101.   .$newstracker-return-text(menu2):dialog -m newstracker_lang newstracker_lang
  102.   .$newstracker-return-text(menu7):var %i = $input($newstracker-return-text(menu8),y) | if ( %i ) { news_resettodefault }
  103. }
  104.  
  105. ;-----------------------dialogs-------------------------------
  106.  
  107. dialog newstracker_lang {
  108.   title "NewsTracker © snabbi"
  109.   size -1 -1 110 50
  110.   option dbu
  111.   text "Which language do you prefer? / Welke taal heeft uw voorkeur?",10,10 10 90 14
  112.   button "English",11,10 30 45 15
  113.   button "Nederlands",12,60 30 45 15
  114. }
  115. on *:dialog:newstracker_lang:sclick:11: { hadd -m newstracker-setting lang EN | dialog -c newstracker_lang }
  116. on *:dialog:newstracker_lang:sclick:12: { hadd -m newstracker-setting lang NL | dialog -c newstracker_lang }
  117.  
  118. dialog newstracker {
  119.   size -1 -1 320 153
  120.   option dbu
  121.  
  122.   tab $newstracker-return-text(dialog150), 150, 5 1 310 125
  123.   text $newstracker-return-text(dialog2),2,10 20 80 7, tab150
  124.   radio $newstracker-return-text(dialog3),3,135 20 20 10,group, tab150
  125.   radio $newstracker-return-text(dialog4),4,155 20 20 10, tab150
  126.   text $newstracker-return-text(dialog5),5,10 35 120 7, tab150
  127.   edit "",6,135 34 40 10,autohs, tab150
  128.   text $newstracker-return-text(dialog7),7,178 35 40 10, tab150
  129.   text $newstracker-return-text(dialog8),8,10 48 120 7, tab150
  130.   edit "",9,135 47 40 10,autohs, tab150
  131.   text $newstracker-return-text(dialog10),10,179 48 40 7, tab150
  132.   text $newstracker-return-text(dialog11),11,10 61 80 7, tab150
  133.   radio $newstracker-return-text(dialog12),12,135 61 70 10,group, tab150
  134.   radio $newstracker-return-text(dialog13),13,135 71 80 10, tab150
  135.  
  136.   tab $newstracker-return-text(dialog151), 151, 5 1 310 125
  137.   text $newstracker-return-text(dialog51),51,10 22 70 7, tab151
  138.   list 52,9 31 72 94,hsbar vsbar sort, tab151
  139.   text $newstracker-return-text(dialog64),64,100 31 50 7, tab151
  140.   radio $newstracker-return-text(dialog65),65,160 31 20 10,group, tab151
  141.   radio $newstracker-return-text(dialog66),66,185 31 20 10, tab151
  142.   text $newstracker-return-text(dialog53),53,100 43 50 7, tab151
  143.   edit "",54,160 42 110 10,autohs, tab151
  144.   text $newstracker-return-text(dialog55),55,100 55 50 7, tab151
  145.   button $newstracker-return-text(dialog88),88,273 55 37 8, tab151
  146.   edit "",56,160 54 110 10,autohs, tab151
  147.   text $newstracker-return-text(dialog57),57,100 67 55 7, tab151
  148.   edit "",58,160 66 110 10,autohs, tab151
  149.   text $newstracker-return-text(dialog59),59,275 67 30 7, tab151
  150.   text $newstracker-return-text(dialog60),60,100 79 50 7, tab151
  151.   edit "",61,160 78 110 10,autohs, tab151
  152.   button $newstracker-return-text(dialog89),89,273 78 37 8, tab151
  153.   text $newstracker-return-text(dialog62),62,100 91 50 7, tab151
  154.   edit "",63,160 90 110 10,autohs, tab151
  155.   button $newstracker-return-text(dialog87),87,273 91 37 8, tab151
  156.   button $newstracker-return-text(dialog80),80,100 105 50 15, tab151
  157.   button $newstracker-return-text(dialog81),81,160 105 50 15, tab151
  158.   button $newstracker-return-text(dialog82),82,220 105 50 15, tab151
  159.  
  160.   button $newstracker-return-text(dialog100),100,120 131 40 15,ok
  161. }
  162.  
  163. on *:dialog:newstracker:init:*: {
  164.   var %i = $hfind(newstracker-setting,tracker*,0,w)
  165.   while ( %i ) {
  166.     var %settings = $hget(newstracker-setting,$hfind(newstracker-setting,tracker*,%i,w))
  167.     did -a $dname 52 $gettok(%settings,1,32) | dec %i
  168.   } | did -b $dname 80,82
  169.  
  170.   did -a $dname 9 $iif($hget(newstracker-setting,interval),$ifmatch,30)
  171.   did -a $dname 6 $iif($hget(newstracker-setting,max),$ifmatch,5)
  172.   did -c $dname $iif($hget(newstracker-setting,off),4,3)
  173.   did -c $dname $iif($hget(newstracker-setting,msg) == all,13,12)
  174. }
  175. on *:dialog:newstracker:sclick:*: { goto $did
  176.   :3 | hadd newstracker-setting off 0 | halt
  177.   :4 | hadd newstracker-setting off 1 | halt
  178.   :12 | hadd newstracker-setting msg chans | halt
  179.   :13 | hadd newstracker-setting msg all | halt
  180.   :52 | if ( $did($dname,52).seltext != $null ) {
  181.     var %options = $hget(newstracker-setting,trackersetting. [ $+ [ $v1 ] ])
  182.     did -ra $dname 54 $v1 | did -ra $dname 56 $gettok(%options,2,32)
  183.     did -ra $dname 58 $gettok(%options,3,32)
  184.     did -ri $dname 61 1 $hget(newstracker-setting,newsbanner. [ $+ [ $v1 ] ])
  185.     did -ri $dname 63 1 $gettok(%options,5-,32)
  186.     did -u $dname 65,66 | did -c $dname $iif($gettok(%options,4,32),65,66)
  187.     did -e $dname 80,82
  188.   } | halt
  189.   :80 | remove-newstracker
  190.   did -d $dname 52 $did($dname,52,1).sel | did -r $dname 54,56,58,61,63
  191.   did -b $dname 82,80
  192.   halt
  193.   :82 | :81 | var %name = $replace($did($dname,54),$chr(32),_)
  194.   if ( (!$did($dname,52).sel && $did != 81) || %name == $null || $did($dname,58) == $null || $did($dname,56) == $null ) {
  195.     var %i = $input($newstracker-return-text(error1),o,Error) | halt
  196.   }
  197.   if ( ( $did == 81 && $hget(newstracker-setting,trackersetting. [ $+ [ %name ] ]) ) || $&
  198.     ( $did == 82 && $did($dname,52).seltext != %name ) && $hget(newstracker-setting,trackersetting. [ $+ [ %name ] ]) ) {
  199.     var %i = $input($newstracker-return-text(error2),o,Error) | halt
  200.   }
  201.   if ( $did($dname,58) !isnum || $did($dname,58) < 120 ) { var %i = $input($newstracker-return-text(error3),o) | halt }
  202.   if ( $did == 82 ) { remove-newstracker } | did -b $dname 82,80
  203.   hadd newstracker-setting newsbanner. [ $+ [ %name ] ] $iif($did($dname,61),$v1,&title - 12&link)
  204.   var %reg = /((?:,|\s)+)/g | var %rooms = $regsubex($did($dname,63),%reg,$chr(44)) | var %i = 1
  205.   while ( %i <= $numtok(%rooms,44) ) {
  206.     var %room = $addtok(%room,$iif($+($chr(35),*) iswm $gettok(%rooms,%i,44),$v2,$+($chr(35),$v2)),44)
  207.     inc %i
  208.   }
  209.   hadd newstracker-setting trackersetting. [ $+ [ %name ] ] %name $did($dname,56) $did($dname,58) $iif($did(65).state,1,0) %room
  210.   if ( $did == 81 ) { checknews %name echo }
  211.   if ( $did == 82 ) { did -d $dname 52 $did($dname,52,1).sel }
  212.   did -a $dname 52 %name | did -r $dname 54,56,58,61,63 | did -u $dname 65,66,52 | halt
  213.   :89 | if ( $did(61) ) { echo -a ---------- | echo -a $did(61) | echo -a ---------- } | halt
  214.   :88 | newstracker_check_url $did(56) | halt
  215.   :65 | :66 | if ( !$did($dname,52).sel ) { halt } | did -e $dname 82 | halt
  216.   :87 | if ( $chan($active) == $window($active) ) {
  217.     did -ra $dname 63 $addtok($did($dname,63),$chan($active),44)
  218.     if ( $did == 6 || $did == 9 || !$did($dname,52).sel ) { return }
  219.     did -e $dname 82
  220.   }
  221.   halt
  222.   :100 | hadd newstracker-setting interval $iif($did(9),$ifmatch,15)
  223.   hadd newstracker-setting max $iif($did(6),$ifmatch,2)
  224.   newstracker-save-settings
  225.   dialog -x $dname | newstracker-save-settings | news_start
  226.   :0 | :150 | :151
  227. }
  228.  
  229. on *:dialog:newstracker:edit:*: {
  230.   if ( $did == 6 || $did == 9 || !$did($dname,52).sel ) { halt }
  231.   did -e $dname 82
  232. }
  233.  
  234. ;-----------------------aliases-------------------------------
  235. alias newstrackerversion { return Newstracker 4.0 by wazer }
  236. alias news_help {
  237.   .timer 1 1 echo -s -----------------------
  238.   .timer 1 1 echo -s $newstracker-return-text(welkom1)
  239.   .timer 1 4 echo -s $newstracker-return-text(welkom2)
  240.   .timer 1 7 echo -s $newstracker-return-text(welkom3)
  241.   .timer 1 10 echo -s $newstracker-return-text(welkom4)
  242.   .timer 1 13 echo -s $newstracker-return-text(welkom5)
  243.   .timer 1 16 echo -s $newstracker-return-text(welkom6)
  244.   if ( $1 == load ) { .timer 1 19 echo -s $newstracker-return-text(welkom7) }
  245.   .timer 1 22 echo -a -----------------------
  246. }
  247. alias newstracker-save-settings { .hsave -o newstracker-setting newstracker-setting.hsh }
  248.  
  249. ;returns the text in the language what was choosen $1 = number for event
  250. alias newstracker-return-text { return $hget(newstracker,$+($hget(newstracker-setting,lang),-,$1)) }
  251.  
  252. ;$1 = isinall of isnotinany $2 = channame
  253. alias newschannels {
  254.   var %i = $hfind(newstracker-setting,tracker*,0,w)
  255.   while ( %i ) {
  256.     var %name = $hfind(newstracker-setting,tracker*,%i,w)
  257.     var %settings = $hget(newstracker-setting,%name)
  258.     if ( $istok($gettok(%settings,5,32),$2,44) ) {
  259.       if ( $1 == isnotinany ) { return $false }
  260.     }
  261.     else {
  262.       if ( $1 == isinall ) { return $false }
  263.     }
  264.     dec %i
  265.   }
  266.   return $true
  267. }
  268. alias news_reset_messages_to_default {
  269.   if ( !$hget(newstracker) ) { .hmake newstracker 100 }
  270.   hadd newstracker NL-welkom1 U heeft zojuist news-tracker geinstalleerd op uw mIRC versie © snabbi
  271.   hadd newstracker NL-welkom2 Wanneer u met de rechter muistoets in de kamer klikt ziet u een menu verschijnen "newstracker 3.5". In dit menu @#$! u via de instellingen het script aanpassen.
  272.   hadd newstracker NL-welkom3 Op het eerste tabblad ziet u de algemene instellingen. Deze instellingen hebben betrekking op alle feeds. Zo @#$! u bijvoorbeeld het maximum aantal berichten ingeven dat er per feed gezegd mag worden. Hiermee voorkomt u dat u de kamer overspoelt met nieuwsberichten. Ook @#$! u instellen dat er een bepaalde tijd is tussen het downloaden van 2 sites.
  273.   hadd newstracker NL-welkom4 De laatste instelling van de algemene instellingen gaat over het versturen van berichten. Het heeft de voorkeur om de berichten in 1 keer naar alle kamers te sturen, echter niet elke server ondersteunt deze optie en daarom @#$! u ook elk kanaal apart informeren.
  274.   hadd newstracker NL-welkom5 Het tweede tabblad heet "Feed instellingen". Hier @#$! u per site de instellingen voor de feed wijzigen. U @#$! hierbij denken aan hoe de tekst in de kamer getoond moet worden, hoe vaak het getoond moet worden, in welke kamers enzovoorts. Gebruik de knop "check URL" om uw opgegeven URL te controleren en om te zien welke commando's u @#$! gebruiken in het veld "Tekst banner"
  275.   hadd newstracker NL-welkom6 Speel maar gerust met het script. Heeft u nog vragen dan @#$! u mij mailen op newstracker@snirc.nl. Vergeet overigens niet om kamers toe te voegen aan uw feeds, want anders ziet u ze niet!
  276.   hadd newstracker NL-welkom7 Overigens zijn de instellingen van de vorige keer bewaard gebleven. Wilt u deze wissen klik dan met uw rechter muistoets in de kamer en kies voor Newstracker en vervolgens voor Reset naar beginwaarden
  277.   hadd newstracker EN-welkom1 You just installed news-tracker on your mIRC client © snabbi
  278.   hadd newstracker EN-welkom2 The menu "newstracker 4.0 by wazer" appears after right clicking a channel. This menu enables you to edit the script's settings. The config dialog can be opened by clicking settings. This dialog consists of two tabs. The first tab contains the general settings. These settings apply to all feeds.
  279.   hadd newstracker EN-welkom3 You can for example change the max number of messages that are displayed for each feed to prevent flooding and set a timer to pause downloading from a second newssite.
  280.   hadd newstracker EN-welkom4 You can change the way the message are sent to the server at the bottom of the dialog. The default setting is to send 1 message to all channels, however, this feature is not supported by all servers and therefor you are also able to send the messages to each chan individually.
  281.   hadd newstracker EN-welkom5 The second tab is called "Feed settings". This tab allows you to change the settings for each RSS feed like layout and frequency. The button "check URL" enables you to test your URL and shows which tags are available at that feed. Add the tags to the Text banner line to display the contents of a tag in your channel.
  282.   hadd newstracker EN-welkom6 If you have any suggestions or questions you can mail me at newstracker@snirc.nl  Please don't forget to add channels to your feed, or else you will not see any news.
  283.   hadd newstracker EN-welkom7 BTW the previous settings have been loaded. You can reset to default settings by right clicking in a chan and selecting Newstracker -> Reset to default
  284.   hadd newstracker NL-dialog2 Tracker gebruiken? | hadd newstracker EN-dialog2 Use newstracker?
  285.   hadd newstracker NL-dialog3 Ja | hadd newstracker EN-dialog3 Yes
  286.   hadd newstracker NL-dialog4 Nee | hadd newstracker EN-dialog4 No
  287.   hadd newstracker NL-dialog5 Max aantal teksten per feed (flood bescherming)
  288.   hadd newstracker EN-dialog5 Max number of msgs for each feed (flood prot)
  289.   hadd newstracker NL-dialog7 (0=oneindig) | hadd newstracker EN-dialog7 (0=indefinitely)
  290.   hadd newstracker NL-dialog8 Minimum tijd tussen 2 downloads
  291.   hadd newstracker EN-dialog8 Minimum time between downloading 2 feeds
  292.   hadd newstracker NL-dialog10 seconden | hadd newstracker EN-dialog10 seconds
  293.   hadd newstracker EN-dialog11 How to send channel messages: | hadd newstracker EN-dialog12 each chan individually
  294.   hadd newstracker EN-dialog13 single message to all chans | hadd newstracker NL-dialog11 Berichten versturen:
  295.   hadd newstracker NL-dialog12 elk kanaal apart | hadd newstracker NL-dialog13 als 1 bericht naar alle kanalen
  296.   hadd newstracker NL-dialog51 Feed namen | hadd newstracker EN-dialog51 Feed names
  297.   hadd newstracker NL-dialog53 Naam tracker | hadd newstracker EN-dialog53 Name tracker
  298.   hadd newstracker NL-dialog55 URL RSS feed | hadd newstracker EN-dialog55 URL RSS feed
  299.   hadd newstracker NL-dialog57 Download feed elke | hadd newstracker EN-dialog57 Download feed each
  300.   hadd newstracker NL-dialog59 seconden | hadd newstracker EN-dialog59 seconds
  301.   hadd newstracker NL-dialog60 Tekst banner | hadd newstracker EN-dialog60 Text banner
  302.   hadd newstracker NL-dialog62 Zeg op kamers | hadd newstracker EN-dialog62 Say on rooms
  303.   hadd newstracker NL-dialog64 Gebruik feed | hadd newstracker EN-dialog64 Use feed
  304.   hadd newstracker NL-dialog65 Ja | hadd newstracker EN-dialog65 Yes
  305.   hadd newstracker NL-dialog66 Nee | hadd newstracker EN-dialog66 No
  306.   hadd newstracker NL-dialog80 &Verwijder Feed | hadd newstracker EN-dialog80 &Remove Feed
  307.   hadd newstracker NL-dialog81 &Nieuwe Feed | hadd newstracker EN-dialog81 &New Feed
  308.   hadd newstracker NL-dialog82 Op&slaan | hadd newstracker EN-dialog82 &Save changes
  309.   hadd newstracker NL-dialog87 huidige kamer | hadd newstracker EN-dialog87 active room
  310.   hadd newstracker NL-dialog88 check URL | hadd newstracker EN-dialog88 check URL
  311.   hadd newstracker NL-dialog89 voorbeeld | hadd newstracker EN-dialog89 example
  312.   hadd newstracker NL-dialog100 &Oke | hadd newstracker EN-dialog100 &OK
  313.   hadd newstracker NL-dialog150 Algemene instellingen | hadd newstracker EN-dialog150 General settings
  314.   hadd newstracker NL-dialog151 Instellingen per feed | hadd newstracker EN-dialog151 Feed settings
  315.   hadd newstracker NL-error1 Sommige vereiste velden zijn leeg (kamers en banners zijn niet vereist). Een nieuwe feed voeg je toe via Nieuwe feed en anders gebruik je Opslaan
  316.   hadd newstracker EN-error1 Some required are empty (channels and banners are not required). Add a new feed with the New Feed button else use Save
  317.   hadd newstracker NL-error2 Naam is niet uniek | hadd newstracker EN-error2 Name already in use
  318.   hadd newstracker NL-error3 De tijd voor elke download moet minimaal 2 minuten zijn (=120 seconden)
  319.   hadd newstracker EN-error3 The time between downloading a feed has to be at least 2 minutes (=120 seconds)
  320.   hadd newstracker NL-error4 Download mislukt van | hadd newstracker EN-error4 Could not download news from
  321.   hadd newstracker NL-error5 Fout tijdens het download van het nieuws. Site reageerde te traag:
  322.   hadd newstracker EN-error5 Error while downloading news. Site was responding to slowly:
  323.   hadd newstracker NL-error6 Fout tijdens het downloaden van de nieuwstracker. Zie de fout in het scherm @newstracker of neem contact op met snabbi op newstracker@snirc.nl
  324.   hadd newstracker EN-error6 Error in newstracker. Please consult your @newstracker window or contact snabbi at newstracker@snirc.nl
  325.   hadd newstracker NL-error7 Fout tijdens het parsen van | hadd newstracker EN-error7 Error while parsing
  326.   hadd newstracker NL-error8 foutcode is: | hadd newstracker EN-error8 message is:
  327.  
  328.   hadd newstracker NL-error9 Geef een URL in het daarvoor bedoelde veld op.
  329.   hadd newstracker EN-error9 Please specify a URL.
  330.   hadd newstracker NL-error10 Het script is nog bezig met het verwerken van uw vorige verzoek.
  331.   hadd newstracker EN-error10 The script is still processing your previous request.
  332.   hadd newstracker NL-error11 De URL is in het verkeerde formaat.
  333.   hadd newstracker EN-error11 Invalid format of URL:
  334.   hadd newstracker NL-error12 verwacht:
  335.   hadd newstracker EN-error12 expect:
  336.   hadd newstracker NL-error13 Fout bij het downloaden van de site
  337.   hadd newstracker EN-error13 Error while downloading from site
  338.  
  339.   hadd newstracker NL-menu1 Instellingen
  340.   hadd newstracker NL-menu2 Verander taal/Change language
  341.   hadd newstracker NL-menu3 Voeg kamer toe aan alle trackers
  342.   hadd newstracker NL-menu4 Verwijder kamer van alle trackers
  343.   hadd newstracker NL-menu5 Verberg scherm @newstracker
  344.   hadd newstracker NL-menu6 Toon scherm @newstracker
  345.   hadd newstracker NL-menu7 Reset naar beginwaarden
  346.   hadd newstracker NL-menu8 Weet u zeker dat u de huidige instellingen wilt wissen
  347.   hadd newstracker NL-menu9 Schakel script uit
  348.   hadd newstracker NL-menu10 Schakel script in
  349.   hadd newstracker NL-menu11 Leeg maken
  350.   hadd newstracker NL-menu12 Wis berichtgeschiedenis
  351.   hadd newstracker NL-menu13 Help
  352.  
  353.   hadd newstracker EN-menu1 Settings
  354.   hadd newstracker EN-menu2 Change language/Verander taal
  355.   hadd newstracker EN-menu3 Add chan to all trackers
  356.   hadd newstracker EN-menu4 Remove chan from all trackers
  357.   hadd newstracker EN-menu5 Hide @newstracker
  358.   hadd newstracker EN-menu6 Unhide @newstracker
  359.   hadd newstracker EN-menu7 Reset to default
  360.   hadd newstracker EN-menu8 Are you sure you want to reset to defaults
  361.   hadd newstracker EN-menu9 Turn off script
  362.   hadd newstracker EN-menu10 Turn on script
  363.   hadd newstracker EN-menu11 Clear
  364.   hadd newstracker EN-menu12 Clear news memory
  365.   hadd newstracker EN-menu13 Help
  366.  
  367.   hadd newstracker EN-test0 Please wait 5 seconds to allow the script to download the requested file
  368.   hadd newstracker EN-test1 The script was able to download a file from your URL:
  369.   hadd newstracker EN-test2 The downloaded file has been parsed. The newsfeed contains some tags. The contents of those tags can be displayed in the channel by entering their names like &tagname. The tags that have been found at your URL are shown below with an example of one of the downloaded messages.
  370.   hadd newstracker EN-test3 The tag 12
  371.   hadd newstracker EN-test4 should be entered as 12
  372.   hadd newstracker EN-test5 to display the following message 12
  373.   hadd newstracker NL-test0 Wacht 5 seconden aub om het script in staat te stellen het gevraagde bestand te downloaden
  374.   hadd newstracker NL-test1 Het script was in staat om een bestand te downloaden vanaf de opgegeven URL: 12
  375.   hadd newstracker NL-test2 Het gedownloadde bestand is verwerkt. Het bevatte een aantal tags. De inhoud tussen deze tags kan je in de kamer(s) weergeven. Dit doe je door het in te geven als een &tag. De tags die gevonden zijn in het bestand worden hier onder weergegeven met een voorbeeld van een van de berichten.
  376.   hadd newstracker NL-test3 De tag 12
  377.   hadd newstracker NL-test4 moet ingevoerd worden als 12
  378.   hadd newstracker NL-test5 om het volgende weer te geven 12
  379. }
  380. alias news_resettodefault {
  381.   if ( $isfile(newstracker-setting.hsh) ) { .remove newstracker-setting.hsh }
  382.   if ( $hget(newstracker-setting) ) { hfree newstracker-setting }
  383.   if ( $hget(newstracker) ) { hfree newstracker }
  384.   hadd -m newstracker-setting lang NL
  385.   hadd newstracker-setting interval 15
  386.   hadd newstracker-setting max 2 | hadd newstracker-setting window $true | hadd newstracker-setting off 0 | hadd newstracker-setting msg chans
  387.   news_reset_messages_to_default
  388.   var %i = $dialog(newstracker_lang,newstracker_lang)
  389.   newstracker_reset_to_default_2
  390.   newstracker-save-settings
  391. }
  392. alias newstracker_reset_to_default_2 {
  393.   if ( $hget(newstracker-setting,lang) == NL ) {
  394.     var %trackers = AD,Fok,NOS-Nieuws,NOS-Sport,NuAlg,NuEco,NuInternet | var %names = AD,Fok!,NOS,NOS,Nu.nl,Nu.nl,Nu.nl
  395.     var %info = http://www.ad.nl/?service=rss,http://rss.fok.nl/feeds/nieuws,http://feeds.nos.nl/nosnieuws,http://feeds.nos.nl/nossport, $&
  396.       http://www.nu.nl/deeplink_rss2/index.jsp?r=Algemeen,http://www.nu.nl/deeplink_rss2/index.jsp?r=Economie,http://www.nu.nl/deeplink_rss2/index.jsp?r=Internet
  397.   }
  398.   else if ( $v1 == EN ) {
  399.     var %trackers = CSPROMOD,STEAM,HLTV,CSGO | var %names = CSPROMOD,STEAM,HLTV,CSGO
  400.     var %info = http://cspromod.com/community/external.php?type=RSS2,http://store.steampowered.com/feeds/news.xml,http://www.hltv.org/news.rss.php,http://blog.counter-strike.net/index.php/feed/
  401.   }
  402.   var %i = $numtok(%trackers,44)
  403.   while ( %i ) {
  404.     hadd newstracker-setting newsbanner. [ $+ [ $gettok(%trackers,%i,44) ] ] $+(4,$gettok(%names,%i,44), &title - 12&link 4,$gettok(%names,%i,44))
  405.     hadd newstracker-setting trackersetting. [ $+ [ $gettok(%trackers,%i,44) ] ] $gettok(%trackers,%i,44) $gettok(%info,%i,44) 121 1
  406.     dec %i
  407.   }
  408.   newstracker-save-settings | newsfirststart
  409. }
  410. alias newsfirststart {
  411.   if ( !$hget(newstracker-setting) ) { .hmake newstracker-setting 100 | .hload newstracker-setting newstracker-setting.hsh }
  412.   var %i = $hfind(newstracker-setting,tracker*,0,w)
  413.   while ( %i ) {
  414.     var %feed = $hfind(newstracker-setting,tracker*,%i,w) | checknews $gettok($hget(newstracker-setting,%feed),1,32) echo
  415.     dec %i
  416.   }
  417.   news_start
  418. }
  419. alias news_start {
  420.   var %i = $hfind(newstracker-setting,tracker*,0,w)
  421.   while ( %i ) {
  422.     var %options = $hget(newstracker-setting,$hfind(newstracker-setting,tracker*,%i,w))
  423.     var %feed = $gettok(%options,1,32)
  424.     if ( $gettok(%options,4,32) && !$timer(news $+ %feed) ) {
  425.       .timernews [ $+ [ %feed ] ] -io 1 $gettok(%options,3,32) checknews %feed say
  426.     }
  427.     dec %i
  428.   }
  429. }
  430.  
  431. alias remove-newstracker {
  432.   if ( !$dialog(newstracker) ) { return }
  433.   var %name = $did(newstracker,52).seltext
  434.   hdel $+(newstracker-setting newsbanner.,%name) | hdel $+(newstracker-setting trackersetting.,%name)
  435.   if ( $timer(news $+ %name) ) { .timernews. [ $+ [ %name ] ] off }
  436. }
  437.  
  438. ;$1 = naam feed, $2 say of echo
  439. alias checknews {
  440.   var %settings = $hget(newstracker-setting,trackersetting. [ $+ [ $1 ] ])
  441.   if ( $hget(newstracker-setting,off) == 1 || !$2 || !%settings ) { return }
  442.   if ( $gettok(%settings,4,32) != 1 ) { return }
  443.   if ( $2 == echo ) { goto over }
  444.   if ( %newssaid ) { .timernews [ $+ [ $1 ] ] -io 1 $v1 checknews $1 say | .timernewssaid 1 $calc($v1 - 1) unset % $+ newssaid | halt }
  445.   .timernews [ $+ [ $1 ] ] -io 1 $gettok(%settings,3,32) checknews $1 say
  446.   set -z %newssaid $hget(newstracker-setting,interval)
  447.  
  448.   :over
  449.   var %i = 1 | while ( $sock(news $+ %i).name ) { inc %i }
  450.   var %site = $gettok(%settings,2,32)
  451.   set -u60 %trackernews [ $+ [ %i ] ] $+($1,$chr(44),%site,$chr(44),$2)
  452.   var %j = $regex(%site,/^(?:http:\/\/)?([^\/]+)(.*)$/)
  453.   if ( $regml(0) != 2 ) { echo @newstracker $newstracker-return-text(error4) %site | halt }
  454.   .sockopen news $+ %i $regml(1) 80
  455. }
  456.  
  457. alias newstracker-chans {
  458.   var %i = $hfind(newstracker-setting,tracker*,0,w)
  459.   while ( %i ) {
  460.     var %options = $hget(newstracker-setting,$hfind(newstracker-setting,tracker*,%i,w))
  461.     var %feed = $gettok(%options,1,32)
  462.     if ( $1 == add ) { hadd newstracker-setting trackersetting. [ $+ [ %feed ] ] $gettok(%options,1-4,32) $addtok($gettok(%options,5-,32),$2,44) }
  463.     if ( $1 == remove ) { hadd newstracker-setting trackersetting. [ $+ [ %feed ] ] $gettok(%options,1-4,32) $remtok($gettok(%options,5-,32),$2,1,44) }
  464.     dec %i
  465.   }
  466.   newstracker-save-settings
  467. }
  468. alias newstracker_check_url {
  469.   echo -a -----------
  470.   echo -a $newstracker-return-text(test0)
  471.   var %newstracker_testurl = $did(newstracker,56)
  472.   if ( !%newstracker_testurl ) { echo -a $newstracker-return-text(error9) | return }
  473.   if ( $sock(newstrackertest) ) { echo -a $newstracker-return-text(error10) | return }
  474.   var %site = $regex(%newstracker_testurl,/^(?:http:\/\/)?([^\/]+)(.*)$/)
  475.   if ( $regml(0) != 2 ) { echo -a $newstracker-return-text(error11) $+(4[,$regml(1),4] [,$regml(2),4]) $newstracker-return-text(error12) 4[www.test.com4] [/test4] | halt }
  476.   .timernewstrackertest off
  477.   .sockopen newstrackertest $regml(1) 80
  478. }
  479. alias newstracker_endtest {
  480.   if ( $sock($1) ) { .sockclose $1 }
  481.   if ( $fopen($1) ) { var %i = $fopen($1).pos | .fseek -l $1 1 | var %i = $fread($1,%i,&fullline) | .fclose $1 }
  482.   .remove $+($1,.tmp)
  483.   var %i = $news.tag.locate(fullline,$gettok($news.tag.locate(fullline,1).item,2,32)).item
  484.   var %j = $gettok(%i,1,32) | var %k = $gettok(%i,2,32)
  485.   while ( %j < %k ) {
  486.     var %j = $bfind(&fullline,%j,</) | inc %j 2 | var %l = $bfind(&fullline,%j,>)
  487.     if ( %j <= %k && $calc(%l - %j) < 20 ) { var %tags = $addtok(%tags,$bvar(&fullline,%j,$calc(%l - %j)).text,44) }
  488.   }
  489.   echo -a $newstracker-return-text(test1) 12 $+ $did(newstracker,56)
  490.   echo -a $newstracker-return-text(test2)
  491.   var %j = $numtok(%tags,44)
  492.   while ( %j ) {
  493.     var %text = $news.parse.line(fullline,$gettok(%i,1,32),$gettok(%i,2,32),$gettok(%tags,%j,44))
  494.     ;length stripped to 150    
  495.     if ( $bvar(&currentline,0) > 153 ) {
  496.       bcopy &newstrackertemp 1 &currentline 1 150
  497.       bunset &currentline
  498.       bcopy &currentline 1 &newstrackertemp 1 -1
  499.       bset -t &currentline 150 ...
  500.     }
  501.     echo -a $newstracker-return-text(test3) $+ $gettok(%tags,%j,44) $&
  502.       $newstracker-return-text(test4) $+ & $+ $gettok(%tags,%j,44) $&
  503.       $newstracker-return-text(test5) $+ $bvar(&currentline,1-).text
  504.     dec %j
  505.   }
  506.   echo -a -----------
  507. }
  508. ;-----------------------sockets-------------------------------
  509. on *:sockopen:newstrackertest: {
  510.   if ($sockerr) { return }
  511.   .timernewstrackertest 1 7 newstracker_endtest $sockname
  512.   .fopen -on $sockname $sockname $+ .tmp
  513.   var %site = $regex($did(newstracker,56),/^(?:http:\/\/)?([^\/]+)(.*)$/)
  514.   if ( $regml(0) != 2 ) { echo @newstracker $newstracker-return-text(error4) $gettok(%tracker [ $+ [ $sockname ] ],2,44) | halt }
  515.   sockwrite -n $sockname GET $regml(2) HTTP/1.1
  516.   sockwrite -n $sockname Host: $regml(1)
  517.   sockwrite -n $sockname Connection: Close $+ $crlf $+ $crlf
  518.   sockwrite -n $sockname
  519. }
  520. on *:sockopen:news*: {
  521.   if ($sockerr ) { return }
  522.   if ( $sockname == newstrackertest) { return }
  523.   if ( $fopen($sockname) ) { .fclose $sockname }
  524.   .fopen -on $sockname $sockname $+ .txt
  525.   .timer [ $+ [ $sockname ] ] 1 5 news.parse $sockname close
  526.   var %site = $regex($gettok(%tracker [ $+ [ $sockname ] ],2,44),/^(?:http:\/\/)?([^\/]+)(.*)$/)
  527.   if ( $regml(0) != 2 ) { echo @newstracker $newstracker-return-text(error4) $gettok(%tracker [ $+ [ $sockname ] ],2,44) | halt }
  528.   sockwrite -n $sockname GET $regml(2) HTTP/1.1
  529.   sockwrite -n $sockname Host: $regml(1) $+ $crlf $+ $crlf
  530.   sockwrite -n $sockname Connection: Close
  531.   sockwrite -n $sockname
  532. }
  533.  
  534.  
  535. on *:sockclose:news*: {
  536.   if ( $sockname == newstrackertest) { return }
  537.   news.parse $sockname
  538. }
  539. on *:sockread:newstrackertest: {
  540.   if ($sockerr) { echo -a $newstracker-return-text(error13) | return }
  541.   if (!$fopen($sockname)) { .sockclose $sockname | .timer [ $+ [ $sockname ] ] off | .remove $+($sockname,.tmp) }
  542.   sockread &line
  543.   while ( $sockbr != 0 ) {
  544.     .fwrite -b $sockname &line
  545.     sockread &line
  546.   }
  547. }
  548.  
  549. on *:sockread:news*: {
  550.   if ($sockerr || $sockname == newstrackertest) { return }
  551.   if (!$fopen($sockname)) {
  552.     echo @newstracker $newstracker-return-text(error5) $gettok(%tracker [ $+ [ $sockname ] ],1,44)
  553.     .sockclose $sockname
  554.     .timer [ $+ [ $sockname ] ] off
  555.     .remove $+($sockname,.txt)
  556.     return
  557.   }
  558.   sockread &news.read
  559.   while ( $sockbr ) { .fwrite -b $sockname &news.read | bunset &news.read | sockread &news.read }
  560. }
  561.  
  562. ;-----------------------socket aliases----------------------------
  563. ;The newsfile has been saved to a temp file on disk
  564. ;this alias reads the temp file and puts it in a binvar called &newstext
  565. ;arguments: $1 = name temp file
  566. alias news.set.var {
  567.   var %i = $file($1).size
  568.   if ( %i ) { bread $1 0 %i &newstext | breplace &newstext 10 32 13 32 }
  569. }
  570.  
  571. ;This alias assumes that there is binvar called &newstext
  572. ;It returns the starting byte and the end byte of a <tag></tag> the tags themselves excluded.
  573. ;arguments: $1 = name of binvar $2 = search from this bit, $prop = tag
  574. alias news.tag.locate {
  575.   if ( !$2 ) { return 0 }
  576.   var %startingbyte = $bfind(& [ $+ [ $1 ] ],$2,$+(<,$prop))
  577.   if ( %startingbyte == 0 ) { return 0 }
  578.   var %endstart = $bfind(& [ $+ [ $1 ] ],%startingbyte,>)
  579.   var %len = $calc(%endstart - %startingbyte + 1) | var %tag = $bvar(& [ $+ [ $1 ] ],%startingbyte,%len).text
  580.   inc %startingbyte %len
  581.   if ( !$regex(%tag,/^<[^<]+>/) ) { return 0 }
  582.   var %endbyte = $bfind(& [ $+ [ $1 ] ],%startingbyte,$+(</,$prop,>))
  583.  
  584.   return %startingbyte %endbyte
  585.   :error | reseterror | return 0
  586. }
  587. ;Returns the ascii text from the binvar &newstext
  588. ;arguments: $1 = name of binvar $2 = startingbit $3 = endbit
  589. alias news.return.content {
  590.   tokenize 32 $1-
  591.   if ( $1 == 0 ) { return $null }
  592.   var %start = $2 | var %end = $3 | var %len = $calc(%end - %start)
  593.   return $bvar(& [ $+ [ $1 ] ],%start,%len).text
  594. }
  595. ;This alias will initialize the parsing process for the downloaded rss feed.
  596. ;Arguments: $1 = sockname and filename rss feed
  597. alias news.parse {
  598.   if ( $sock($1) ) { .sockclose $1 }
  599.   .timer [ $+ [ $1 ] ] off
  600.   if ( $fopen($1) ) { .fclose $1 }
  601.   var %name = $gettok(%tracker [ $+ [ $1 ] ],1,44)
  602.   var %sayorecho = $gettok(%tracker [ $+ [ $1 ] ],3,44)
  603.   news.set.var $+($1,.txt)
  604.   .remove $+($1,.txt)
  605.   var %pos = $news.tag.locate(newstext,1).item | var %index = link
  606.   while ( %pos ) {
  607.     var %location = $news.tag.locate(newstext,%pos). [ $+ [ %index ] ]
  608.     var %indexcontent = $news.return.content(newstext,%location)
  609.     if ( !$hget(newstracker,$crc(%indexcontent,0) $+ $md5(%indexcontent)) ) {
  610.       hadd -m newstracker $crc(%indexcontent,0) $+ $md5(%indexcontent) 1
  611.       news.tell %sayorecho %name %pos
  612.     }
  613.     var %pos = $news.tag.locate(newstext,$gettok(%location,2,32)).item
  614.   }
  615.   return
  616.   :error
  617.   echo @newstracker Error $error
  618.   reseterror
  619. }
  620.  
  621. ;This alias creates the line which is mentioned in the rooms and @newstracker window.
  622. ;It will only allow %newssets.max lines within 5 seconds and calls that the text is mentioned in all rooms
  623. ;arguments: $1 = say/echo, $2 = name tracker, $3 = starting byte and $4 = endbyte in &newstext
  624. alias news.tell {
  625.  
  626.   ;mod_wazer
  627.   ;tokenize 32 $1- $removecdata($2-)
  628.   ;tokenize 32 $1-; original
  629.   tokenize 32 $removecdata($1-)
  630.  
  631.   var %regex = $regex($hget(newstracker-setting,newsbanner. [ $+ [ $2 ] ]),/&(.+?)\b/ig)
  632.   var %i = $regml(0) | bset -t &newsline 1 $hget(newstracker-setting,newsbanner. [ $+ [ $2 ] ])
  633.   var %j = 1
  634.   while ( %j <= %i ) { var %regml = %regml $regml(%j) | inc %j }
  635.   while ( %i ) {
  636.     var %start = $pos($hget(newstracker-setting,newsbanner. [ $+ [ $2 ] ]),$chr(38),%i)
  637.     var %len = $calc($len($gettok(%regml,%i,32))+1)
  638.     var %total = $calc(%start + %len)
  639.     bcopy &temp 1 &newsline 1 $calc(%start - 1)
  640.     ;tag has contents
  641.     if ( $news.parse.line(newstext,$3,$4,$gettok(%regml,%i,32)) == $true ) {
  642.       ;length stripped to 150    
  643.       if ( $bvar(&currentline,0) > 153 ) {
  644.         bcopy &newstrackertemp 1 &currentline 1 150
  645.         bunset &currentline
  646.         bcopy &currentline 1 &newstrackertemp 1 -1
  647.         bset -t &currentline 150 ...
  648.       }
  649.       bcopy &temp $calc($bvar(&temp,0) + 1) &currentline 1 -1
  650.     }
  651.     if ( %total < $bvar(&newsline,0) ) { bcopy &temp $calc($bvar(&temp,0) + 1) &newsline %total -1 }
  652.     bunset &newsline
  653.     bcopy &newsline 1 &temp 1 -1
  654.     bunset &temp
  655.     dec %i
  656.   }
  657.   inc -u5 %tell.room
  658.   if ( !$window(@newstracker) ) {
  659.     if ( $hget(newstracker-setting,window) ) { window -n @newstracker }
  660.     else { window -hn @newstracker }
  661.   }
  662.   if ( $1 == echo || %tell.room > $hget(newstracker-setting,max) || !%tell.room ) { /shrinklinks echo @newstracker in_memory: $removecdata($bvar(&newsline,1-).text) }
  663.   else { /shrinklinks echo @newstracker saying: $removecdata($bvar(&newsline,1-).text) | scon -a news.tellrooms $2 $removecdata($bvar(&newsline,1-).text) }
  664.   bunset &newsline
  665.   return
  666.   :error
  667.   echo -s $newstracker-return-text(error6)
  668.   echo @newstracker $newstracker-return-text(error7) %name $newstracker-return-text(error8) $error
  669.   echo @newstracker Level: news-tell: $1- \ %start \ %len \ %total
  670.   echo @newstracker Tekst: $bvar(&newstext,$3,$calc($4 - $3)).text
  671.   reseterror
  672. }
  673.  
  674. ;This alias replaces html entities from &currentline and also deletes all <..> sections within a tag
  675. ;arguments: $1 = name binvar, $2 = startbyte, $3 = endbyte, $4 = tag
  676. ;other binvars used are: &temp and &htmlentity
  677. ;result &currentline
  678. alias news.parse.line {
  679.   var %bytes = $news.tag.locate($1,$2). [ $+ [ $4 ] ]
  680.   if (!$calc($gettok(%bytes,2,32) - $gettok(%bytes,1,32)) ) { return $false }
  681.   if ( $bvar(&currentline,0) ) { bunset &currentline }
  682.   bcopy &currentline 1 & [ $+ [ $1 ] ] $gettok(%bytes,1,32) $calc($gettok(%bytes,2,32) - $gettok(%bytes,1,32))
  683.  
  684.   ;here we replace html entiies and delete <..>
  685.   var %pos = 1
  686.   while ( $bfind(&currentline,%pos,&) ) {
  687.     var %pos = $v1
  688.     var %posend = $bfind(&currentline,%pos,;)
  689.     if ( !%posend ) { break }
  690.     inc %posend
  691.     if ( $calc(%posend - %pos) <= 8 ) {
  692.       var %entity = $bvar(&currentline,%pos,$calc(%posend - %pos)).text
  693.       ;if the entity is < then it could start a html tag. If a > is found then we delete the <..> section
  694.       if ( %entity == &lt; ) {
  695.         ;if we find the > then we do the delete, else it will be replaced to < in the next section
  696.         var %next = $bfind(&currentline,%pos,&gt;)
  697.         if ( %next ) {
  698.           bcopy &temp 1 &currentline 1 $calc(%pos -1)
  699.           bcopy &temp $calc($bvar(&temp,0) + 1) &currentline $calc(%next + 4) -1
  700.           bunset &currentline | bcopy -c &currentline 1 &temp 1 $bvar(&temp,0)
  701.           bunset &temp | inc %pos | continue
  702.         }
  703.       }
  704.       ;here we set the &htmlentity to the replace value
  705.       htmlentities %entity
  706.       bcopy &temp $iif($bvar(&temp,0),$calc($v1 +1),1) &currentline 1 $calc(%pos -1)
  707.       bcopy &temp $calc($bvar(&temp,0) + 1) &htmlentity 1 -1
  708.       if ( %posend <= $bvar(&currentline,0) ) { bcopy &temp $calc($bvar(&temp,0) + 1) &currentline %posend -1 }
  709.       bunset &currentline | bcopy -c &currentline 1 &temp 1 $bvar(&temp,0)
  710.       bunset &temp
  711.     }
  712.     inc %pos
  713.   }
  714.   ;echo -a result: $bvar(&currentline,1,$bvar(&currentline,0)).text
  715.   return $true
  716.   :error
  717.   echo -s $newstracker-return-text(error6)
  718.   echo @newstracker $newstracker-return-text(error7) %name $newstracker-return-text(error8) $error
  719.   echo @newstracker Level: news-parse-line: $1- \ %start \ %len \ %total
  720.   echo @newstracker Tekst: $bvar(&newstext,$3,$calc($4 - $3)).text
  721.   reseterror
  722. }
  723.  
  724. ;This alias actually announces the texts in the rooms
  725. ;$1 = name | $2- = text
  726. alias -l news.tellrooms {
  727.  
  728.   ;echo -ag $1-
  729.   ;mod_wazer
  730.   ;tokenize 32 $1 $removecdata($2-)
  731.   tokenize 32 $removecdata($1-)
  732.  
  733.   var %chans = $gettok($hget(newstracker-setting,trackersetting. [ $+ [ $1 ] ]),5-,32)
  734.   var %i = $numtok(%chans,44)
  735.   if ( $hget(newstracker-setting,msg) == all ) {
  736.     while ( %i ) {
  737.       if ( $me ison $gettok(%chans,%i,44) ) { /shrinklinks echo -t $v2 $+(<,$me,>) $2- | var %channels = $addtok(%channels,$v2,44) }
  738.       dec %i
  739.     }
  740.     if ( %channels ) { /shrinklinks .msg %channels $2- }
  741.   }
  742.   if ( $hget(newstracker-setting,msg) == chans ) {
  743.     if (!$window(@newstrackersay)) { window -h @newstrackersay }
  744.     while ( %i ) {
  745.       if ( $me ison $gettok(%chans,%i,44) ) { aline @newstrackersay $cid msg $v2 $2- }
  746.       dec %i
  747.     }
  748.     if ( !$timer(newstrackersay) ) { .timernewstrackersay 0 3 news_execute }
  749.   }
  750. }
  751. alias news_execute {
  752.   if (!$window(@newstrackersay)) { return | .timernewstrackersay off }
  753.   if ( $line(@newstrackersay,0) > 0 ) {
  754.     var %line = $line(@newstrackersay,1)
  755.     dline @newstrackersay 1
  756.     if ( $gettok(%line,2,32) != msg ) { return }
  757.     scid $gettok(%line,1,32)
  758.     $gettok(%line,2-,32)
  759.   }
  760. }
  761. ;translates html entities to their ascii value and sets it in &htmlentities
  762. alias htmlentities {
  763.   if ( $bvar(&htmlentity,0) ) { bunset &htmlentity }
  764.   var %text = $1-
  765.   if ( $regex(%text,/&[^#]\w+;/) ) {
  766.     var %text = $replace(%text,&nbsp;,160,&iexcl;,161,&cent;,162,&pound;,163,&curren;,164,&yen;,165,&brvbar;,166,&sect;,167,&uml;,168)
  767.     var %text = $replace(%text,&copy;,169,&ordf;,170,&laquo;,171,&not;,172,&shy;,173,&reg;,174,&macr;,175,&deg;,176,&plusmn;,177,&sup2;,178,&sup3;,179)
  768.     var %text = $replace(%text,&acute;,180,&micro;,181,&para;,182,&middot;,183,&cedil;,184,&sup1;,185,&ordm;,186,&raquo;,187,&frac14;,188,&frac12;,189,&frac34;,190)
  769.     var %text = $replace(%text,&iquest;,191,&Agrave;,192,&Aacute;,193,&Acirc;,194,&Atilde;,195,&Auml;,196,&Aring;,197,&AElig;,198,&Ccedil;,199,&Eacute;,201,&Ecirc;,202)
  770.     var %text = $replace(%text,&Euml;,203,&Igrave;,204,&Iacute;,205,&Icirc;,206,&Iuml;,207,&ETH;,208,&Ntilde;,209,&Ograve;,210,&Oacute;,211,&Ocirc;,212,&Otilde;,213)
  771.     var %text = $replace(%text,&Ouml;,214,&times;,215,&Oslash;,216,&Ugrave;,217,&Uacute;,218,&Ucirc;,219,&Uuml;,220,&Yacute;,221,&THORN;,222,&szlig;,223,&agrave;,224)
  772.     var %text = $replace(%text,&aacute;,225,&acirc;,226,&atilde;,227,&auml;,228,&aring;,229,&aelig;,230,&ccedil;,231,&egrave;,232,&eacute;,233,&ecirc;,234,&euml;,235)
  773.     var %text = $replace(%text,&igrave;,236,&iacute;,237,&icirc;,238,&iuml;,239,&eth;,240,&ntilde;,241,&ograve;,242,&oacute;,243,&ocirc;,244,&otilde;,245,&ouml;,246)
  774.     var %text = $replace(%text,&divide;,247,&oslash;,248,&ugrave;,249,&uacute;,250,&ucirc;,251,&uuml;,252,&yacute;,253,&thorn;,254,&yuml;,255,&apos;,39,&amp;,38,&lt;,60,&gt;,62,&quot;,34)
  775.     var %text = $replacecs(%text,&Egrave;,200,&egrave;,232)
  776.   }
  777.   var %text = $regsubex(%text,/&#(\d+);/g,$chr(\t))
  778.   if ( %text == $1- ) { bset -t &htmlentity 1 %text }
  779.   else { bset &htmlentity 1 %text }
  780. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top