~ubuntu-branches/ubuntu/wily/steam/wily

« back to all changes in this revision

Viewing changes to server/factories/CalendarFactory.pike

  • Committer: Package Import Robot
  • Author(s): Felix Geyer
  • Date: 2013-10-29 19:51:18 UTC
  • mfrom: (1.1.4) (0.1.4 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20131029195118-b9bxciz5hwx5z459
Tags: 1:1.0.0.39-2ubuntu1
Add an epoch to the version number as there was an unrelated steam package
in the archive with a higher version number.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2000-2003  Thomas Bopp, Thorsten Hampel, Ludger Merkens
2
 
 *
3
 
 *  This program is free software; you can redistribute it and/or modify
4
 
 *  it under the terms of the GNU General Public License as published by
5
 
 *  the Free Software Foundation; either version 2 of the License, or
6
 
 *  (at your option) any later version.
7
 
 *
8
 
 *  This program is distributed in the hope that it will be useful,
9
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
 *  GNU General Public License for more details.
12
 
 *
13
 
 *  You should have received a copy of the GNU General Public License
14
 
 *  along with this program; if not, write to the Free Software
15
 
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
 
 */
17
 
inherit "/factories/RoomFactory";
18
 
 
19
 
#include <macros.h>
20
 
#include <classes.h>
21
 
#include <access.h>
22
 
#include <database.h>
23
 
#include <events.h>
24
 
#include <attributes.h>
25
 
#include <types.h>
26
 
 
27
 
static void init_factory()
28
 
{
29
 
 ::init_factory();
30
 
 init_class_attribute(CALENDAR_TIMETABLE_START, CMD_TYPE_INT, 
31
 
                      "timetable start", 0,
32
 
                      EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 8*60);
33
 
 init_class_attribute(CALENDAR_TIMETABLE_END, CMD_TYPE_INT, 
34
 
                      "timetable end", 0,
35
 
                      EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 18*60);
36
 
 init_class_attribute(CALENDAR_TIMETABLE_ROTATION, CMD_TYPE_INT, 
37
 
                      "timetable rotation", 0,
38
 
                      EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 60);
39
 
 init_class_attribute(CALENDAR_DATE_TYPE, CMD_TYPE_MAPPING, 
40
 
                      "calendar date type", 0,
41
 
                      EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, ([ ]));
42
 
 init_class_attribute(CALENDAR_TRASH, CMD_TYPE_OBJECT, 
43
 
                      "calendar trash", 0,
44
 
                      EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 0);
45
 
 init_class_attribute(CALENDAR_STORAGE, CMD_TYPE_OBJECT, 
46
 
                      "calendar storage", 0,
47
 
                      EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 0);
48
 
 init_class_attribute(CALENDAR_OWNER, CMD_TYPE_OBJECT, 
49
 
                      "calendar owner", 0,
50
 
                      EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 0);
51
 
}
52
 
 
53
 
object execute(mapping vars)
54
 
{
55
 
    object obj;
56
 
    try_event(EVENT_EXECUTE, CALLER, obj);
57
 
    if ( vars->transient ) {
58
 
      if ( mappingp(vars->attributes) )
59
 
        vars->attributes[OBJ_TEMP] = 1;
60
 
      else
61
 
        vars->attributes = ([ OBJ_TEMP : 1 ]);
62
 
    }
63
 
 
64
 
    obj = ::object_create(vars["name"], CLASS_NAME_CALENDAR, 0,
65
 
                          vars["attributes"],
66
 
                          vars["attributesAcquired"], 
67
 
                          vars["attributesLocked"]); 
68
 
 
69
 
    obj->sanction_object(_STEAMUSER, SANCTION_INSERT);
70
 
    object factory = _Server->get_factory(CLASS_TRASHBIN);
71
 
    object trashbin = factory->execute((["name":"trashbin", ]));
72
 
    obj->set_attribute(CALENDAR_TRASH, trashbin);
73
 
    trashbin->move(obj->this());
74
 
    
75
 
    run_event(EVENT_EXECUTE, CALLER, obj);
76
 
    return obj->this();
77
 
}
78
 
 
79
 
string get_identifier() { return "Calendar.factory"; }
80
 
string get_class_name() { return CLASS_NAME_CALENDAR;} 
81
 
int get_class_id() { return CLASS_CALENDAR; }