1
# -*- coding: utf-8 -*-
3
# This file is part of emesene.
5
# Emesene is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
10
# emesene is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with emesene; if not, write to the Free Software
17
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
'''a module to handle groups'''
22
import abstract.stock as stock
23
import abstract.GroupManager
27
class GroupManager(abstract.GroupManager.GroupManager):
28
'''this class represent an abstract class that provide methods
29
to interact with groups, implementing this class with the
30
undeliying protocol library let the upper layer use the services
31
of the protocol implementation independently of the api, in this
32
way, the protocol library can be modified (or replaced)
33
without effect on the clients'''
35
def __init__(self, dialog_manager, protocol):
36
'''initialize the object, dialog_manager is a implementation
37
ot DialogManager, it's used to interact with the user'''
38
abstract.GroupManager.GroupManager.__init__(self,
39
dialog_manager, protocol)
44
self.protocol.addGroup(name)
46
debug("invalid group name '%s'" % (name,))
48
def rename(self, name, new_name):
50
if new_name and name != new_name:
51
self.protocol.renameGroup(name, new_name)
53
debug("invalid group name '%s'" % (new_name,))
55
def remove(self, name):
57
self.protocol.removeGroup(name)