bxlog-pisg.bx 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. # bxlog.irc - 'Forces' BitchX to log in separate files - like mIRC
  2. # ver. 1.0 - by dARTh (IRCNet/#varna) (based on the slog.irc by Zed)
  3. # Copyrights encodings by dARTh.
  4. #
  5. # Now logs ABSOLUTELY everything :)
  6. # Send suggestions and bugs (if any) to chron-o-john@usa.net
  7. #
  8. # This IS my first (but not last) script, so I hope you'll like it. :)
  9. # The only command you'll need is /LOG - type it! :-)
  10. ############## CONFIGURATION ###############
  11. # Set this to the directory, you wish your log files to be written
  12. # E.G: ~/logs
  13. @ logdir = [~/logs]
  14. # Set the color scheme (R for red, G for green, W for white, etc..)
  15. # Valid choises are W,R,Y,G,C,B,P,K and X for random.
  16. @ col = [C]
  17. # Set the header symbol:
  18. @ hdr = [>]
  19. # Display the time on startup (Y/N):
  20. @ sht = [Y]
  21. # Log date and time in log files (Y/N);
  22. @ wrt = [Y]
  23. # Do not change anything below *please*!
  24. ############################################
  25. @ col = [$tolower($col)]
  26. @ colup = [$toupper($col)]
  27. @ hdr = [$[1]hdr]
  28. @ logger = [BXLog]
  29. @ logver = [1.0]
  30. @ auth = [$decode(GEEBFCFEGI)]
  31. if ([$auth]!=[$decode($decode(EHEFEFECEGEDEGEFEHEJ))]) @ auth = [$reverse(hTRAd)]
  32. if ([$col]!=[W]&&[$col]!=[R]&&[$col]!=[Y]&&[$col]!=[G]&&[$col]!=[C]&&[$col]!=[B]&&[$col]!=[P]&&[$col]!=[K]||[$col]==[X]) {
  33. @col.0=[w];@col.1=[r];@col.2=[y];@col.3=[g];@col.4=[c];@col.5=[b];@col.6=[p]
  34. @ randcol = [$col[$rand(7)]]
  35. @ col = [$tolower($randcol)]
  36. @ colup = [$toupper($randcol)] }
  37. alias logecho echo $cparse("%K$hdr%$col$hdr%$colup$hdr $0-")
  38. eval logecho %$col\Starting %$colup\BX%$col\Log [%$colup$logver%$col\] by %$colup$tolower($left(1 $auth))%$col$toupper($mid(1 3 $auth))%$colup$tolower($right(1 $auth))%$col\...
  39. if ([$col] == [K]) eval logecho %w It is not advisable to use %KTHIS%w color scheme :)
  40. if ([$wrt]!=[Y]&&[$wrt]!=[N]) {
  41. eval logecho @ wrt = %$col\[%$colup$wrt%$col\]%$colup\ --%$col\ not set properly%$colup\!
  42. @ wrt = [Y] }
  43. if ([$fexist($logdir)]!=[1]) {
  44. logecho %RThe log directory does not exist%W - %Gcreating it%g...
  45. if ([$mkdir($logdir)] != [0]) {
  46. eval logecho Unable to %Wmkdir%colup\ -- check your %Rpermissions%R%W!!!
  47. quit }
  48. if ([$chmod($logdir 700)] != [0]) {
  49. eval logecho Unable to %Wchmod 700%$colup\ -- check your %Rpermissions%R%W!!!
  50. quit }}
  51. eval set format_version $format_version + \$logger [\$logver] by \$tolower($left(1 $auth))\$toupper($mid(1 3 $auth))\$tolower($right(1 $auth))
  52. eval set client_information -)
  53. @ out=[$numwords($format_version)]-1
  54. alias bxlog {
  55. @ bxl = open($logdir/$tolower($0) W)
  56. if ([$wrt]==[Y]) {
  57. @ write($bxl [$word(2 $stime($time())) $word(1 $stime($time()))/$Z] $stripc($stripansicodes($strip( $1-)))) }{
  58. @ write($bxl $stripc($stripansicodes($strip( $1-)))) }
  59. @ close($bxl) }
  60. alias log {
  61. @log = [$tolower($0)]
  62. if ([$1]!=[on]&&[$1]!=[off]&&[$1]!=[view]&&[$1]!=[del]) {
  63. eval logecho Usage%$col\:%$colup\ /%$col\LOG %Y<%Cnick%W|%Bchannel%Y%W|%Y<%Cnick%Y>%W.dcc|%Rctcp%Y> %Y<%Gon%W|%Roff%W|%Cview%W|%Bdel%Y> }{
  64. if ([$1]==[on]) {
  65. if ([$fexist($logdir/$log\.log)]!=[1]) {
  66. eval logecho A log for %W$log%$colup\ does %Rnot%$colup\ exist%W!! }{
  67. @ chmod($logdir/$log\.log 644)
  68. bxlog $log\.log >> Logging On <<
  69. eval logecho Toggled logging for %W$log %$col\[%GOn%$col\] }}
  70. if ([$1] == [off]) {
  71. bxlog $log\.log >> Logging Off <<
  72. @ chmod($logdir/$log\.log 444)
  73. eval logecho Toggled logging for %W$log%W %$col\[%ROff%$col\] }
  74. if ([$1] == [del]) {
  75. if ([$fexist($logdir/$log\.log)]!=[1]) {
  76. eval logecho A log for %W$log%$colup\ does %Rnot%$colup\ exist%W!! }{
  77. eval logecho The log file for %W$log%$colup\ - %Rremoved%W!!
  78. exec rm -f $logdir/"$log".log }}
  79. if ([$1] == [view]) {
  80. if ([$fexist($logdir/$log\.log)]!=[1]) {
  81. eval logecho A log for %W$log%$colup\ does %Rnot%$colup\ exist%W!! }{
  82. eval logecho Displaying the log of %W$log%$colup\:
  83. exec cat $logdir/"$log".log }}}}
  84. on #-msg 371371 * bxlog $0.log <$0> $1-
  85. #on #-send_msg 371371 * bxlog $0.log \($N\) $1-
  86. #on #-notice 371371 * bxlog $0.log -$0\- $1-
  87. #on #-send_notice 371371 * bxlog $0.log =$N= $1-
  88. #on #-dcc_chat 371371 * bxlog $0.dcc.log <$0> $1-
  89. #on #-send_dcc_chat 371371 * bxlog $0.dcc.log \($N\) $1-
  90. on #-public 371371 * bxlog $1.log <$0> $2-
  91. on #-public_ar 371371 * bxlog $1.log [$0> $2-
  92. #on #-send_public 371371 * bxlog $0.log \($N\) $1-
  93. on #-public_notice 371371 * bxlog $1.log -$0\- $2-
  94. #on #-send_action 371371 * {
  95. # if ([$[1]0]==[=]) {
  96. # bxlog $strip(= $0).dcc.log + $N $1- }{
  97. # bxlog $0.log + $N $1- }}
  98. on #-action 371371 * {
  99. if ([$[1]1]==[#]) {
  100. bxlog $1.log * $0 $2- }{
  101. if ([$[1]0] == [=]) {
  102. bxlog $strip(= $0).dcc.log * $strip(= $0) $2- }{
  103. bxlog $0.log * $0 $2- }}}
  104. on #-leave 371371 * bxlog $1.log < $0!$2 has left $1
  105. on #-join 371371 * bxlog $1.log > $0!$2 has joined $1
  106. on #-kick 371371 * bxlog $2.log < $0!$userhost($0) was kicked off $2 by $1!$userhost($1) \($3-\)
  107. on #-topic 371371 * bxlog $1.log @ Topic by $0: $2-
  108. on #-channel_nick 371371 * { if ( [$findw($1 $onchannel($0))] != -1 ) { bxlog $0.log ! $1 is known as $2 }}
  109. on #-channel_signoff 371371 * bxlog $0.log < SignOff: $1!$userhost($1) \($2-\)
  110. on #-mode 371371 * {
  111. if ([$userhost($0)]==[<UNKNOWN>@<UNKNOWN>]) {
  112. bxlog $1.log @ mode $1 [$2-] by $0 }{
  113. bxlog $1.log @ mode $1 [$2-] by $0!$userhost($0) }}
  114. #on #-ctcp 371371 * {
  115. # if ([$userhost($0)]==[<UNKNOWN>@<UNKNOWN>]) {
  116. # bxlog ctcp.log CTCP from $0: $2- }{
  117. # bxlog ctcp.log CTCP form $0!$userhost($0): $2- }}
  118. #on #-ctcp_reply 371371 * bxlog $0.log CTCP $1 reply from $0: $2-
  119. if ([$sht]==[Y]) {
  120. eval logecho %$col\Started on%$colup\: $stime($time()) }{
  121. if ([$sht]!=[N]) { eval logecho @ sht = %$col\[%$colup$sht%$col\]%$colup\ --%$col\ not set properly%$colup\! }}
  122. load stat.bx