diff --git a/mumble/channel.py b/mumble/channel.py index 4872807..ef7d646 100644 --- a/mumble/channel.py +++ b/mumble/channel.py @@ -36,15 +36,33 @@ class Channel(object): return self.__channel.position def delete(self): + """ + Remove the channel from Mumble + """ self.__server.remove_channel(self.__channel.id) + return True def update(self, **kwargs): + """ + Update a channel property on the Mumble server + """ for key, value in kwargs.items(): setattr(self.__channel, key, value) self.__server.set_channel_state(self.__channel) def send_message(self, text, tree=False): - self.__server.send_message(self.__channel.id, tree, text) + """ + Send a message to the channel + """ + return self.__server.send_channel_message(self.__channel.id, text, tree) + + def link(self, channel): + """ + Link this channel to another channel + """ + current_links = self.__channel.links + current_links.append(channel.id) + self.update(links=current_links) def serialize(self): return { diff --git a/mumble/server.py b/mumble/server.py index 9c381d8..b656e47 100644 --- a/mumble/server.py +++ b/mumble/server.py @@ -57,12 +57,17 @@ class Server(object): def set_channel_state(self, channel): self.__server.setChannelState(channel) - def add_channel(self, name, parent): - return self.__server.addChannel(name, parent) + def add_channel(self, name, parent=0): + channel_id = self.__server.addChannel(name, parent) + return self.get_channel(channel_id) def remove_channel(self, channel_id): self.__server.removeChannel(channel_id) + def send_channel_message(self, channel_id, text, tree=False): + self.__server.sendMessageChannel(channel_id, tree, text) + return True + # Users def get_users(self):