+ /**
+ * current state of process
+ *
+ * 0 = pending
+ * 1 = delivered
+ * -1 = failed
+ *
+ *
+ */
+ function state()
+ {
+
+ if ($this->msgid != '') {
+ return 1;
+ }
+
+ // msgid is empty now..
+ // if act_when is greater than now, then it's still pending.
+ if (strtotime($this->act_when) > time()) {
+ return 0;
+ }
+
+ // event id can be filled in with a failed attempt.
+
+ if ($this->event_id > 0) {
+ return -1;
+ }
+
+ // event id is empty, and act_when is in the past... not sent yet..
+
+ return 0; // pending
+
+
+ }
+