You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
6.1 KiB

3 years ago
  1. <!doctype html>
  2. <title>CodeMirror: Tcl mode</title>
  3. <meta charset="utf-8"/>
  4. <link rel=stylesheet href="../../doc/docs.css">
  5. <link rel="stylesheet" href="../../lib/codemirror.css">
  6. <link rel="stylesheet" href="../../theme/night.css">
  7. <script src="../../lib/codemirror.js"></script>
  8. <script src="tcl.js"></script>
  9. <script src="../../addon/scroll/scrollpastend.js"></script>
  10. <div id=nav>
  11. <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  12. <ul>
  13. <li><a href="../../index.html">Home</a>
  14. <li><a href="../../doc/manual.html">Manual</a>
  15. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  16. </ul>
  17. <ul>
  18. <li><a href="../index.html">Language modes</a>
  19. <li><a class=active href="#">Tcl</a>
  20. </ul>
  21. </div>
  22. <article>
  23. <h2>Tcl mode</h2>
  24. <form><textarea id="code" name="code">
  25. ##############################################################################################
  26. ## ## whois.tcl for eggdrop by Ford_Lawnmower irc.geekshed.net #Script-Help ## ##
  27. ##############################################################################################
  28. ## To use this script you must set channel flag +whois (ie .chanset #chan +whois) ##
  29. ##############################################################################################
  30. ## ____ __ ########################################### ##
  31. ## / __/___ _ ___ _ ___/ /____ ___ ___ ########################################### ##
  32. ## / _/ / _ `// _ `// _ // __// _ \ / _ \ ########################################### ##
  33. ## /___/ \_, / \_, / \_,_//_/ \___// .__/ ########################################### ##
  34. ## /___/ /___/ /_/ ########################################### ##
  35. ## ########################################### ##
  36. ##############################################################################################
  37. ## ## Start Setup. ## ##
  38. ##############################################################################################
  39. namespace eval whois {
  40. ## change cmdchar to the trigger you want to use ## ##
  41. variable cmdchar "!"
  42. ## change command to the word trigger you would like to use. ## ##
  43. ## Keep in mind, This will also change the .chanset +/-command ## ##
  44. variable command "whois"
  45. ## change textf to the colors you want for the text. ## ##
  46. variable textf "\017\00304"
  47. ## change tagf to the colors you want for tags: ## ##
  48. variable tagf "\017\002"
  49. ## Change logo to the logo you want at the start of the line. ## ##
  50. variable logo "\017\00304\002\[\00306W\003hois\00304\]\017"
  51. ## Change lineout to the results you want. Valid results are channel users modes topic ## ##
  52. variable lineout "channel users modes topic"
  53. ##############################################################################################
  54. ## ## End Setup. ## ##
  55. ##############################################################################################
  56. variable channel ""
  57. setudef flag $whois::command
  58. bind pub -|- [string trimleft $whois::cmdchar]${whois::command} whois::list
  59. bind raw -|- "311" whois::311
  60. bind raw -|- "312" whois::312
  61. bind raw -|- "319" whois::319
  62. bind raw -|- "317" whois::317
  63. bind raw -|- "313" whois::multi
  64. bind raw -|- "310" whois::multi
  65. bind raw -|- "335" whois::multi
  66. bind raw -|- "301" whois::301
  67. bind raw -|- "671" whois::multi
  68. bind raw -|- "320" whois::multi
  69. bind raw -|- "401" whois::multi
  70. bind raw -|- "318" whois::318
  71. bind raw -|- "307" whois::307
  72. }
  73. proc whois::311 {from key text} {
  74. if {[regexp -- {^[^\s]+\s(.+?)\s(.+?)\s(.+?)\s\*\s\:(.+)$} $text wholematch nick ident host realname]} {
  75. putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Host:${whois::textf} \
  76. $nick \(${ident}@${host}\) ${whois::tagf}Realname:${whois::textf} $realname"
  77. }
  78. }
  79. proc whois::multi {from key text} {
  80. if {[regexp {\:(.*)$} $text match $key]} {
  81. putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Note:${whois::textf} [subst $$key]"
  82. return 1
  83. }
  84. }
  85. proc whois::312 {from key text} {
  86. regexp {([^\s]+)\s\:} $text match server
  87. putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Server:${whois::textf} $server"
  88. }
  89. proc whois::319 {from key text} {
  90. if {[regexp {.+\:(.+)$} $text match channels]} {
  91. putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Channels:${whois::textf} $channels"
  92. }
  93. }
  94. proc whois::317 {from key text} {
  95. if {[regexp -- {.*\s(\d+)\s(\d+)\s\:} $text wholematch idle signon]} {
  96. putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Connected:${whois::textf} \
  97. [ctime $signon] ${whois::tagf}Idle:${whois::textf} [duration $idle]"
  98. }
  99. }
  100. proc whois::301 {from key text} {
  101. if {[regexp {^.+\s[^\s]+\s\:(.*)$} $text match awaymsg]} {
  102. putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Away:${whois::textf} $awaymsg"
  103. }
  104. }
  105. proc whois::318 {from key text} {
  106. namespace eval whois {
  107. variable channel ""
  108. }
  109. variable whois::channel ""
  110. }
  111. proc whois::307 {from key text} {
  112. putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Services:${whois::textf} Registered Nick"
  113. }
  114. proc whois::list {nick host hand chan text} {
  115. if {[lsearch -exact [channel info $chan] "+${whois::command}"] != -1} {
  116. namespace eval whois {
  117. variable channel ""
  118. }
  119. variable whois::channel $chan
  120. putserv "WHOIS $text"
  121. }
  122. }
  123. putlog "\002*Loaded* \017\00304\002\[\00306W\003hois\00304\]\017 \002by \
  124. Ford_Lawnmower irc.GeekShed.net #Script-Help"
  125. </textarea></form>
  126. <script>
  127. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  128. theme: "night",
  129. lineNumbers: true,
  130. indentUnit: 2,
  131. scrollPastEnd: true,
  132. mode: "text/x-tcl"
  133. });
  134. </script>
  135. <p><strong>MIME types defined:</strong> <code>text/x-tcl</code>.</p>
  136. </article>