Advertisement
Kar27

Email server

Sep 6th, 2012
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.06 KB | None | 0 0
  1. --[[ Config File ]]--
  2. modem = "back" --[[ Where the modem is at?
  3. (front, back, top, bottom, right, left) ]]--
  4.  
  5. --[[ End of Config ]]--
  6.  
  7. --[[ Start of program ]]--
  8. rednet.open(modem)
  9. os.pullEvent = os.pullEventRaw
  10. term.clear()
  11. term.setCursorPos(1,1)
  12. serverID = os.computerID()
  13. print "You can't use this computer because its a server!"
  14. print ""
  15. print("Server ID: " ..serverID)
  16. print "-------------"
  17. print "Logs:"
  18. print ""
  19. while true do
  20. info, msg, distance = rednet.receive()
  21. info, to, distance2 = rednet.receive()
  22. info, from, distance3 = rednet.receive()
  23. print("Message recived from: " ..from)
  24. print("Sending message to: " ..to)
  25. if (to == "10") then
  26. rednet.send(info, "Message Recived")
  27. loop10 = true
  28. while (loop10 == true) do
  29. rednet.send(10, msg)
  30. rednet.send(10, from)
  31. event, id, text = os.pullEvent()
  32. if (event == "rednet_message") then
  33. if (text == "Recived") then
  34. loop10 = false
  35. print ""
  36. print "Message Sent"
  37. print "---------------"
  38. end
  39. end
  40. end
  41. elseif (to == "9") then
  42. rednet.send(info, "Message Recived")
  43. loop9 = true
  44. while (loop9 == true) do
  45. rednet.send(9, msg)
  46. rednet.send(9, from)
  47. event, id, text = os.pullEvent()
  48. if (event == "rednet_message") then
  49. if (text == "Recived") then
  50. loop9 = false
  51. print ""
  52. print "Message Sent"
  53. print "---------------"
  54. end
  55. end
  56. end
  57. elseif (to == "8") then
  58. rednet.send(info, "Message Recived")
  59. loop8 = true
  60. while (loop8 == true) do
  61. rednet.send(8, msg)
  62. rednet.send(8, from)
  63. event, id, text = os.pullEvent()
  64. if (event == "rednet_message") then
  65. if (text == "Recived") then
  66. loop8 = false
  67. print ""
  68. print "Message Sent"
  69. print "---------------"
  70. end
  71. end
  72. end
  73.  
  74. elseif (to == "7") then
  75. rednet.send(info, "Message Recived")
  76. loop7 = true
  77. while (loop7 == true) do
  78. rednet.send(7, msg)
  79. rednet.send(7, from)
  80. event, id, text = os.pullEvent()
  81. if (event == "rednet_message") then
  82. if (text == "Recived") then
  83. loop7 = false
  84. print ""
  85. print "Message Sent"
  86. print "---------------"
  87. end
  88. end
  89. end
  90. elseif (to == "6") then
  91. rednet.send(info, "Message Recived")
  92. loop6 = true
  93. while (loop6 == true) do
  94. rednet.send(6, msg)
  95. rednet.send(6, from)
  96. event, id, text = os.pullEvent()
  97. if (event == "rednet_message") then
  98. if (text == "Recived") then
  99. loop6 = false
  100. print ""
  101. print "Message Sent"
  102. print "---------------"
  103. end
  104. end
  105. end
  106.  
  107. elseif (to == "5") then
  108. rednet.send(info, "Message Recived")
  109. loop5 = true
  110. while (loop8 == true) do
  111. rednet.send(5, msg)
  112. rednet.send(5, from)
  113. event, id, text = os.pullEvent()
  114. if (event == "rednet_message") then
  115. if (text == "Recived") then
  116. loop5 = false
  117. print ""
  118. print "Message Sent"
  119. print "---------------"
  120. end
  121. end
  122. end
  123.  
  124. elseif (to == "4") then
  125. rednet.send(info, "Message Recived")
  126. loop4 = true
  127. while (loop8 == true) do
  128. rednet.send(4, msg)
  129. rednet.send(4, from)
  130. event, id, text = os.pullEvent()
  131. if (event == "rednet_message") then
  132. if (text == "Recived") then
  133. loop4 = false
  134. print ""
  135. print "Message Sent"
  136. print "---------------"
  137. end
  138. end
  139. end
  140.  
  141. elseif (to == "3") then
  142. rednet.send(info, "Message Recived")
  143. loop3 = true
  144. while (loop8 == true) do
  145. rednet.send(3, msg)
  146. rednet.send(3, from)
  147. event, id, text = os.pullEvent()
  148. if (event == "rednet_message") then
  149. if (text == "Recived") then
  150. loop3 = false
  151. print ""
  152. print "Message Sent"
  153. print "---------------"
  154. end
  155. end
  156. end
  157.  
  158. elseif (to == "2") then
  159. rednet.send(info, "Message Recived")
  160. loop2 = true
  161. while (loop8 == true) do
  162. rednet.send(2, msg)
  163. rednet.send(2, from)
  164. event, id, text = os.pullEvent()
  165. if (event == "rednet_message") then
  166. if (text == "Recived") then
  167. loop2 = false
  168. print ""
  169. print "Message Sent"
  170. print "---------------"
  171. end
  172. end
  173. end
  174.  
  175. elseif (to == "1") then
  176. rednet.send(info, "Message Recived")
  177. loop1 = true
  178. while (loop8 == true) do
  179. rednet.send(1, msg)
  180. rednet.send(1, from)
  181. event, id, text = os.pullEvent()
  182. if (event == "rednet_message") then
  183. if (text == "Recived") then
  184. loop1 = false
  185. print ""
  186. print "Message Sent"
  187. print "---------------"
  188. end
  189. end
  190. end
  191. else
  192. rednet.send(info, "Error")
  193. print ""
  194. print "Error"
  195. print "---------------"
  196. end
  197. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement