Sophie

Sophie

distrib > Mandriva > 7.2 > i586 > media > updates > by-pkgid > e5919242b1173b67c3c6d55b4eb6e5d5 > files > 655

kdenetwork-2.0.1-1mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML
><HEAD
><TITLE
>Timers</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.57"><LINK
REL="HOME"
TITLE="The KSirc Handbook"
HREF="index.html"><LINK
REL="UP"
TITLE="Programming Your Sirc Client"
HREF="programmingyoursircclient.html"><LINK
REL="PREVIOUS"
TITLE="Userhost requests"
HREF="userhostrequests.html"><LINK
REL="NEXT"
TITLE="Adding file handles to the main select() loop"
HREF="addingfilehandlestothemainselectloop.html"><META
HTTP-EQUIV="Content-Style-Type"
CONTENT="text/css"><LINK
REL="stylesheet"
HREF="common/kde-common.css"
TYPE="text/css"><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=iso-8859-1"><META
HTTP-EQUIV="Content-Language"
CONTENT="en"><LINK
REL="stylesheet"
HREF="common/kde-localised.css"
TYPE="text/css"
TITLE="KDE-English"><LINK
REL="stylesheet"
HREF="common/kde-default.css"
TYPE="text/css"
TITLE="KDE-Default"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#AA0000"
VLINK="#AA0055"
ALINK="#AA0000"
STYLE="font-family: sans-serif;"
><DIV
CLASS="logoheader"
><A
HREF="http://www.kde.org/"
><IMG
SRC="common/logotp3.png"
BORDER="0"
ALT="The K Desktop Environment"
HEIGHT="62"
WIDTH="229"></A
></DIV
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The KSirc Handbook</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="userhostrequests.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 5. Programming Your Sirc Client</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="addingfilehandlestothemainselectloop.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="TIMERS"
>5.5. Timers</A
></H1
><P
>It is possible in sirc to specify an action to be done but delayed, a
certain number of seconds later, just like with ircII's <TT
CLASS="LITERAL"
>/timer</TT
> function.
This is only precise up to the second.</P
><P
>To do this, you call the function <TT
CLASS="LITERAL"
>&#38;timer</TT
> with the number of seconds to
wait as the first argument, and the string to be evaluated as the second
argument.</P
><P
>A third argument can be supplied; it needs to be a non-zero number, and
will be used as the reference number for the timer.  Setting a timer when
another with the same reference number exists will delete the first
timer.  If no number is specified, the timer cannot be deleted.</P
><P
>To delete a timer with reference number <TT
CLASS="LITERAL"
>$n</TT
>, call <TT
CLASS="LITERAL"
>&#38;deltimer($n);</TT
></P
><P
>This is simple enough, but if you really need an example, here comes:
to print "hello" in 10 seconds, you'd do <TT
CLASS="LITERAL"
>&#38;timer(10, "&#38;tell('hello')");</TT
></P
><P
>If you want to be able to cancel it, you'd do
<TT
CLASS="LITERAL"
>&#38;timer(10, "&#38;tell('hello')", 6);</TT
> and then to cancel it you'd do
<TT
CLASS="LITERAL"
>&#38;deltimer(6);</TT
>  It goes without saying that the '6' is arbitrary.</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="userhostrequests.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="addingfilehandlestothemainselectloop.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Userhost requests</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="programmingyoursircclient.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Adding file handles to the main select() loop</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>