comm.c-Dateireferenz

#include <input_to.h>
#include <sys_debug.h>
#include <thing/properties.h>
#include <player/comm.h>
#include <player/base.h>
#include <config.h>
#include <ansi.h>
#include <wizlevels.h>
#include <language.h>
#include <udp.h>
#include <defines.h>
#include <daemon.h>
#include <strings.h>
Include-Abhängigkeitsdiagramm für comm.c:

gehe zum Quellcode dieser Datei

Makrodefinitionen

#define TELLHIST_DISABLED   0
#define TELLHIST_NO_MESSAGE   1
#define TELLHIST_ENABLED   2
#define TELLHIST_LONGLIFE   3
#define ECHO_COST   50
#define ERWIDER_PARAM   ","
#define ZDEBUG(x)

Funktionen

varargs string name (int casus, int demonst)
static int _query_intermud ()
private string * sorted_commpartners (int reversed)
void create ()
void create_super ()
private string permutate (string msg)
varargs int _flush_cache (string arg)
public int TestIgnore (string *arg)
private int check_ignore (mixed ignore, string verb, string name)
private int comm_beep ()
private varargs void add_to_tell_history (string uid, int sent, int recv, string message, string indent, int flags)
protected void clear_tell_history ()
protected void reset (void)
private varargs int _send (object ob, string message, int flag, string indent)
protected varargs int _recv (object ob, string message, int flag, string indent)
varargs int Message (string msg, int flag, string indent, string cname, mixed sender)
static int ignoriere (string str)
static int _msg_beep (string str)
static int _msg_prepend (string str)
static int _communicate (mixed str, int silent)
static int _shout_to_all (mixed str)
varargs int _tell (string who, mixed msg, int intcall)
static int _teile (string str)
static int _erzaehle (string str)
static int _whisper (string str)
static int _remote_whisper (string str)
static int _converse (string arg)
static int _converse_more (mixed str, int silent)
private int is_learner (object o)
static int _shout_to_wizards (mixed str)
static int _echo (string str)
static mixed _set_ignore (mixed arg)
int erwidere (string str)
static int tmhist (string str)
static string * _query_localcmds ()

Variablen

inherit std player channel
inherit std player comm_structs
private int tell_history_enabled = TELLHIST_NO_MESSAGE
private nosave mapping tell_history = ([])
private nosave string * commreceivers = ({})
private nosave string last_comm_partner
private nosave int last_beep_time
static private string * buffer = ({})

Makro-Dokumentation

#define ECHO_COST   50

Definiert in Zeile 40 der Datei comm.c.

Wird benutzt von _echo().

#define ERWIDER_PARAM   ","

Definiert in Zeile 41 der Datei comm.c.

Wird benutzt von erwidere().

#define TELLHIST_DISABLED   0

Definiert in Zeile 35 der Datei comm.c.

Wird benutzt von tmhist().

#define TELLHIST_ENABLED   2

Definiert in Zeile 37 der Datei comm.c.

Wird benutzt von add_to_tell_history() und tmhist().

#define TELLHIST_LONGLIFE   3

Definiert in Zeile 38 der Datei comm.c.

Wird benutzt von clear_tell_history() und tmhist().

#define TELLHIST_NO_MESSAGE   1

Definiert in Zeile 36 der Datei comm.c.

Wird benutzt von tmhist().

#define ZDEBUG ( x   ) 
Wert:
if (find_player("zesstra")\
                       && find_player("zesstra")->QueryProp("zdebug")>3)\
                     tell_object(find_player("zesstra"),"CommDBG: "+x+"\n")

Definiert in Zeile 43 der Datei comm.c.


Dokumentation der Funktionen

static int _communicate ( mixed  str,
int  silent 
) [static]

Definiert in Zeile 533 der Datei comm.c.

Benutzt _unparsed_args(), CAN_PRESAY, IS_LEARNER, ME, name, P_CAN_FLAGS, P_PRESAY, permutate(), players und QueryProp().

00534 {
00535   string  verb;
00536   string  myname;
00537   string  msg;
00538 
00539   if (!str || extern_call()) str=_unparsed_args()||"";
00540   /* str=_unparsed_args()||""; */
00541   verb = query_verb();
00542   if(stringp(verb) && verb[0] == '\'') str = verb[1..] + " " + str;
00543   if (str==""||str==" "||!str)
00544   {
00545     write("Was willst Du sagen?\n");
00546     return 1;
00547   }
00548   msg=permutate(str);
00549 
00550   myname=(((QueryProp(P_INVIS)||!IS_LEARNER(ME))||
00551      !(QueryProp(P_CAN_FLAGS)&CAN_PRESAY)?
00552     "":QueryProp(P_PRESAY))+name())||"";
00553 
00554   object* players = filter(all_inventory(environment()||ME),#'interactive);
00555   string sag_text=break_string(msg, 78, capitalize(myname)+" sagt: ");
00556   string prepended_text;
00557   foreach (object target : players-({ME})) {
00558     if (target->QueryProp(P_DEAF)) continue;
00559     if (target->QueryProp(P_MESSAGE_PREPEND)) {
00560       if (!stringp(prepended_text)) 
00561                 prepended_text=break_string(msg, 78, capitalize(myname)+" sagt: ",
00562                     BS_PREPEND_INDENT);
00563       _send(target,prepended_text,MSGFLAG_SAY);
00564     } else {
00565       _send(target,sag_text,MSGFLAG_SAY);
00566     }
00567   }
00568   if(!silent)
00569     _recv(0, str, MSGFLAG_SAY, "Du sagst: ");
00570   say(sag_text,players);
00571   return 1;
00572 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

static int _converse ( string  arg  )  [static]

Definiert in Zeile 837 der Datei comm.c.

00838 {
00839   write("Mit '**' wird das Gespraech beendet.\n");
00840   if (stringp(arg) && strstr(arg, "-s") == 0)
00841     input_to("_converse_more", INPUT_PROMPT, "]", 1);
00842   else
00843     input_to("_converse_more", INPUT_PROMPT, "]", 0);
00844   return 1;
00845 }

static int _converse_more ( mixed  str,
int  silent 
) [static]

Definiert in Zeile 847 der Datei comm.c.

00848 {
00849   string    cmd;
00850   int     i;
00851   string    myname;
00852 
00853   if (str == "**") {
00854     write("Ok.\n");
00855     return 0;
00856   }
00857   myname=capitalize((((IS_LEARNER(ME) && !QueryProp(P_INVIS) && 
00858                     (QueryProp(P_CAN_FLAGS)&CAN_PRESAY))?
00859           QueryProp(P_PRESAY):"")+name())||"");
00860   if(str != "") _communicate(str, silent);
00861   input_to("_converse_more", INPUT_PROMPT, "]", silent);
00862   return 1;
00863 }

static int _echo ( string  str  )  [static]

Definiert in Zeile 887 der Datei comm.c.

Benutzt _notify_fail(), _unparsed_args(), CAN_ECHO, dtime(), ECHO_COST, IS_LEARNER, IS_SEER, log_file, ME, P_CAN_FLAGS, P_GHOST, P_SP, QueryProp() und SetProp().

00887                              {
00888   if (!IS_SEER(ME) || (!IS_LEARNER(ME) &&
00889            !(QueryProp(P_CAN_FLAGS)&CAN_ECHO)))
00890     return 0;
00891   if (!(str=_unparsed_args())) {
00892     write ("Was moechtest Du 'echoen'?\n");
00893     return 1;
00894   }
00895   if (!IS_LEARNER(this_interactive()))
00896   {
00897     if (QueryProp(P_GHOST))
00898     {
00899       _notify_fail("Ohne Koerper fehlt Dir dazu die noetige magische Kraft.\n");
00900       return 0;
00901     }
00902     if (QueryProp(P_SP)<ECHO_COST)
00903     {
00904       _notify_fail("Du musst erst wieder magische Kraefte sammeln.\n");
00905       return 0;
00906     }
00907     SetProp(P_SP,QueryProp(P_SP)-ECHO_COST);
00908     str=">\b"+str;
00909     log_file("ARCH/ECHO_SEHER", sprintf("%s %s: %s\n", dtime(time()), getuid(),
00910            str));
00911   }
00912   say ( str + "\n");
00913   write ( str + "\n");
00914   return 1;
00915 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

static int _erzaehle ( string  str  )  [static]

Definiert in Zeile 743 der Datei comm.c.

00744 {
00745   string who, message;
00746 
00747   if (!(str=_unparsed_args())) return 0;
00748   if (sscanf(str, "%s %s", who, message) == 2)
00749     return _tell(who, message,1);
00750   return 0;
00751 }

varargs int _flush_cache ( string  arg  ) 

Definiert in Zeile 89 der Datei comm.c.

Benutzt buffer, P_BUFFER und SetProp().

Wird benutzt von Message().

00090 {
00091   switch(arg)
00092   {
00093     case "ein":
00094       SetProp(P_BUFFER, 1);
00095       printf("Der Kobold merkt sich jetzt alles!\n"); break;
00096     case "aus":
00097       SetProp(P_BUFFER, 0);
00098       printf("Der Kobold wird Dich nicht stoeren!\n"); break;
00099     default: if(arg) printf("Der Kobold sagt: kobold ein oder kobold aus\n");
00100   }
00101   if(sizeof(buffer))
00102   {
00103     tell_object(this_object(),
00104     sprintf("Ein kleiner Kobold teilt Dir folgendes mit:\n%s",
00105       implode(buffer, "")));
00106     buffer = ({});
00107   }
00108   return 1;
00109 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

static int _msg_beep ( string  str  )  [static]

Definiert in Zeile 500 der Datei comm.c.

Benutzt notify_fail(), P_MESSAGE_BEEP, QueryProp() und SetProp().

00500                                  {
00501   int beep_interval;
00502   notify_fail("Syntax: klingelton <1 bis 3600 Sekunden> oder klingelton aus\n");
00503   if (stringp(str)) {
00504     if (str=="aus")
00505       SetProp(P_MESSAGE_BEEP,0);
00506     else if ((beep_interval=to_int(str)) > 0 && beep_interval<=3600)
00507       SetProp(P_MESSAGE_BEEP,beep_interval);
00508     else return 0;
00509   }
00510 
00511   beep_interval=(int)QueryProp(P_MESSAGE_BEEP);
00512   write("Ton bei Mitteilungen: "+ 
00513                 (beep_interval ? "aller "+beep_interval+" Sekunden.\n" : "aus.\n"));
00514   return 1;
00515 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

static int _msg_prepend ( string  str  )  [static]

Definiert in Zeile 517 der Datei comm.c.

Benutzt notify_fail(), P_MESSAGE_PREPEND, QueryProp() und SetProp().

00517                                     {
00518   int beep_interval;
00519   notify_fail("Syntax: senderwiederholung ein/aus\n");
00520   if (stringp(str)) {
00521     if (str=="aus")  
00522       SetProp(P_MESSAGE_PREPEND,1);
00523     else if (str=="ein")  
00524       SetProp(P_MESSAGE_PREPEND,0);
00525     else return 0;
00526   }
00527 
00528   write("Senderwiederholung bei Mitteilungen: "+ 
00529                 ((int)QueryProp(P_MESSAGE_PREPEND) ?  "aus" : "ein")+".\n");
00530   return 1;
00531 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

static int _query_intermud (  )  [static]

Definiert in Zeile 923 der Datei comm.c.

Benutzt P_CHANNELS und Query().

00924 {
00925   mixed tmp;
00926   return member(pointerp(tmp=Query(P_CHANNELS))?tmp:({}), "Intermud") > -1;
00927 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

static string* _query_localcmds (  )  [static]

Definiert in Zeile 1073 der Datei comm.c.

Benutzt _query_localcmds().

01074 {
01075   return ({
01076     ({"kobold", "_flush_cache",0,0}),
01077      ({"sag","_communicate",0,0}),
01078      ({"sage","_communicate",0,0}),
01079      ({"'","_communicate",1,0}),
01080      ({"mruf","_shout_to_wizards",0,0}),
01081      ({"mrufe","_shout_to_wizards",0,0}),
01082      ({"ruf","_shout_to_all",0,0}),
01083      ({"rufe","_shout_to_all",0,0}),
01084      ({"erzaehl","_erzaehle",0,0}),
01085      ({"erzaehle","_erzaehle",0,0}),
01086      ({"teil","_teile",0,0}),
01087      ({"teile","_teile",0,0}),
01088      ({"fluester","_whisper",0,0}),
01089      ({"fluestere","_whisper",0,0}),
01090      ({"rfluester","_remote_whisper",0,0}),
01091      ({"rfluestere","_remote_whisper",0,0}),
01092      ({"gespraech","_converse",0,0}),
01093      ({"echo","_echo",0,0}),
01094      ({"ignorier","ignoriere",0,0}),
01095      ({"ignoriere","ignoriere",0,0}),
01096      ({"tmhist","tmhist",0,0}),
01097      ({"erwider","erwidere",0,0}),
01098      ({"erwidere","erwidere",0,0}),
01099      ({"klingelton","_msg_beep",0,0}),
01100      ({"senderwiederholung","_msg_prepend",0,0}),
01101     })+channel::_query_localcmds();
01102 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

protected varargs int _recv ( object  ob,
string  message,
int  flag,
string  indent 
)

Definiert in Zeile 274 der Datei comm.c.

Benutzt add_to_tell_history(), break_string(), BS_PREPEND_INDENT, MSGFLAG_REMOTE, MSGFLAG_TELL, MSGFLAG_WHISPER, P_MESSAGE_PREPEND, QueryProp() und WEM.

Wird benutzt von FeelIt().

00275 {
00276   write(break_string(message, 78, indent,
00277         QueryProp(P_MESSAGE_PREPEND) ? BS_PREPEND_INDENT : 0));
00278   if ((flag & MSGFLAG_TELL || flag & MSGFLAG_REMOTE) &&
00279       query_once_interactive(ob))
00280     if (flag & MSGFLAG_WHISPER)
00281       add_to_tell_history(getuid(ob), 1, 0,
00282         "Du fluesterst " + ob->name(WEM) + " aus der Ferne etwas zu.", 0,
00283                 flag);
00284     else
00285       add_to_tell_history(getuid(ob), 1, 0, message, indent, flag);
00286   return 1;
00287 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

static int _remote_whisper ( string  str  )  [static]

Definiert in Zeile 781 der Datei comm.c.

00782 {
00783   /* Wie 'teile mit', nur mit MSGFLAG_WHISPER. Dadurch wird der Inhalt der
00784      Nachricht nicht in der tell_history verewigt. */
00785 
00786   object    ob;
00787   string    who, it;
00788   string    msg;
00789   string    myname;
00790 
00791   if (!(str=_unparsed_args()) ||
00792        (sscanf(str, "%s zu %s", who, msg) != 2 &&
00793   sscanf(str, "%s %s", who, msg) !=2 )) {
00794     write("Was willst Du wem aus der Ferne zufluestern?\n");
00795     return 1;
00796   }
00797 
00798   if (!ob=find_player(it = lower_case(who)))
00799   {
00800     it = match_living(it, 0);
00801     if (!stringp(it))
00802       switch(it){
00803       case -1:
00804         write("Das war nicht eindeutig!\n");
00805         return 1;
00806       case -2:
00807         write("Kein solcher Spieler!\n");
00808         return 1;
00809       }
00810     ob = find_player(it);
00811     if(!ob) ob = find_living(it);
00812     if(!ob){
00813       write("Kein solcher Spieler!\n");
00814       return 1;
00815     }
00816   }
00817   if (ob->QueryProp(P_INVIS) && IS_LEARNER(this_player())) {
00818     write("Kein solcher Spieler!\n");
00819     return 1;
00820   }
00821   if (environment(ob) == environment()) {
00822     write("Wenn jemand neben Dir steht, nimm fluester.\n");
00823     return 1;
00824   }
00825 
00826   myname = capitalize((((IS_LEARNER(ME) &&
00827        !QueryProp(P_INVIS) &&
00828        (QueryProp(P_CAN_FLAGS) & CAN_PRESAY))?
00829       QueryProp(P_PRESAY) : "") + name()) || "");
00830   _send(ob, permutate(msg), MSGFLAG_WHISPER | MSGFLAG_REMOTE,
00831         myname + " fluestert Dir aus der Ferne zu: ");
00832   _recv(ob, msg, MSGFLAG_WHISPER | MSGFLAG_REMOTE,
00833         "Du fluesterst " + ob->name(WEM) + " aus der Ferne zu: ");
00834   return 1;
00835 }

private varargs int _send ( object  ob,
string  message,
int  flag,
string  indent 
)

Definiert in Zeile 265 der Datei comm.c.

Benutzt break_string(), BS_PREPEND_INDENT und P_MESSAGE_PREPEND.

00266 {
00267   mixed res;
00268   if(!call_resolved(&res, ob, "Message", message, flag, indent))
00269     tell_object(ob, break_string(message, 78, indent,
00270       ob->QueryProp(P_MESSAGE_PREPEND) ? BS_PREPEND_INDENT : 0));
00271   return res;
00272 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

static mixed _set_ignore ( mixed  arg  )  [static]

Definiert in Zeile 917 der Datei comm.c.

Benutzt P_IGNORE und Set().

00918 {
00919   if(stringp(arg)) arg = ({ arg });
00920   if(pointerp(arg)) return Set(P_IGNORE, arg);
00921 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

static int _shout_to_all ( mixed  str  )  [static]

Definiert in Zeile 574 der Datei comm.c.

00575 {
00576   string pre, myname, realname, str1, str2;
00577   int i,chars;
00578 
00579   if (!(str=_unparsed_args()))
00580   {
00581     write("Was willst Du rufen?\n");
00582     return 1;
00583   }
00584   chars=strlen(str)/2;
00585   if (chars<4) chars=4;
00586   pre = (!IS_LEARNER(ME) ||
00587    QueryProp(P_INVIS) ||
00588    !(QueryProp(P_CAN_FLAGS) & CAN_PRESAY)) ? "" : QueryProp(P_PRESAY);
00589   realname = capitalize((pre + capitalize(getuid()))||"");
00590   myname = capitalize(pre + name()||"");
00591   if (QueryProp(P_INVIS))
00592     realname = "("+realname+")";
00593 
00594   str1=permutate(str);
00595 
00596   if(QueryProp(P_FROG))
00597     str2 = break_string("Quaaak, quaaaaak, quuuuaaaaaaaaaaaaaaaaaaaak !!",
00598            78,myname+" quakt: ");
00599   else str2=break_string(str1,78,myname+" ruft: ");
00600 
00601   if(!IS_LEARNER(this_player()))
00602   {
00603     if(QueryProp(P_GHOST)) {
00604                 write("So ganz ohne Koerper bekommst Du keinen Ton heraus.\n");
00605                 return 1;
00606     }
00607     if (QueryProp(P_SP) <(chars+20))
00608     {
00609       write("Du must erst wieder magische Kraefte sammeln.\n");
00610       write("Tip: Benutz doch mal die Kanaele (Hilfe dazu mit 'hilfe kanaele').\n");
00611       return 1;
00612     }
00613     SetProp(P_SP, QueryProp(P_SP) - chars - 20);
00614   }
00615 
00616   _recv(0, str, MSGFLAG_SHOUT, "Du rufst: ");
00617   str1=break_string(str1,78,realname+" ruft: ");
00618 
00619   foreach ( object ob : users()-({this_object()}) )
00620     if ( IS_LEARNER(ob) )
00621       _send(ob,str1,MSGFLAG_SHOUT);
00622     else
00623       _send(ob,str2,MSGFLAG_SHOUT);
00624 
00625   return 1;
00626 }

static int _shout_to_wizards ( mixed  str  )  [static]

Definiert in Zeile 867 der Datei comm.c.

00868 {
00869   int     i, j;
00870   string    myname;
00871   object   *u;
00872 
00873   str = _unparsed_args();
00874   if (!str||!strlen(str)) {
00875     write("Was willst Du den Magiern zurufen?\n");
00876     return 1;
00877   }
00878   myname = capitalize(getuid(this_object()));
00879   if (!IS_LEARNER(this_object()))
00880     _recv(0, str, MSGFLAG_MECHO, "Du teilst allen Magiern mit: ");
00881   map(filter(users(), #'is_learner/*'*/),
00882         #'_send/*'*/,
00883             break_string(str, 78, myname+" an alle Magier: "),MSGFLAG_MECHO);
00884   return 1;
00885 }

static int _teile ( string  str  )  [static]

Definiert in Zeile 734 der Datei comm.c.

00735 {
00736   string who, message;
00737   if (!(str=_unparsed_args())) return 0;
00738   if (sscanf(str, "%s mit %s", who, message) == 2)
00739     return _tell(who, message,1);
00740   return 0;
00741 }

varargs int _tell ( string  who,
mixed  msg,
int  intcall 
)

Definiert in Zeile 628 der Datei comm.c.

Wird benutzt von erwidere().

00629 {
00630   object    ob;
00631   string    away,myname,ret;
00632   mixed     ignore,it,*xname;
00633   int       i,visflag;
00634 
00635   if (extern_call()&&this_interactive()!=ME) return 1;
00636   if (!who || !msg) {
00637     write("Was willst Du mitteilen?\n");
00638     return 1;
00639   }
00640 
00641   if(who == ERWIDER_PARAM)
00642   {
00643     if (!last_comm_partner)
00644     {
00645       _notify_fail("Du hast aber noch keine Mitteilungen erhalten, auf die "
00646           "Du was erwidern\nkoenntest.\n");
00647       return 0;
00648     }
00649     who=last_comm_partner;
00650   }
00651 
00652   // teile .x mit teilt bisherigen Gespraechspartnern etwas mit.
00653   if (who == ".")
00654    who = ".1";
00655 
00656   if ( sscanf(who, ".%d", i) == 1 ) {
00657     if(i > 0 && i <= sizeof(commreceivers))
00658       who = commreceivers[i-1];
00659     else {
00660       _notify_fail("So vielen Leuten hast Du noch nichts mitgeteilt!\n");
00661       return 0;
00662     }
00663   }
00664 
00665   xname = old_explode(who, "@");
00666 
00667   if (sizeof(xname) == 2) {
00668     if (ret=(string)INETD->_send_udp(xname[1],
00669                                     ([ REQUEST:   "tell",
00670                                        RECIPIENT: xname[0],
00671                                        SENDER:    getuid(ME),
00672                                        DATA:     msg ]), 1))
00673       write(ret);
00674     else
00675     {
00676       write("Nachricht abgeschickt.\n");
00677       add_to_tell_history(who, 1, 0, msg,
00678         "Du teilst " + capitalize(who) + " mit: ", MSGFLAG_TELL, 1);
00679     }
00680     return 1;
00681   }
00682 
00683   if (!ob=find_player(it = lower_case(who)))
00684   {
00685     it = match_living(it, 0);
00686     if (!stringp(it))
00687       switch(it){
00688       case -1:
00689         write("Das war nicht eindeutig!\n");
00690         return 1;
00691       case -2:
00692         write("Kein solcher Spieler!\n");
00693         return 1;
00694       }
00695     ob = find_player(it);
00696     if(!ob) ob = find_living(it);
00697     if(!ob){
00698       write("Kein solcher Spieler!\n");
00699       return 1;
00700     }
00701   }
00702 
00703   if(QueryProp(P_INVIS)){
00704     if(!IS_LEARNER(ob))
00705       myname = name();
00706     else
00707       myname="("+
00708              ((QueryProp(P_CAN_FLAGS) & CAN_PRESAY)?QueryProp(P_PRESAY):"")+
00709              capitalize(getuid()) + ")";
00710   }
00711   else
00712     myname=((IS_LEARNER(ME) && (QueryProp(P_CAN_FLAGS) & CAN_PRESAY)) ?
00713               QueryProp(P_PRESAY):"") + name();
00714   if (myname && strlen(myname)) myname=capitalize(myname);
00715 
00716   if (visflag = !ob->QueryProp(P_INVIS) || IS_LEARNER(this_player()))
00717     _recv(ob, msg, MSGFLAG_TELL, "Du teilst " + capitalize(it) + " mit: ");
00718 
00719   if (!visflag&&interactive(ob))
00720     write("Kein solcher Spieler!\n");
00721   else if (away = (string) ob->QueryProp(P_AWAY))
00722       write( break_string( away, 78, capitalize(it)
00723                            + " ist gerade nicht da: ", BS_INDENT_ONCE ) );
00724   else
00725     if(interactive(ob) && (i=query_idle(ob))>=600){ //ab 10 Mins
00726       if(i<3600) away=time2string("%m %M",i);
00727       else away=time2string("%h %H und %m %M",i);
00728       printf("%s ist seit %s voellig untaetig.\n",capitalize(it),away);
00729     }
00730   _send(ob, permutate(msg), MSGFLAG_TELL, myname + " teilt Dir mit: ");
00731   return 1;
00732 }

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

static int _whisper ( string  str  )  [static]

Definiert in Zeile 753 der Datei comm.c.

00754 {
00755   object    ob;
00756   string    who;
00757   string    msg;
00758   string    myname;
00759 
00760   if (!(str=_unparsed_args()) ||
00761        (sscanf(str, "%s zu %s", who, msg) != 2 &&
00762   sscanf(str, "%s %s", who, msg) !=2 )) {
00763     write("Was willst Du wem zufluestern?\n");
00764     return 1;
00765   }
00766   if (!(ob = present(who, environment(this_player()))) || !living(ob)) {
00767     write(capitalize(who)+" ist nicht in diesem Raum.\n");
00768     return 1;
00769   }
00770 
00771   myname = capitalize((((IS_LEARNER(ME) &&
00772        !QueryProp(P_INVIS) &&
00773        (QueryProp(P_CAN_FLAGS) & CAN_PRESAY))?
00774       QueryProp(P_PRESAY) : "") + name()) || "");
00775   _send(ob, permutate(msg), MSGFLAG_WHISPER, myname + " fluestert Dir zu: ");
00776   _recv(ob, msg, MSGFLAG_WHISPER, "Du fluesterst " + ob->name(WEM) + " zu: ");
00777   say(myname + " fluestert " + ob->name(WEM, 1) + " etwas zu.\n", ob);
00778   return 1;
00779 }

private varargs void add_to_tell_history ( string  uid,
int  sent,
int  recv,
string  message,
string  indent,
int  flags 
)

Definiert in Zeile 134 der Datei comm.c.

Benutzt commreceivers, msg_s::indent, last_comm_partner, m_delete(), MAX_SAVED_CHATS, MAX_SAVED_MESSAGES, msg_s::msg, chat_s::msgbuf, MSGFLAG_REMOTE, chat_s::ptr, chat_s::recvcount, chat_s::sentcount, tell_history, tell_history_enabled, TELLHIST_ENABLED, chat_s::time_first_msg, chat_s::time_last_msg, msg_s::timestamp und zeit.

Wird benutzt von _recv() und Message().

00136 {
00137   /* tell_history ist ein Mapping mit UIDs der Gespraechspartner als Key.
00138      Als Wert ist eine Strukur vom Typ chat_s eingetragen.
00139      Strukturen chat_s und msg_s sind in /std/player/comm_structs.c definiert.
00140      TODO fuer spaeter, gerade keine Zeit fuer:
00141      Als Wert ist ein Array von chat_s enthalten, wobei das 0. Element das
00142      jeweils juengste Gespraech mit diesem Gespraechspartner ist und alle
00143      weiteren Elemente in der zeitlichen Reihenfolge kommen (also letztes
00144      Element ist aeltestes Gespraech).
00145      */
00146 
00147   // letzten Gespraechspartner fuer erwidere.
00148   if (!(flags & MSGFLAG_REMOTE))
00149     last_comm_partner = uid;
00150 
00151   // ist ein sortiertes Array von max. MAX_SAVED_CHATS Groesse, welches die
00152   // Spieler enthaelt, denen man schon was mitgeteilt hat. Aktuellste am
00153   // Anfang.
00154   if (sent) {
00155     if (!sizeof(commreceivers))
00156       commreceivers = ({uid});
00157     else if (commreceivers[0] != uid) {
00158       // nur wenn der aktuelle Partner nicht am Anfang steht, muss man hier was
00159       // tun. Comm-Partner an den Anfang stellen und ggf. alten Eintrag
00160       // entfernen.
00161       // TODO: Effizienter gestalten.
00162       commreceivers = ({uid}) + (commreceivers-({uid}));
00163       // ggf. kuerzen. (wenn !tell_history_enabled, wird es ggf. unten
00164       // gemacht, denn die Hist muss min. alle UID enthalten, die auch in
00165       // commreceivers drin sind.)
00166       if (!tell_history_enabled && sizeof(commreceivers) > MAX_SAVED_CHATS)
00167         commreceivers = commreceivers[0..MAX_SAVED_CHATS];
00168     }
00169   }
00170 
00171   if (!tell_history_enabled)
00172     return;
00173 
00174   if (!indent && message[<1] == 10)
00175       message = message[..<2];
00176 
00177   struct chat_s chat;
00178   // Gespraechspartner unbekannt?
00179   if (!member(tell_history, uid)) {
00180     // zuviele Gespraeche in Hist? >= ist Absicht weil ja gleich noch eins
00181     // dazu kommt.
00182     if (sizeof(tell_history) >= MAX_SAVED_CHATS) {
00183       string deluid;
00184       int zeit = __INT_MAX__;
00185       foreach(string tuid, chat : tell_history) {
00186         // aeltestes Gespraech suchen
00187         if (zeit > chat->time_last_msg) {
00188           deluid = tuid;
00189           zeit = chat->time_last_msg;
00190         }
00191       }
00192       // aeltestes Gespraech raus.
00193       efun::m_delete(tell_history, deluid);
00194       if (member(commreceivers,deluid)>-1)
00195         commreceivers-=({deluid});
00196     }
00197     // neues Gespraech anlegen
00198     chat = (<chat_s> uid: uid, time_first_msg: time(), 
00199                time_last_msg: time(),
00200          sentcount: sent, recvcount: recv,
00201          msgbuf: 0, ptr: 0 );
00202     tell_history[uid] = chat;
00203   }
00204   else {
00205     // Gespraechspartner bekannt, altes Gespraech weiterbenutzen
00206     chat = tell_history[uid];
00207     chat->time_last_msg = time();
00208     chat->sentcount += sent;
00209     chat->recvcount += recv;
00210   }
00211 
00212   if (tell_history_enabled < TELLHIST_ENABLED)
00213     return;
00214 
00215   // ggf. Array fuer Messages anlegen
00216   if (!pointerp(chat->msgbuf))
00217     chat->msgbuf = allocate(MAX_SAVED_MESSAGES);
00218 
00219   // Message-Struktur ermitteln oder neu anlegen
00220   struct msg_s msg;
00221   if (!structp(chat->msgbuf[chat->ptr])) {
00222     // neue Struct ins Array schreiben
00223     chat->msgbuf[chat->ptr] = msg = (<msg_s>);
00224   }
00225   else {
00226     // alte Struct ueberschreiben
00227     msg = chat->msgbuf[chat->ptr];
00228   }
00229   // Index auf naechste Messagestruktur ermitteln
00230   chat->ptr = (chat->ptr + 1) % MAX_SAVED_MESSAGES;
00231   // Message speichern
00232   msg->msg = message;
00233   msg->indent = indent;
00234   msg->timestamp = time();
00235 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

private int check_ignore ( mixed  ignore,
string  verb,
string  name 
)

Definiert in Zeile 119 der Datei comm.c.

Wird benutzt von Message().

00120 {
00121   return (ignore == verb) ||
00122     ((sizeof(ignore = explode(ignore, ".")) > 1) &&
00123      (name == ignore[0] && member(ignore[1..], verb) != -1));
00124 }

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

protected void clear_tell_history (  ) 

Definiert in Zeile 237 der Datei comm.c.

Benutzt chat, tell_history, tell_history_enabled und TELLHIST_LONGLIFE.

Wird benutzt von reset().

00238 {
00239   /* Nach einem "schlafe ein" werden die gespeicherten Mitteilungen geloescht,
00240      sofern der Spieler nichts abweichendes eingestellt hat. */
00241 
00242 #ifdef TELLHIST_LONGLIFE
00243   if (tell_history_enabled == TELLHIST_LONGLIFE)
00244     return;
00245 #endif
00246 
00247   foreach (string uid, struct chat_s chat: tell_history)
00248     if (pointerp(chat->msgbuf)) {
00249       chat->msgbuf = 0;
00250       chat->ptr = 0;
00251     }
00252 }

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

private int comm_beep (  ) 

Definiert in Zeile 126 der Datei comm.c.

Benutzt last_beep_time, P_MESSAGE_BEEP, P_VISUALBELL und QueryProp().

Wird benutzt von Message().

00126                         {
00127   if (QueryProp(P_VISUALBELL)) return 0; // kein ton
00128   int beep_interval=(int)QueryProp(P_MESSAGE_BEEP);
00129   if (!beep_interval || ((time()-last_beep_time) < beep_interval)) return 0;
00130   last_beep_time=time();
00131   return 1;
00132 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

void create (  ) 

Definiert in Zeile 62 der Datei comm.c.

Benutzt create(), F_MODE, F_MODE_AS, F_VALUE, P_BUFFER, P_EARMUFFS, P_IGNORE, P_INTERMUD, P_MESSAGE_BEEP, P_MESSAGE_PREPEND, SAVE, SECURED und Set().

00063 {
00064   ::create();
00065   Set(P_EARMUFFS, 0);
00066   Set(P_EARMUFFS, SAVE, F_MODE);
00067   Set(P_EARMUFFS, SECURED, F_MODE);
00068   Set(P_INTERMUD, SAVE, F_MODE);
00069   Set(P_IGNORE, ({}), F_VALUE);
00070   Set(P_IGNORE, SAVE, F_MODE);
00071   Set(P_BUFFER, SAVE, F_MODE);
00072   Set(P_MESSAGE_PREPEND, SAVE, F_MODE_AS);
00073   Set(P_MESSAGE_BEEP, SAVE, F_MODE_AS);
00074 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

void create_super (  ) 

Definiert in Zeile 76 der Datei comm.c.

Benutzt set_next_reset().

00077 {
00078   set_next_reset(-1);
00079 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int erwidere ( string  str  ) 

Definiert in Zeile 930 der Datei comm.c.

Benutzt _tell(), _unparsed_args() und ERWIDER_PARAM.

00931 {
00932   str=_unparsed_args();
00933   if (!str) return 0;
00934   return _tell(ERWIDER_PARAM, str ,1);
00935 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

static int ignoriere ( string  str  )  [static]

Definiert in Zeile 464 der Datei comm.c.

Benutzt _unparsed_args(), CountUp(), i, P_IGNORE, Query(), Set() und TRIM_BOTH.

00465 {
00466   mixed ignore;
00467   int i;
00468 
00469   str = _unparsed_args(1);
00470   if(!(ignore = Query(P_IGNORE))) ignore = ({});
00471 
00472   if (!str)
00473   {
00474       if (!sizeof(ignore)) write("Du ignorierst niemanden.\n");
00475       else
00476         write( "Du ignorierst:\n"
00477                + CountUp( map( sort_array( ignore, #'>/*'*/ ),
00478                                      #'capitalize/*'*/ ) ) + ".\n" );
00479       return 1;
00480   }
00481   // trim spaces from args and convert to lower case.
00482   str = lower_case(trim(str, TRIM_BOTH));
00483   
00484   if (member(ignore, str)!=-1)
00485   {
00486     Set(P_IGNORE, ignore -= ({ str }));
00487     printf("Du ignorierst %s nicht mehr.\n", capitalize(str));
00488     return 1;
00489   }
00490   if (sizeof(ignore)>1000)
00491   {
00492    printf("Du ignorierst schon genuegend!\n");
00493    return 1;
00494   }
00495   Set(P_IGNORE, ignore += ({ str }));
00496   printf("Du ignorierst jetzt %s.\n", capitalize(str));
00497   return 1;
00498 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

private int is_learner ( object  o  ) 

Definiert in Zeile 865 der Datei comm.c.

00865 { return IS_LEARNER(o); }

varargs int Message ( string  msg,
int  flag,
string  indent,
string  cname,
mixed  sender 
)

Definiert in Zeile 291 der Datei comm.c.

Benutzt _flush_cache(), add_to_tell_history(), break_string(), BS_LEAVE_MY_LFS, BS_PREPEND_INDENT, buffer, CAN_PRESAY, check_ignore(), comm_beep(), IS_LEARNER, ME, MESSAGE_BEEP, MESSAGE_CACHE, MESSAGE_CACHE_FULL, MESSAGE_DEAF, MESSAGE_IGNORE_MUD, MESSAGE_IGNORE_VERB, MESSAGE_IGNORE_YOU, MESSAGE_OK, MSGFLAG_CACHE, MSGFLAG_CHANNEL, MSGFLAG_CHIST, MSGFLAG_DEAFCHK, MSGFLAG_REMOTE, MSGFLAG_RTELL, MSGFLAG_SAY, MSGFLAG_SHOUT, MSGFLAG_TELL, MSGFLAG_WHISPER, name, old_explode(), P_AWAY, P_BUFFER, P_CAN_FLAGS, P_DEAF, P_EARMUFFS, P_IGNORE, P_MESSAGE_PREPEND, P_PRESAY, query_wiz_level(), QueryProp(), RAW und strftime().

00293 {
00294   object ti;
00295   string verb, reply, *ignore, tin;
00296   int em, te;
00297   mixed deaf;
00298 
00299   // TODO: Kann nach der ersten Uptime raus
00300   if (objectp(cname))
00301     raise_error("Message() hat einen neuen Parameter!\n");
00302 
00303   // Bei den Kanaelen 'Debug' und 'Entwicklung' kann man gezielt Bugs
00304   // einzelner Magier ignorieren. Dazu wird der Kanalname zum 'verb',
00305   // damit 'ignoriere name.debug' funktioniert.
00306   if( flag == MSGFLAG_CHANNEL ){
00307       if((msg[1..5] == "Debug" || msg[1..11] == "Entwicklung"
00308                     || msg[1..9]=="Warnungen"))
00309       {
00310         // Missbrauch der Variable 'ignore' als Zwischenspeicher
00311         ignore = regexplode( msg, ":| |\\]" );
00312         verb = lower_case(ignore[0][1..]);
00313         tin = lower_case(ignore[2]);
00314       }
00315       else
00316       {
00317         if(cname)
00318           verb=lower_case(cname);
00319         else
00320           verb=query_verb();
00321         if( ti = this_interactive() )
00322         {
00323           tin = getuid(this_interactive());
00324         }
00325         else
00326         {
00327                   //falls doch kein Objekt...
00328           if (objectp(sender))
00329             tin=lower_case(sender->name(RAW)||"<Unbekannt>");
00330         }
00331       }
00332   }
00333   else {
00334     if( ti = this_interactive() )
00335       tin = getuid(this_interactive());
00336     verb = query_verb();
00337   }
00338 
00339   te = flag & (MSGFLAG_TELL | MSGFLAG_WHISPER);
00340 
00341   // fuer "erwidere"
00342   if (ti && (flag & MSGFLAG_TELL || flag & MSGFLAG_REMOTE)) {
00343     if (!ti->QueryProp(P_INVIS)||IS_LEARNER(ME)) {
00344       if (flag & MSGFLAG_WHISPER)
00345         add_to_tell_history(getuid(ti), 0, 1,
00346           capitalize((((IS_LEARNER(ti) && !ti->QueryProp(P_INVIS) &&
00347             (ti->QueryProp(P_CAN_FLAGS) & CAN_PRESAY)) ?
00348             ti->QueryProp(P_PRESAY) : "") + ti->name()) || "") +
00349           " fluestert Dir aus der Ferne etwas zu.", 0, flag, 0);
00350       else
00351         add_to_tell_history(getuid(ti), 0, 1, msg, indent, flag, 0);
00352     }
00353   }
00354   // Hoert der Spieler nicht?
00355   em = (ti &&
00356         (te || flag & MSGFLAG_SHOUT) &&
00357         (QueryProp(P_EARMUFFS) &&
00358           (query_wiz_level(ti) < QueryProp(P_EARMUFFS))));
00359   ignore = (pointerp(ignore = QueryProp(P_IGNORE)) ? ignore : ({}));
00360 
00361   // Werden der Sender oder das Verb ignoriert?
00362   if(!ti && tin && flag == MSGFLAG_CHANNEL)
00363   {
00364      if((member(ignore, tin) != -1))
00365      {
00366        return MESSAGE_IGNORE_YOU;
00367      }
00368      if(verb &&  sizeof(filter(ignore, #'check_ignore, verb, tin)) )
00369      {
00370        return MESSAGE_IGNORE_YOU;
00371      }
00372   }
00373   if (ti && (member(ignore, getuid(ti)) != -1)) {
00374     if(te && (IS_LEARNER(ti)||!QueryProp(P_INVIS)))
00375       tell_object(ti, capitalize(name())+
00376                       " hoert gar nicht zu, was Du sagst.\n");
00377     return MESSAGE_IGNORE_YOU;
00378   }
00379   if(tin && verb &&
00380      sizeof(filter(ignore, #'check_ignore/*'*/, verb, tin)))
00381   {
00382     if(ti && verb[0..2] != "ruf" && verb[0..3] != "mruf" &&
00383        verb[0..3] != "echo" && verb[0] != '-' && !(flag & MSGFLAG_CHANNEL) )
00384       tell_object(ti, name()+" wehrt \""+verb+"\" ab.\n");
00385     return MESSAGE_IGNORE_VERB;
00386   }
00387   if (flag & MSGFLAG_RTELL) {
00388     int at;
00389 
00390     verb = lower_case(old_explode(msg, " ")[0][1..]);
00391     at = member(verb, '@');
00392     /* verb wird hier eh missbraucht, also auch fuer ein intermud-erwidere*/
00393     add_to_tell_history(verb, 0, 1, msg, indent, flag, 0);
00394 
00395     if ((member(ignore, verb) >= 0) || (member(ignore,verb[0..at]) >= 0))
00396       return MESSAGE_IGNORE_YOU;
00397     else if (at > 0 && member(ignore, verb[at..]) >= 0)
00398       return MESSAGE_IGNORE_MUD;
00399   }
00400 
00401   // Taubheit/Oropax
00402   te |= (flag & MSGFLAG_SAY);
00403 
00404   if (QueryProp(P_DEAF) && (flag & MSGFLAG_DEAFCHK) && !(flag & MSGFLAG_CHIST)) {
00405     deaf = QueryProp(P_DEAF);
00406     if (te)
00407       reply = stringp(deaf) ?
00408         capitalize(sprintf(deaf, name())) :
00409         capitalize(name())+" ist momentan leider taub.\n";
00410   }
00411   else if (em)
00412     reply = capitalize(name())+" hat Oropax in den Ohren.\n";
00413 
00414   msg = break_string(msg, 78, indent,
00415     (QueryProp(P_MESSAGE_PREPEND) ? BS_PREPEND_INDENT : 0) | BS_LEAVE_MY_LFS);
00416 
00417   if(QueryProp(P_BUFFER) &&
00418      (deaf ||
00419       query_editing(this_object()) ||
00420       query_input_pending(this_object())))
00421   {
00422     deaf = MESSAGE_DEAF;
00423     if(flag & MSGFLAG_CACHE)
00424     {
00425       if(!stringp(reply))
00426         reply = name()+" moechte gerade nicht gestoert werden.\n";
00427 
00428       if(sizeof(buffer) < 20)
00429       {
00430         buffer += ({ msg[0..<2]+" [" + strftime("%H:%M",time()) + "]\n" });
00431         reply += "Die Mitteilung wurde von einem kleinen Kobold in Empfang "+
00432                  "genommen.\nEr wird sie spaeter weiterleiten!";
00433         deaf = MESSAGE_CACHE;
00434       }
00435       else {
00436         reply += "Die Mitteilung ging verloren, denn "+
00437                  "der Kobold kann sich nichts mehr merken!";
00438         deaf = MESSAGE_CACHE_FULL;
00439       }
00440       if(ti && (IS_LEARNER(ti)||!QueryProp(P_INVIS)))
00441         tell_object(ti, reply+"\n");
00442     }
00443     return deaf;
00444   }
00445   else if((deaf || em) &&
00446           ( (flag & MSGFLAG_RTELL) ||
00447             (ti && (IS_LEARNER(ti)||!QueryProp(P_INVIS))))) {
00448     if (te && ti)
00449       tell_object(ti, reply);
00450     return MESSAGE_DEAF;
00451   }
00452 
00453   _flush_cache();
00454   if(te && QueryProp(P_AWAY))
00455     msg = msg[0..<2]+" [" + strftime("%H:%M",time()) + "]\n";
00456 
00457   if (flag & (MSGFLAG_SAY | MSGFLAG_TELL) && comm_beep()) {
00458     msg=MESSAGE_BEEP+msg;
00459   }
00460   tell_object(ME, msg);
00461   return MESSAGE_OK;
00462 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

varargs string name ( int  casus,
int  demonst 
)

Definiert in Zeile 32 der Datei xxtool.c.

Benutzt name, P_ARTICLE, P_FROG, P_NAME_ADJ, Query(), QueryArticle(), QueryProp(), RAW, SetProp(), tname, U_REQ, WEM und WESSEN.

00033 {
00034   return thing::name(d1,d2);
00035 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

private string permutate ( string  msg  ) 

Definiert in Zeile 81 der Datei comm.c.

Benutzt ob(), P_PERM_STRING und QueryProp().

Wird benutzt von _communicate().

00081                                      {
00082   object ob;
00083   if (!objectp(ob=QueryProp(P_PERM_STRING)))
00084     return msg;
00085 
00086   return (string)ob->permutate_string(msg)||"";
00087 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

protected void reset ( void   ) 

Definiert in Zeile 254 der Datei comm.c.

Benutzt clear_tell_history().

00255 {
00256   /* Wird 15 Minuten nach dem Verlust der Verbindung aufgerufen. Falls der
00257      Spieler nicht inzwischen eine Verbindung wiederhergestellt hat, werden
00258      wie bei einem "schlafe ein" die Mitteilungen geloescht. */
00259 
00260   if (!interactive())
00261     clear_tell_history();
00262 
00263 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

private string * sorted_commpartners ( int  reversed  ) 

Definiert in Zeile 1104 der Datei comm.c.

Benutzt tell_history und chat_s::time_last_msg.

Wird benutzt von tmhist().

01104                                                   {
01105   return sort_array(m_indices(tell_history),
01106       function int (string uid1, string uid2) {
01107           if (reversed)
01108             return tell_history[uid1]->time_last_msg >
01109                    tell_history[uid2]->time_last_msg;
01110           else
01111             return tell_history[uid1]->time_last_msg <=
01112                    tell_history[uid2]->time_last_msg;
01113       } );
01114 }

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

public int TestIgnore ( string *  arg  ) 

Definiert in Zeile 111 der Datei comm.c.

Benutzt P_IGNORE und QueryProp().

00112 {   string *ignore;
00113 
00114     if (!pointerp(arg) || !pointerp(ignore=QueryProp(P_IGNORE)))
00115         return 0;
00116     return sizeof(arg&ignore);
00117 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

static int tmhist ( string  str  )  [static]

Definiert in Zeile 937 der Datei comm.c.

Benutzt _notify_fail(), break_string(), BS_LEAVE_MY_LFS, chat, commreceivers, data, flag, history, i, msg_s::indent, MAX_SAVED_MESSAGES, More(), msg_s::msg, msg(), notify_fail(), chat_s::recvcount, chat_s::sentcount, sorted_commpartners(), strftime(), tell_history, tell_history_enabled, TELLHIST_DISABLED, TELLHIST_ENABLED, TELLHIST_LONGLIFE, TELLHIST_NO_MESSAGE, chat_s::time_last_msg, msg_s::timestamp und chat_s::uid.

00938 {
00939 
00940   if (str == "aus") {
00941     tell_history_enabled = TELLHIST_DISABLED;
00942     write("Ok, es wird nichts mehr gespeichert.\n");
00943     if (sizeof(tell_history)) {
00944       tell_history = ([]);
00945       commreceivers = ({});
00946       write("Deine Mitteilungsgeschichte wurde geloescht.\n");
00947     }
00948     return 1;
00949   }
00950 
00951   if (str == "namen") {
00952     int flag;
00953     tell_history_enabled = TELLHIST_NO_MESSAGE;
00954     write("Ok, die Namen zukuenftiger Gespraechspartner werden gespeichert.\n");
00955     foreach (string uid, struct chat_s chat: tell_history)
00956       if (pointerp(chat->msgbuf)) {
00957         chat->msgbuf = 0;
00958         chat->ptr = 0;
00959         flag = 1;
00960       }
00961     if (flag)
00962       write("Der Inhalt Deiner Mitteilungen wurde geloescht.\n");
00963     return 1;
00964   }
00965 
00966   if (str == "ein" || str == "an") {
00967     tell_history_enabled = TELLHIST_ENABLED;
00968     write("Ok, zukuenftige Mitteilungen werden gespeichert.\n");
00969     return 1;
00970   }
00971 
00972 #ifdef TELLHIST_LONGLIFE
00973   if (str == "langlebig") {
00974     tell_history_enabled = TELLHIST_LONGLIFE;
00975     write("Ok, zukuenftige Mitteilungen werden jeweils bis zum naechsten "
00976           "Ende/Crash/\nReboot gespeichert.\n");
00977     return 1;
00978   }
00979 #endif
00980 
00981   if (str == "status") {
00982     switch (tell_history_enabled) {
00983       case TELLHIST_DISABLED:
00984         write("Die Namen Deiner Gespraechspartner werden nicht gespeichert.\n");
00985         break;
00986       case TELLHIST_NO_MESSAGE:
00987         write("Die Namen Deiner Gespraechspartner werden gespeichert.\n");
00988         break;
00989       case TELLHIST_ENABLED:
00990         write("Deine Mitteilungen werden gespeichert.\n");
00991         break;
00992 #ifdef TELLHIST_LONGLIFE
00993       case TELLHIST_LONGLIFE:
00994         write("Deine Mitteilungen werden jeweils bis zum naechsten Ende/"
00995               "Crash/Reboot\ngespeichert.\n");
00996         break;
00997 #endif
00998     }
00999     return 1;
01000   }
01001 
01002   if (tell_history_enabled == TELLHIST_DISABLED) {
01003     _notify_fail("Deine Gespraechspartner werden nicht gespeichert.\n");
01004     return 0;
01005   }
01006 
01007   if (!sizeof(tell_history)) {
01008     _notify_fail("Du hast noch keinem etwas mitgeteilt "
01009                  "und noch keine Mitteilungen erhalten.\n");
01010     return 0;
01011   }
01012 
01013   if (str && strlen(str)) {
01014 
01015     if (tell_history_enabled < TELLHIST_ENABLED) {
01016       _notify_fail("Der Inhalt Deiner Mitteilungen wird nicht gespeichert.\n");
01017       return 0;
01018     }
01019 
01020     string uid;
01021     if (member(tell_history, str)) {
01022       // Name gewuenscht, da der String in der History vorkommt.
01023       uid = str;
01024     }
01025     else {
01026       // evtl. ne Zahl angegeben.
01027       int i;
01028       string *partners = sorted_commpartners(0);
01029       if ((i = to_int(str) - 1) >= 0 && i < sizeof(partners))
01030         uid = partners[i];
01031       else {
01032         notify_fail("Mit so vielen Leuten hast Du nicht gesprochen!\n");
01033         return 0;
01034       }
01035     }
01036 
01037     mixed *data = tell_history[uid]->msgbuf;
01038     if (!data) {
01039       _notify_fail(
01040         "Der Inhalt dieser Mitteilung ist nicht (mehr) gespeichert.\n");
01041       return 0;
01042     }
01043 
01044     int ptr = tell_history[uid]->ptr;
01045 
01046     More(sprintf("%@s", map(data[ptr..MAX_SAVED_MESSAGES-1] +
01047                               data[0..ptr-1],
01048          function string (struct msg_s msg) {
01049              if (!structp(msg)) return "";
01050                return break_string( msg->msg + " <"
01051                  + strftime("%H:%M:%S",msg->timestamp) + ">", 78,
01052                  msg->indent || "", msg->indent ? BS_LEAVE_MY_LFS : 0);
01053          } ) ) );
01054     return 1;
01055   }
01056 
01057   string history = "Folgende Gespraeche hast Du bereits gefuehrt:\n";
01058   int i;
01059   foreach (string uid : sorted_commpartners(0) ) {
01060     int j;
01061     struct chat_s chat = tell_history[uid];
01062     history += sprintf("%2d.%-4s %s  %-11s  %d gesendet/%d empfangen\n", ++i,
01063       ((j=member(commreceivers,uid))>-1 ? sprintf("/%2d.",j+1) : ""),
01064       strftime("%a, %e.%m.%y",chat->time_last_msg),
01065       capitalize(chat->uid), chat->sentcount, chat->recvcount);
01066   }
01067 
01068   More(history);
01069 
01070   return 1;
01071 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:


Variablen-Dokumentation

private string* buffer = ({}) [static]

Definiert in Zeile 60 der Datei comm.c.

Wird benutzt von _flush_cache() und Message().

inherit std player channel

Definiert in Zeile 13 der Datei comm.c.

inherit std player comm_structs

Definiert in Zeile 14 der Datei comm.c.

private nosave string* commreceivers = ({})

Definiert in Zeile 49 der Datei comm.c.

Wird benutzt von add_to_tell_history() und tmhist().

private nosave int last_beep_time

Definiert in Zeile 51 der Datei comm.c.

Wird benutzt von comm_beep().

private nosave string last_comm_partner

Definiert in Zeile 50 der Datei comm.c.

Wird benutzt von add_to_tell_history().

private nosave mapping tell_history = ([])

Definiert in Zeile 48 der Datei comm.c.

Wird benutzt von add_to_tell_history(), clear_tell_history(), sorted_commpartners() und tmhist().

private int tell_history_enabled = TELLHIST_NO_MESSAGE

Definiert in Zeile 47 der Datei comm.c.

Wird benutzt von add_to_tell_history(), clear_tell_history() und tmhist().

Erzeugt am Thu Jun 3 14:42:41 2010 für MorgenGrauen Mudlib von  doxygen 1.6.3