1 /* Copyright (C) 2000-2004 Thomas Bopp, Thorsten Hampel, Ludger Merkens
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.
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.
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
17 * $Id: MessageboardFactory.pike,v 1.1 2008/03/31 13:39:57 exodusd Exp $
19 inherit "/factories/ObjectFactory";
25 #include <attributes.h>
26 class MessageboardFactory : public ObjectFactory{
33 string get_identifier() { return "Messageboard.factory"; }
34 string get_class_name() { return "Messageboard"; }
35 int get_class_id() { return CLASS_MESSAGEBOARD; }
38 * The execute function - create a new instance of type "Object"
40 * @param mapping vars - variables like name and description
41 * @return the newly created object
43 object execute(mapping vars)
47 string name = vars["name"];
48 try_event(EVENT_EXECUTE, CALLER, obj);
49 if ( vars->transient ) {
50 if ( mappingp(vars->attributes) )
51 vars->attributes[OBJ_TEMP] = 1;
53 vars->attributes = ([ OBJ_TEMP : 1 ]);
55 obj = ::object_create(name, get_class_name(), 0,
57 vars["attributesAcquired"],
58 vars["attributesLocked"],
60 vars["sanctionMeta"]);
62 if ( stringp(vars["description"]) )
63 obj->set_attribute(OBJ_DESC, vars["description"]);
64 object nntp = _Server->get_module("nntp");
66 nntp->register_group(obj);
67 run_event(EVENT_EXECUTE, CALLER, obj);