Beispiel #1
0
    def performOperation(cls, operation, conf, room, *args):
        """ The 4 operations of this class are quite the same, so we pass the name of the operation, the conference they belong to,
            the chat room for which we are creating the operation and, finally, a list of the arguments needed for the operation"""

        # get the list of users that will receive emails
        pf = PluginFieldsWrapper('InstantMessaging', 'XMPP')
        userList = list(pf.getOption('additionalEmails'))
        if pf.getOption('sendMailNotifications'):
            userList.extend( [user.getEmail() for user in pf.getOption('admins')] )
        if not len(userList) is 0:
            try:
                cn = ChatroomsNotification(room, userList)
                GenericMailer.sendAndLog(getattr(cn, operation)(*args), conf,
                                         PluginsHolder().getPluginType('InstantMessaging').getPlugin("XMPP").getName())
            except Exception, e:
                raise ServiceError(message=_('There was an error while contacting the mail server. No notifications were sent: %s'%e))
Beispiel #2
0
 def generate(self):
     return 'https://'+ \
             PluginFieldsWrapper('InstantMessaging', 'XMPP').getOption('chatServerHost') + \
             '/logs/delete?cr=' + \
             self._chatroom.getTitle() + \
             '@conference.' + \
             self._chatroom.getHost()
Beispiel #3
0
 def eventDetailBanner(self, obj, conf):
     if DBHelpers.roomsToShow(conf):
         vars = {}
         vars['chatrooms'] = DBHelpers.getShowableRooms(conf)
         vars['linksList'] = PluginsHolder().getPluginType('InstantMessaging').getOption('customLinks').getValue()
         vars['how2connect'] = PluginFieldsWrapper('InstantMessaging', 'XMPP').getOption('ckEditor')
         return WEventDetailBanner.forModule(InstantMessaging).getHTML(vars)
     else:
         return ""
Beispiel #4
0
def generateCustomLinks(chatroom):
    linkList = PluginFieldsWrapper('InstantMessaging').getOption('customLinks')

    result = []
    for link in linkList:
        result.append({'name': link['name'],
                       'link': GeneralLinkGenerator(chatroom,
                                                    link['structure']).generate()
                       })
    return result
Beispiel #5
0
    def performOperation(cls, operation, conf, room, *args):
        """ The 4 operations of this class are quite the same, so we pass the name of the operation, the conference they belong to,
            the chat room for which we are creating the operation and, finally, a list of the arguments needed for the operation"""

        # get the list of users that will receive emails
        pf = PluginFieldsWrapper('InstantMessaging', 'XMPP')
        userList = list(pf.getOption('additionalEmails'))
        if pf.getOption('sendMailNotifications'):
            userList.extend(
                [user.getEmail() for user in pf.getOption('admins')])
        if not len(userList) is 0:
            try:
                cn = ChatroomsNotification(room, userList)
                GenericMailer.sendAndLog(
                    getattr(cn, operation)(*args), conf,
                    PluginsHolder().getPluginType(
                        'InstantMessaging').getPlugin("XMPP").getName())
            except Exception, e:
                raise ServiceError(message=_(
                    'There was an error while contacting the mail server. No notifications were sent: %s'
                    % e))
Beispiel #6
0
 def generate(self, sDate=None, eDate=None):
     dates = ''
     if sDate != None:
         dates = '&sdate=' + sDate
     elif eDate != None:
         dates = '&edate=' + eDate
     if eDate != None and sDate != None:
         dates += '&edate=' + eDate
     return 'https://'+ \
             PluginFieldsWrapper('InstantMessaging', 'XMPP').getOption('chatServerHost') + \
             '/logs/?cr=' + \
             self._chatroom.getTitle().lower() + \
             '@conference.' + \
             self._chatroom.getHost() + \
             dates
Beispiel #7
0
    def meetingAndLectureDisplay(cls, obj, params):
        out = params['out']
        conf = params['conf']
        if DBHelpers.roomsToShow(conf):
            linksList = PluginsHolder().getPluginType(
                'InstantMessaging').getOption('customLinks').getValue()
            out.openTag("chatrooms")
            for chatroom in DBHelpers.getShowableRooms(conf):
                out.openTag("chatroom")

                out.writeTag("id", chatroom.getId())
                out.writeTag("name", chatroom.getTitle())
                out.writeTag(
                    "server", 'conference.' + chatroom.getHost() if
                    chatroom.getCreatedInLocalServer() else chatroom.getHost())
                out.writeTag("description", chatroom.getDescription())
                out.writeTag("reqPassword",
                             _('Yes') if chatroom.getPassword() else _('No'))
                out.writeTag("showPassword", chatroom.getShowPass())
                out.writeTag("password", chatroom.getPassword())
                out.writeTag("createdInLocalServer",
                             chatroom.getCreatedInLocalServer())
                out.openTag("links")
                if linksList.__len__() > 0:
                    out.writeTag("linksToShow", 'true')
                else:
                    out.writeTag("linksToShow", 'false')

                for link in linksList:
                    out.openTag("customLink")
                    out.writeTag("name", link['name'])
                    out.writeTag(
                        "structure",
                        GeneralLinkGenerator(chatroom,
                                             link['structure']).generate())
                    out.closeTag("customLink")

                out.closeTag("links")
                out.closeTag("chatroom")
            out.closeTag("chatrooms")

            out.writeTag(
                "how2connect",
                PluginFieldsWrapper('InstantMessaging',
                                    'XMPP').getOption('ckEditor'))
Beispiel #8
0
class WConfModifChat(wcomponents.WTemplated):
    def __init__(self, conference, activeTab, tabNames, aw):
        self._conf = conference
        self._activeTab = activeTab
        self._tabNames = tabNames
        self._aw = aw
        self._user = aw.getUser()

    def getVars(self):
        vars = WTemplated.getVars(self)
        vars["Conference"] = self._conf
        try:
            chatrooms = list(DBHelpers.getChatroomList(self._conf))
            vars["Chatrooms"] = fossilize(chatrooms)
            if len(vars['Chatrooms']) is 0:
                vars['Chatrooms'] = None
        except Exception, e:
            vars["Chatrooms"] = None
            chatrooms = {}
        links = {}

        for cr in chatrooms:
            crinfo = links[cr.getId()] = {}
            crinfo['custom'] = generateCustomLinks(cr)
            crinfo['logs'] = generateLogLink(cr, self._conf)

        vars['links'] = links

        vars['DefaultServer'] = PluginFieldsWrapper(
            'InstantMessaging', 'XMPP').getOption('chatServerHost')
        vars["EventDate"] = formatDateTime(
            getAdjustedDate(nowutc(), self._conf))
        vars["User"] = self._user
        vars["tz"] = DisplayTZ(self._aw, self._conf).getDisplayTZ()
        vars["MaterialUrl"] = RHMaterialsShow._uh().getURL(
            self._conf).__str__()
        vars["ShowLogsLink"] = XMPPLogsActivated()

        return vars
Beispiel #9
0
class IMIndex(Persistent):

    def __init__(self, index, storingStructure=OOBTree, pluginId="XMPP"):
        self._root = PluginFieldsWrapper('InstantMessaging', pluginId).getStorage()
        self._index = index
        self._storingStructure = storingStructure
        self._indexCheck()

    def _indexCheck(self):
        """ If the index doesn't exist we'll need to create it. In case you don't understand this method
            take a pencil and a paper and draw the tree to get it. Do NOT change it without being completely
            sure of what you're doing!"""
        #if not self._root.has_key(self._index):
        #    self._root[self._index] = self._storingStructure()
        #self._indexToAccess = self._root[self._index]
        if not self._root.has_key(self._index):
            self._root[self._index] = self
            self._data = self._storingStructure()
        self._indexToAccess = self._root[self._index]
        self._data = self._indexToAccess.get()

    def _indexCheckDelete(self, element):
        #if len( self._root[self._index][element] ) is 0:
        #    self._root[self._index].pop(element)
        if len( self.get()[element] ) is 0:
            self.get().pop(element)


    def get(self):
        #return self._indexToAccess
        return self._data

    def index(self, element):
        pass

    def unindex(self, element):
        pass
Beispiel #10
0
class IMIndex(Persistent):

    def __init__(self, index, storingStructure=OOBTree, pluginId="XMPP"):
        self._root = PluginFieldsWrapper('InstantMessaging', pluginId).getStorage()
        self._index = index
        self._storingStructure = storingStructure
        self._indexCheck()

    def _indexCheck(self):
        """ If the index doesn't exist we'll need to create it. In case you don't understand this method
            take a pencil and a paper and draw the tree to get it. Do NOT change it without being completely
            sure of what you're doing!"""
        #if not self._root.has_key(self._index):
        #    self._root[self._index] = self._storingStructure()
        #self._indexToAccess = self._root[self._index]
        if not self._root.has_key(self._index):
            self._root[self._index] = self
            self._data = self._storingStructure()
        self._indexToAccess = self._root[self._index]
        self._data = self._indexToAccess.get()

    def _indexCheckDelete(self, element):
        #if len( self._root[self._index][element] ) is 0:
        #    self._root[self._index].pop(element)
        if len( self.get()[element] ) is 0:
            self.get().pop(element)


    def get(self):
        #return self._indexToAccess
        return self._data

    def index(self, element):
        pass

    def unindex(self, element):
        pass
Beispiel #11
0
 def __init__(self, index, storingStructure=OOBTree, pluginId="XMPP"):
     self._root = PluginFieldsWrapper('InstantMessaging', pluginId).getStorage()
     self._index = index
     self._storingStructure = storingStructure
     self._indexCheck()
Beispiel #12
0
def XMPPLogsActivated():
    return PluginFieldsWrapper('InstantMessaging',
                               'XMPP').getOption('activateLogs')
Beispiel #13
0
 def isActive(self):
     return PluginFieldsWrapper('InstantMessaging',
                                'XMPP').getOption('joinDesktopClients')
Beispiel #14
0
 def __init__(self, index, storingStructure=OOBTree, pluginId="XMPP"):
     self._root = PluginFieldsWrapper('InstantMessaging', pluginId).getStorage()
     self._index = index
     self._storingStructure = storingStructure
     self._indexCheck()