~sapidlib-dev-core/sapidlib/devel

« back to all changes in this revision

Viewing changes to lib/adm/daemons/chan_d.c

  • Committer: Richard Harrison
  • Date: 2012-04-26 02:09:41 UTC
  • Revision ID: harrison.rt@gmail.com-20120426020941-m5j561r37d3p8hum
Manual merge of work from RtH. Also cut down on the amount of call_out's in timezone.

Show diffs side-by-side

added added

removed removed

Lines of Context:
528
528
  return 0;
529
529
}
530
530
 
 
531
string fmt_chantime(object living, string msg)
 
532
{
 
533
  mixed chantime = living->query_env("chantime");
 
534
 
 
535
  if (!chantime) return msg;
 
536
 
 
537
  if (chantime == 1 || chantime == "on" || chantime == "1")
 
538
    chantime = "%R";
 
539
  else
 
540
    chantime = "" + chantime;
 
541
 
 
542
  return living->strftime(chantime) + " " + msg;
 
543
}
 
544
 
531
545
int rec_msg(string channel, string msg)
532
546
{
533
547
  string array listeners;
556
570
      continue;
557
571
    }
558
572
 
559
 
    if (living->query_env("chantime")) u_msg = living->strftime("%R") + " " + u_msg;
560
 
 
561
 
    tell_object(living, u_msg + NOR);
 
573
    tell_object(living, fmt_chantime(living, u_msg) + NOR);
562
574
  }
563
575
 
564
576
  return 1;
611
623
        && is_muffed(living, originator))
612
624
      continue;
613
625
 
614
 
    if (living->query_env("chantime")) u_msg = living->strftime("%R") + " " + u_msg;
615
 
 
616
 
    tell_object(living, u_msg + NOR);
 
626
    tell_object(living, fmt_chantime(living, u_msg) + NOR);
617
627
  }
618
628
 
619
629
  return 1;
662
672
        && is_muffed(living, originator))
663
673
      continue;
664
674
 
665
 
    if (living->query_env("chantime"))
666
 
    {
667
 
      if (u1_msg != "") u1_msg = living->strftime("%R") + " " + u1_msg;
668
 
      if (u2_msg != "") u2_msg = living->strftime("%R") + " " + u2_msg;
669
 
    }
670
 
 
671
675
    if (listeners[i] == originator && u1_msg != "")
672
 
      tell_object(living, u1_msg + NOR);
 
676
      tell_object(living, fmt_chantime(living, u1_msg) + NOR);
673
677
    else
674
 
      tell_object(living, u2_msg + NOR);
 
678
      tell_object(living, fmt_chantime(living, u2_msg) + NOR);
675
679
  }
676
680
 
677
681
  return 1;
747
751
        && is_muffed(living, originator))
748
752
      continue;
749
753
 
750
 
    if (living->query_env("chantime"))
751
 
    {
752
 
      u1_msg = living->strftime("%R") + " " + u1_msg;
753
 
      u2_msg = living->strftime("%R") + " " + u2_msg;
754
 
      u3_msg = living->strftime("%R") + " " + u3_msg;
755
 
    }
756
 
 
757
754
    if (listeners[i] == originator)
758
 
      tell_object(living, u1_msg + NOR);
 
755
      tell_object(living, fmt_chantime(living, u1_msg) + NOR);
759
756
    else
760
757
    if (   listeners[i] == lower_case(target)
761
758
        || (listeners[i] == t_user && mud_name() == t_mud))
762
 
      tell_object(living, u2_msg + NOR);
 
759
      tell_object(living, fmt_chantime(living, u2_msg) + NOR);
763
760
    else
764
 
      tell_object(living, u3_msg + NOR);
 
761
      tell_object(living, fmt_chantime(living, u3_msg) + NOR);
765
762
  }
766
763
 
767
764
  return 1;