Advertisement
LoveAbleElf

tellz

Aug 10th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.65 KB | None | 0 0
  1. on *:TEXT:*:#: {
  2. if ($1 = .tell) {
  3. if (!$3) { .msg $chan $nick $+ , you must specify a message for me to relay | return }
  4. var %x $nick
  5. var %c $chan
  6. var %r $2
  7. var %t $time(HH:nn:ss)
  8. var %d $adate
  9. var %a $address($nick,2)
  10. if ($hfind(tellz,$+([*],%r,[*]),0,w)) { hadd tellz $+([,%a,],%r,[,$calc($hfind(tellz,$+([*],%r,[*]),0,w) + 1),]) $+([,$network,:,%c,]) %d - %t $+(<,%x,>) tell %r $3- | .msg %c %x $+ , I'll pass it on when %r is around. }
  11. elseif (!$hfind(tellz,$+([*],%r,[*]),0,w)) { hadd -m tellz $+([,%a,],%r,[1]) $+([,$network,:,%c,]) %d - %t $+(<,%x,>) tell %r $3- | .msg %c %x $+ , I'll pass it on when %r is around. }
  12. }
  13. if ($1 = .tellhelp) { .msg # .tell is an IRC messaging service designed to relay messages to users who are offline or away. Syntax: .tell <nick> <msg> Example: .tell Siri example message. This message will be relayed to Siri whenever they say something in a channel I occupy. If you wish to access user functions, query me and type .thelp for a list of commands. If you have any issues, contact orkin. }
  14. if ($hfind(tellz,$+([*],$nick,[*]),0,w)) {
  15. var %x 1
  16. var %y 2
  17. while ($hget(tellz,$hfind(tellz,$+([*],$nick,[,%x,]),1,w))) {
  18. .timer $+ %x -o 1 %y .msg $chan $hget(tellz,$hfind(tellz,$+([*],$nick,[,%x,]),1,w)) | hdel tellz $hfind(tellz,$+([*],$nick,[,%x,]),1,w)
  19. inc %x
  20. inc %y 2
  21. }
  22. }
  23. }
  24. on *:ACTION:*:*: {
  25. if ($network = evilnet && $chan = #orkin) {
  26. if ($hfind(tellz,$+([*],$nick,[*]),0,w)) {
  27. var %x 1
  28. var %y 2
  29. while ($hget(tellz,$hfind(tellz,$+([*],$nick,[,%x,]),1,w))) {
  30. .timer $+ %x -o 1 %y .msg $chan $hget(tellz,$hfind(tellz,$+([*],$nick,[,%x,]),1,w)) | hdel tellz $hfind(tellz,$+([*],$nick,[,%x,]),1,w)
  31. inc %x
  32. inc %y 2
  33. }
  34. }
  35. }
  36. }
  37. on *:TEXT:*:?: {
  38. if ($1 = .thelp) {
  39. .msg $nick To view messages sent from $address($nick,2) type .umsgs Note: All messages are indexed by the senders user address (*!*@example.users.undernet.org)
  40. .msg $nick You can delete a message by typing .umsgs del <msg#> Example: To delete the 3rd message in your outbox, type .umsgs del 3 To delete all outgoing messages, type .umsgs delall
  41. .msg $nick If you need to redirect an existing message to a new recipient, use .umsgs redir <msg#> <newRecipient>. Example: To redirect the 3rd message in your outbox to Gary, type .umsgs redir 3 Gary
  42. }
  43. if ($1 = .umsgs) {
  44. var %a $address($nick,2)
  45. if ($hfind(tellz,$+([,%a,],*),0,w)) {
  46. var %b $v1
  47. if (!$2) {
  48. var %x 1
  49. .msg $nick Listing $+(,%b,) outgoing messages for %a
  50. var %y 2
  51. while ($hfind(tellz,$+([,%a,],*),%x,w)) {
  52. .timer $+ %x -o 1 %y .msg $nick $+(,%x,.) $remove($hfind(tellz,$+([,%a,],*),%x,w),$+([,%a,]),$right($hfind(tellz,$+([,%a,],*),%x,w),3)) $+ $chr(58) $hget(tellz,$hfind(tellz,$+([,%a,],*),%x,w))
  53. inc %x
  54. inc %y 2
  55. }
  56. }
  57. if ($2 = del) {
  58. if (!$3) { .msg $nick Incorrect syntax. Please use .umsgs del <message#> Example: .umsgs del 2 }
  59. if ($hfind(tellz,$+([,%a,],*),$3,w)) {
  60. var %q $remove($hfind(tellz,$+([,%a,],*),$3,w),$+([,%a,]),$right($hfind(tellz,$+([,%a,],*),$3,w),3))
  61. hdel tellz $hfind(tellz,$+([,%a,],*),$3,w)
  62. .msg $nick Deleted the $ord($3) nessage from your outbox.
  63. t.order %q
  64. }
  65. elseif (!$hfind(tellz,$+([,%a,],*),$3,w)) { .msg $nick Message $chr(35) $+ $3 does not exist. Use .umsgs to view all your outgoing messages. }
  66. }
  67. if ($2 = delall) {
  68. var %z $hfind(tellz,$+([,%a,]*),0,w)
  69. .msg $nick Deleted %z messages originating from %a
  70. while (%z) {
  71. var %q $remove($hfind(tellz,$+([,%a,]*),%z,w),$+([,%a,]),$right($hfind(tellz,$+([,%a,]*),%z,w),3))
  72. hdel tellz $hfind(tellz,$+([,%a,]*),%z,w)
  73. t.order %q
  74. dec %z
  75. }
  76. }
  77. if ($2 = redir) {
  78. if (!$4 || $3 !isnum) { .msg $nick Incorrect Syntax. Please use .umsgs redir <msg#> <newRecipient> Example: .umsgs redir 3 johnm will redirect the 3rd message in your outbox to johnm. }
  79. if ($hfind(tellz,$+([,%a,],*),$3,w)) {
  80. var %b $v1
  81. var %t $remove($hfind(tellz,$+([,%a,],*),$3,w),$+([,%a,]),$right($hfind(tellz,$+([,%a,],*),$3,w),3)),$4)
  82. $iif($hfind(tellz,$+([*],$4,[*]),0,w),hadd tellz $+([,%a,],$4,[,$calc($v1 + 1),]) $replace($hget(tellz,%b),$remove($hfind(tellz,$+([,%a,],*),$3,w),$+([,%a,]),$right($hfind(tellz,$+([,%a,],*),$3,w),3)),$4),hadd -m tellz $+([,%a,],$4,[1]) $replace($hget(tellz,%b),$remove($hfind(tellz,$+([,%a,],*),$3,w),$+([,%a,]),$right($hfind(tellz,$+([,%a,],*),$3,w),3)),$4))
  83. hdel tellz %b
  84. t.order $4 | t.order %t
  85. .msg $nick Redirected your $ord($3) message to $4
  86. }
  87. }
  88. }
  89. elseif (!$hfind(tellz,$+([,%a,],*),0,w)) { .msg $nick The are no messages waiting to be sent from %a }
  90. }
  91. if ($nick = orkin || $nick = Alan) {
  92. if ($1 = .tmsgs) {
  93. if (!$2) {
  94. if ($hfind(tellz,*[1],0,w)) {
  95. var %x $v1
  96. .msg $nick $+(,%x,) recipients in inbox. Sending list now...
  97. var %y 2
  98. while (%x) {
  99. .timer $+ %x -o 1 %y .msg $nick $remove($hfind(tellz,*[1],%x,w),[1],$left($hfind(tellz,*[1],%x,w),$pos($hfind(tellz,*[1],%x,w),],1))) $+([,$hfind(tellz,$+([*],$remove($hfind(tellz,*[1],%x,w),[1],$left($hfind(tellz,*[1],%x,w),$pos($hfind(tellz,*[1],%x,w),],1))),[*]),0,w),])
  100. dec %x
  101. inc %y 2
  102. }
  103. }
  104. elseif (!$hfind(tellz,*[1],0,w)) { .msg $nick No messages currently in my inbox }
  105. }
  106. elseif ($2) {
  107. if ($hfind(tellz,$+([*],$2,[*]),0,w)) {
  108. var %z 1
  109. .msg $nick Listing $+(,$v1,) messages for $2
  110. var %y 2
  111. while ($hfind(tellz,$+([*],$2,[*]),%z,w)) {
  112. .timer $+ %z -o 1 %y .msg $nick $+(,%z,.,) $hget(tellz,$hfind(tellz,$+([*],$2,[*]),%z,w))
  113. inc %z
  114. inc %y 2
  115. }
  116. }
  117. elseif (!$hfind(tellz,$+([*],$2,[*]),0,w)) { .msg $nick No messages for $2 }
  118. }
  119. }
  120. if ($1 = .telldel) {
  121. if ($3 isnum) {
  122. if ($hfind(tellz,$+([*],$2,[,$3,]),1,w)) { hdel tellz $hfind(tellz,$+([*],$2,[,$3,]),1,w) | .msg $nick Deleted $ord($3) message for $2 | .t.order $2 }
  123. elseif (!$hfind(tellz,$+([*],$2,[,$3,]),1,w)) { $iif($hfind(tellz,$+([*],$2,[1]),1,w),$iif($hfind(tellz,$+([*],$2,[*]),0,w) = 1,.msg $nick $2 only has 1 message to delete. To delete $+ $chr(44) please input .telldel $2 1,.msg $nick $2 doesn't have a $ord($3) message. Please input a number from 1 to $hfind(tellz,$+([*],$2,[*]),0,w)),.msg $nick $2 has no mesages to delete) }
  124. }
  125. elseif ($3 !isnum) { halt | .msg $nick Incorrect syntax. Please use .telldel <nick> <msg#> Example: .telldel Alan 1 }
  126. }
  127. if ($1 = .tswt) {
  128. if (!$4) { .msg $nick Incorrect syntax. Please use .tswt <nickswitched> <switchednick> <nickswitched message #> Example: if you want to switch message #1 from Alan to volsfan you would input .tswt Alan volsfan 1. }
  129. if ($hfind(tellz,$+([*],$2,[*]),$4,w)) {
  130. hadd -m tellz $+($left($hfind(tellz,$+([*],$2,[*]),$4,w),$pos($hfind(tellz,$+([*],$2,[*]),$4,w),],1)),$3,[,$iif($hfind(tellz,$+([*],$3,[*]),0,w),$calc($hfind(tellz,$+([*],$3,[*]),0,w) + 1),1),]) $replace($hget(tellz,$hfind(tellz,$+([*],$2,[*]),$4,w)),$2,$3)
  131. hdel tellz $hfind(tellz,$+([*],$2,[*]),$4,w) | t.order $2 | t.order $3
  132. .msg $nick Sent $ord($4) message for $2 to $3 $+ 's inbox.
  133. }
  134. elseif (!$hfind(tellz,$+([*],$2,[*]),$4,w)) { $iif($hfind(tellz,$+([*],$2,[*]),0,w),.msg $nick Inbox entry $chr(35) $+ $4 for $2 does not exist,.msg $nick There are no messages for $2) }
  135. }
  136. }
  137. }
  138. alias t.order {
  139. var %x $hfind(tellz,$+([*],$1,[*]),0,w)
  140. var %y 1
  141. while (%y <= %x) {
  142. var %z $hfind(tellz,$+([*],$1,[*]),%y,w)
  143. var %w $hget(tellz,%z)
  144. hadd -m tellz1 %y $remove(%z,$right(%z,3)) $+ $+([,%y,]) %w
  145. inc %y
  146. }
  147. t.write $1
  148. }
  149. alias t.write {
  150. hdel -w tellz $+([*],$1,[*])
  151. var %x $hget(tellz1,0).item
  152. while (%x) {
  153. hadd tellz $hget(tellz1,%x)
  154. dec %x
  155. }
  156. $iif($hget(tellz1),hfree tellz1)
  157. }
  158. on *:LOAD: { if ($hget(tellz)) { hfree tellz | $iif($isfile(tellz.ini),remove tellz.ini) | hmake tellz 100 | .amsg Rebooted .tell system. All messages have been cleared. | hadd tellz [*!*@orkin.users.undernet.org]orkin[1] $adate - $time(HH:nn:ss) .tell script updated. } }
  159. on *:EXIT: { $iif($hget(tellz,0).item > 0,hsave tellz tellz.ini,$iif($isfile(tellz.ini),.remove tellz.ini)) }
  160. on *:START: { if (!$hget(tellz)) { hmake tellz 100 | $iif($isfile(tellz.ini),hload tellz tellz.ini) } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement