Advertisement
Skreffnet

Socket mIRC - Azuracast servidor icecast

May 20th, 2020 (edited)
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.57 KB | None | 0 0
  1. /**
  2. *
  3. * Creates a listening server.
  4. *
  5. * @command /createListener
  6. *
  7. * @global
  8. *
  9. */
  10. alias createListener {
  11.   if (!$isid) && (!$sock(listener)) socklisten listener 7777
  12.   else error createListener: is not an identifier
  13. }
  14.  
  15. /**
  16. *
  17. * Verifies that incoming connection's IP is that of the project host.
  18. *
  19. * @event socklisten
  20. *
  21. */
  22. on *:socklisten:listener: {
  23.   sockaccept listener_temp
  24.   echo -s : $sock(listener_temp).ip
  25.   if ($sock(listener_temp).ip == $config(project,host)) && (!$sock(listener_check)) {
  26.     sockrename listener_temp listener_check
  27.   }
  28.   else {
  29.     sockclose listener_temp
  30.   }
  31. }
  32.  
  33. /**
  34. *
  35. * Reads the information being transfered and puts it in a temp file
  36. *
  37. * @event sockread
  38. *
  39. */
  40. on *:sockread:listener_check: {
  41.   set -l %temp
  42.  
  43.   sockread %temp
  44.  
  45.   tokenize 32 $sock(listener_check).mark
  46.  
  47.   if (%temp == $null) {
  48.     if ($1 == header) {
  49.       sockmark listener_check body $2 $3
  50.     }
  51.     else {
  52.       sockmark listener_check eof $2 $3
  53.  
  54.       sockwrite -tn listener_check HTTP/1.1 200 OK
  55.       sockwrite -tn listener_check Date: $asctime(ddd $+ $chr(44) d m yyyy h:n:s) GTM
  56.       sockwrite -tn listener_check Content-Type: text/html
  57.       sockwrite -tn listener_check Content-Length: 80
  58.       sockwrite -tn listener_check
  59.       sockwrite -tn listener_check <html>
  60.       sockwrite -tn listener_check <body>
  61.       sockwrite -tn listener_check <h1>You must construct additional pylons!</h1>
  62.       sockwrite -tn listener_check </body>
  63.       sockwrite -tn listener_check </html>
  64.       sockwrite -tn listener_check
  65.     }
  66.   }
  67.   elseif ($0 == 0) {
  68.     tokenize 32 %temp
  69.  
  70.     if ($1 == X-Gitea-Event:) {
  71.       sockmark listener_check header $2 $ticks
  72.     }
  73.   }
  74.   elseif ($1 == body)
  75.   write $qt($+($DATA_FOLDER,temp_,$2,_,$3)) %temp
  76.   echo -s $qt($+($DATA_FOLDER,temp_,$2,_,$3))
  77. }
  78.  
  79. /**
  80. *
  81. * Verifies that the date file exists upon connection closing.
  82. *
  83. * @event sockclose
  84. */
  85. on *:sockclose:listener_check: {
  86.   tokenize 32 $sock(listener_check).mark
  87.  
  88.   set -l %file $+($DATA_FOLDER,temp_,$2,_,$3)
  89.  
  90.   if ($isfile(%file)) {
  91.     set -l %status $config(system,status)
  92.  
  93.     if ((%status == dev) && ($2 == push)) || ($2 == release) {
  94.       ; this line adds a { at the end of the file, which should not be necessary but it is
  95.       write $qt(%file) $chr(125)
  96.  
  97.       if ($jsonCreate(update,%file)) {
  98.         echo -a Repository: $jsonGet(update,repository,name)
  99.         echo -a Contributed by: $jsonGet(update,pusher,username)
  100.  
  101.         noop $jsonDestroy(update)
  102.       }
  103.       else error JSON Failed $v1
  104.     }
  105.  
  106.     .remove $qt(%file)
  107.   }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement