Source for file class.Mail.inc

Documentation is available at class.Mail.inc

  1. <?php //-*-php-*-
  2. /* ******************************************************************** **
  3. ** Copyright notice **
  4. ** **
  5. ** (c) 1995-2003 PHPOpenChat Development Team **
  6. ** http://phpopenchat.sourceforge.net/ **
  7. ** **
  8. ** All rights reserved **
  9. ** **
  10. ** This script is part of the PHPOpenChat project. The PHPOpenChat **
  11. ** project is free software; you can redistribute it and/or modify **
  12. ** it under the terms of the GNU General Public License as published by **
  13. ** the Free Software Foundation; either version 2 of the License, or **
  14. ** (at your option) any later version. **
  15. ** **
  16. ** The GNU General Public License can be found at **
  17. ** http://www.gnu.org/copyleft/gpl.html. **
  18. ** A copy is found in the textfile GPL and important notices to the **
  19. ** license from the team is found in the textfile LICENSE distributed **
  20. ** with these scripts. **
  21. ** **
  22. ** This script is distributed in the hope that it will be useful, **
  23. ** but WITHOUT ANY WARRANTY; without even the implied warranty of **
  24. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
  25. ** GNU General Public License for more details. **
  26. ** **
  27. ** This copyright notice MUST APPEAR in all copies of the script! **
  28. ** ******************************************************************** */
  29.  
  30. //Get default values
  31. require_once(POC_BASE.'/config.inc.php');
  32. require_once(POC_INCLUDE_PATH.'/class.Logger.inc');
  33.  
  34. /**
  35. * Mail implements a mail within the chat
  36. *
  37. * @author Michael Oertel <michael@ortelius.de>
  38. * @access public
  39. * @version $Id: class.Mail.inc,v 1.10 2003/08/06 12:19:36 letreo Exp $
  40. */
  41. class Mail {
  42.  
  43. /**
  44. * Sender of mail
  45. *
  46. * @var object
  47. */
  48. var $sender = null;
  49. /**
  50. * Recipients of mail
  51. *
  52. * @var array
  53. */
  54. var $recipients = array();
  55. /**
  56. * Recipient of mail
  57. *
  58. * @var string
  59. */
  60. var $recipient = '';
  61. /**
  62. * Body of mail
  63. *
  64. * @var string
  65. */
  66. var $body = '';
  67. /**
  68. * Subject of mail
  69. *
  70. * @var string
  71. */
  72. var $subject = '';
  73. /**
  74. * Send time of mail
  75. *
  76. * @var integer
  77. */
  78. var $send_time = 0;
  79. /**
  80. * Time of last touch by sender
  81. *
  82. * @var integer
  83. */
  84. var $last_touch_sender = 0;
  85. /**
  86. * Time of last touch by recipient
  87. *
  88. * @var integer
  89. */
  90. var $last_touch_recipient = 0;
  91. /**
  92. * Time of first touch by recipient
  93. *
  94. * @var integer
  95. */
  96. var $first_touch_recipient = 0;
  97.  
  98. /**
  99. * Status flag of mail
  100. *
  101. * @var boolean
  102. */
  103. var $red_by_sender = false;
  104.  
  105. /**
  106. * Status flag of mail
  107. *
  108. * @var boolean
  109. */
  110. var $red_by_recipient = false;
  111.  
  112. function Mail()
  113. {
  114. $this->sender = $_SESSION['chatter'];
  115. }
  116.  
  117. /**
  118. * Adds a chatter to the list of recipients
  119. *
  120. * @access public
  121. * @param string
  122. */
  123. function add_recipient( $recipient )
  124. {
  125. if( !$this->is_in_recipients($recipient) )
  126. array_push ($this->recipients, $recipient);
  127. }
  128.  
  129. /**
  130. * Sets the subject
  131. *
  132. * @access public
  133. * @param string
  134. */
  135. function set_subject( $subject )
  136. {
  137. $this->subject = $subject;
  138. }
  139.  
  140. /**
  141. * Provides the subject of mail
  142. *
  143. * @access public
  144. * @return string
  145. */
  146. function get_subject()
  147. {
  148. return $this->subject;
  149. }
  150. /**
  151. * Sets the send time
  152. *
  153. * @access public
  154. * @param integer
  155. */
  156. function set_send_time( $unix_timestamp )
  157. {
  158. $this->send_time = $unix_timestamp;
  159. }
  160. /**
  161. * Gets the send time
  162. *
  163. * @access public
  164. * @return integer
  165. */
  166. function get_send_time()
  167. {
  168. return $this->send_time;
  169. }
  170.  
  171. /**
  172. * Sets the subject
  173. *
  174. * @access public
  175. * @param string
  176. */
  177. function set_body( $body )
  178. {
  179. $this->body = $body;
  180. }
  181.  
  182. /**
  183. * Gets the body of current mail
  184. *
  185. * @access public
  186. * @param string
  187. */
  188. function get_body()
  189. {
  190. return $this->body;
  191. }
  192. /**
  193. * Gets the sender
  194. *
  195. * @access public
  196. * @return string
  197. */
  198. function get_sender()
  199. {
  200. return $this->sender;
  201. }
  202. /**
  203. * Gets the sender
  204. *
  205. * @access public
  206. * @return array
  207. */
  208. function get_recipients()
  209. {
  210. return $this->recipients;
  211. }
  212. function set_recipient( $recipient )
  213. {
  214. $this->recipient = $recipient;
  215. }
  216. function get_recipient()
  217. {
  218. return $this->recipient;
  219. }
  220. function is_forwarded()
  221. {
  222. }
  223. function is_replied()
  224. {
  225. }
  226. /**
  227. * Sets red_by_recipient flag
  228. */
  229. function set_red_by_recipient()
  230. {
  231. $this->red_by_recipient = true;
  232. }
  233.  
  234. /**
  235. * Sets red flag
  236. */
  237. function set_red_by_sender()
  238. {
  239. $this->red_by_sender = true;
  240. }
  241. /**
  242. * Returns true if mail is red by recipient, otherwise false
  243. *
  244. * @return boolean
  245. */
  246. function get_red_by_recipient()
  247. {
  248. return $this->red_by_recipient;
  249. }
  250. /**
  251. * @ignore
  252. */
  253. function is_red_by_recipient()
  254. {
  255. return $this->get_red_by_recipient();
  256. }
  257.  
  258. /**
  259. * Returns true if mail is red, otherwise false
  260. *
  261. * @return boolean
  262. */
  263. function get_red_by_sender()
  264. {
  265. return $this->red_by_sender;
  266. }
  267. /**
  268. * @ignore
  269. */
  270. function is_red_by_sender()
  271. {
  272. return $this->get_red_by_sender();
  273. }
  274. /**
  275. * Returns true if given chatter already in recipient list, otherwise false
  276. *
  277. * @param string
  278. * @return boolean
  279. */
  280. function is_in_recipients( $chatter )
  281. {
  282. return in_array( $chatter, $this->recipients );
  283. }
  284. /**
  285. * Sets the time of last touch by sender
  286. *
  287. */
  288. function set_last_touch_sender()
  289. {
  290. $this->last_touch_sender = time();
  291. }
  292. /**
  293. * Gets the time of last touch by sender
  294. *
  295. */
  296. function get_last_touch_sender()
  297. {
  298. return $this->last_touch_sender;
  299. }
  300. /**
  301. * Sets the time of last touch by recipient
  302. *
  303. */
  304. function set_last_touch_recipient()
  305. {
  306. $this->last_touch_recipient = time();
  307. }
  308. /**
  309. * Gets the time of last touch by recipient
  310. *
  311. */
  312. function get_last_touch_recipient()
  313. {
  314. return $this->last_touch_recipient;
  315. }
  316. /**
  317. * Sets the time of first touch by recipient
  318. *
  319. */
  320. function set_first_touch_recipient()
  321. {
  322. $this->first_touch_recipient = time();
  323. }
  324. /**
  325. * Gets the time of first touch by recipient
  326. *
  327. */
  328. function get_first_touch_recipient()
  329. {
  330. return $this->first_touch_recipient;
  331. }
  332. }
  333. ?>

Documentation generated on Tue, 29 Jun 2004 14:42:10 +0200 by phpDocumentor 1.3.0RC3