def joinEnvironmentalChatRoom(event): """determine if we should join a chatroom""" chat = ChatRoom(config.ROMEO_ENV_NAME) #make sure the drone can be managed by the room username = config.ROMEO_ENV_NAME jbserver = jconfig.JABBER_CHAT_SERVICE jid = "%(username)s@%(jbserver)s" % locals() Team('support').addMember(jid) #get the conversation context set to some sane defaults conversation = Conversation(jid) #grant the room access to the server if jconfig.JABBER_TRUST_ROOM: conversation.grantAuthorization(notify=False) #be vain assume all conversations revolve around ourself context = { 'server': Server(config.HOSTNAME), 'subject': Server(config.HOSTNAME), } conversation.context.update(context) #finally join the room chat.join()
def joinchat(conversation, room): conversation.say("Ok, I will join the %s chat room." % room) chat = ChatRoom(room) chat.join()