Main Page   Compound List   File List   Compound Members   File Members  

zaway.vtc

Go to the documentation of this file.
00001 /* -*- C -*- */
00014 Load("zsend");
00015 Load("zsend-zwrite");
00016 
00023 zaway = 0;
00024 
00036 func Zaway(s) {
00037     if (s && strlen(s))
00038         zaway = wrap(s, 60);
00039     else
00040         zaway = "Away for a while.";
00041     add_status(cur_win, "[ZAWAY ON]", 1);
00042 
00043     zout = new_zoutgoing();
00044     zout->class = getenv("USER");
00045     zout->instance = "zaway";
00046     zout->opcode = "zaway";
00047     zout->body = zaway;
00048     zout->sender = .zsend_zwrite;
00049     zout_send(zout);
00050 }
00051 
00059 func Zback() {
00060     zaway = 0;
00061     del_status(cur_win, "[ZAWAY ON]");
00062 
00063     zout = new_zoutgoing();
00064     zout->class = getenv("USER");
00065     zout->instance = "zaway";
00066     zout->opcode = "zaway";
00067     zout->body = "Back now.";
00068     zout->sender = .zsend_zwrite;
00069     zout_send(zout);
00070 }
00071 
00072 add_cmd("zaway", -1, .Zaway, "/zaway <message>");
00073 add_cmd("zback", 0, .Zback, "/zback");
00074 
00089 func zaway_respond(z, sig)
00090 {
00091   /* Don't respond if we're not away. */
00092   if (!zaway)
00093     return;
00094   
00095   /* Don't respond if the message isn't personal. */
00096   if (!z->personal)
00097     return;
00098 
00099   /* Don't respond to pings or zaway messages. */
00100   if (stricmp(z->opcode, "ping") == 0 ||
00101       stricmp(z->opcode, "zaway") == 0)
00102     return;
00103   
00104   /* Only respond to personal messages on class message. */
00105   if (stricmp(z->class, "message") != 0)
00106     return;
00107 
00108   /* Don't respond if the zephyr we're responding to is a reply. */
00109   if (stricmp(sig, "automated reply:") == 0)
00110     return;
00111 
00112   /* Actually reply. */
00113   zout = new_zoutgoing();
00114   zout->recip = z->sender;
00115   zout->opcode = "zaway";
00116   zout->body = zaway;
00117   zout->sig = "Automated reply:";
00118   zout->sender = .zsend_zwrite;
00119   zout_send(zout);
00120 }

Generated at Mon Aug 13 16:45:52 2001 for dzm-vtc by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001