예제 #1
0
 def offMsg(self, msnp, oim):
     """called when someone sent an offline message"""
     email = oim[0]["addr"]
     if not (self.notifyNewMsg and self.notifyEnabled(email)):
         return
     result = self.controller.conversationManager.getOpenConversation(email)
     if result != None:
         window, conversation = result
         windowFocus = window.is_active()
         tabFocus = window.conversation == conversation
         if windowFocus and tabFocus:
             return
     nick = unescape(self.controller.unifiedParser.getParser(self.msn.getUserDisplayName(email)).get())
     contact = self.msn.contactManager.getContact(email)
     userPixbuf = self.theme.getUserDisplayPicture(contact)
     self.notificationManager.newNotification(
         unicode(nick)[:20] + "\n" + _("sent an offline message"),
         self.position,
         self.scroll,
         self.pixmap,
         self.close,
         self.startConversation,
         (email, None),
         userPixbuf,
         self.fontname,
         self.fontcolor,
     )
예제 #2
0
 def subICE(self, data):
     ce = data.groups()[0]
     customEmoticons = self.conversation.customEmoticons.get(self.username)
     return '<object type="application/x-emesene-emoticon" class="%s" ' 'data="%s"></object>' % (
         customEmoticons[unescape(ce)],
         ce,
     )
예제 #3
0
 def newMail(self, msnp, From, FromAddr, Subject, MessageURL, PostURL, id):
     """ called when receiving mail """
     if not (self.notifyNewMail and self.notifyEnabled(FromAddr)):
         return
     contact = self.msn.contactManager.getContact(FromAddr)
     if contact == None:
         text = _("From: ") + From + " &lt;" + FromAddr + "&gt;"
         userPixbuf = None
     else:
         text = _("From: ") + unescape(
             self.controller.unifiedParser.getParser(self.msn.getUserDisplayName(FromAddr)).get()
         )
         userPixbuf = self.theme.getUserDisplayPicture(contact)
     text += "\n" + _("Subj: ") + escape(Subject)
     self.notificationManager.newNotification(
         _("New email") + "\n" + text,
         self.position,
         self.scroll,
         self.pixmap,
         self.close,
         self.openMail,
         (MessageURL, PostURL, id),
         userPixbuf,
         self.fontname,
         self.fontcolor,
     )
예제 #4
0
    def newMsg(self, msnp, email):
        '''called when someone send a message'''

        if not (self.notifyNewMsg and self.notifyEnabled(email)):
            return

        result = self.controller.conversationManager.getOpenConversation(email)
        if result != None:
            if self.notifyStarted:
                return
            window, conversation = result
            windowFocus = window.is_active()
            tabFocus = (window.conversation == conversation)
            if windowFocus and tabFocus:
                return

        nick = unescape(self.controller.unifiedParser.getParser\
                (self.msn.getUserDisplayName(email)).get())
        contact = self.msn.contactManager.getContact(email)
        userPixbuf = self.theme.getUserDisplayPicture(contact)

        self.notificationManager.newNotification(unicode(nick)[:20] \
                + "\n" + _('has send a message'), self.position, self.scroll, \
                self.pixmap, self.close, self.startConversation, \
                (email, None), userPixbuf, self.fontname, self.fontcolor)
예제 #5
0
    def newMsg(self, msnp, email):
        '''called when someone send a message'''

        if not (self.notifyNewMsg and self.notifyEnabled(email)):
            return

	result = self.controller.conversationManager.getOpenConversation(email)
        if result != None:
            if self.notifyStarted:
                return
            window, conversation = result
            windowFocus = window.is_active()
            tabFocus = (window.conversation == conversation)
            if windowFocus and tabFocus:
                return

        nick = unescape(self.controller.unifiedParser.getParser\
                (self.msn.getUserDisplayName(email)).get())
        contact = self.msn.contactManager.getContact(email)
        userPixbuf = self.theme.getUserDisplayPicture(contact)

        self.notificationManager.newNotification(unicode(nick)[:20] \
                + "\n" + _('has send a message'), self.position, self.scroll, \
                self.pixmap, self.close, self.startConversation, \
                (email, None), userPixbuf, self.fontname, self.fontcolor)
예제 #6
0
 def get( self, escaped=True ):
     data = ''
     for item in self.parser.parse( self, self.text ):
         if escaped:
             data += str(item)
         else:
             data += unescape(str(item))
     return data
예제 #7
0
 def get( self, escaped=True ):
     data = ''
     for item in self.parser.parse( self, self.text ):
         if escaped:
             data += str(item)
         else:
             data += unescape(str(item))
     return data
예제 #8
0
 def subOCE( self, data ):
     ce = data.groups()[0]
     msnOM = self.conversation.switchboard.msn.getMsnObjectsManager()
     filename = msnOM.getById(unescape(ce)).filename.replace("%", "%25")
     if os.name == 'posix':
         return '<img src="file://%s" alt="%s"/>' % (filename, ce)
     else:
         return '<img src="file://localhost/%s" alt="%s"/>' % (filename, ce)
예제 #9
0
 def addEntry(self, status, email = None):
     '''add a new entry to the liststore'''
     if email != None:
         nick = unescape(self.controller.unifiedParser.getParser(
                     self.controller.msn.contactManager.\
                     getContactNick(email)).get())
     else:
         nick = self.controller.msn.user
     time = strftime('[%H:%M:%S]', localtime())
     self.listStore.prepend([time, nick, status])
     self.comboBox.set_active(0)
예제 #10
0
 def _on_email_changed(self, combobox):
     """called when the user changes the email combobox"""
     newEmail = combobox.get_active_text()
     nick = self.parser.getParser(self.contacts.get_display_name(newEmail)).get()
     text = unescape(nick)
     self.set_title("%s" % text)
     self.contactMail = newEmail
     self.view.set_model(None)
     self.model.clear()
     self.fill()
     self.view.set_model(self.model)
예제 #11
0
 def offline(self, msnp, email):
     ''' called when someone get offline '''
     if not (self.notifyOffline and self.notifyEnabled(email)):
         return
     nick = unescape(self.controller.unifiedParser.getParser\
             (self.msn.getUserDisplayName(email)).get())
     contact = self.msn.contactManager.getContact(email)
     userPixbuf = self.theme.getUserDisplayPicture(contact)
     self.notificationManager.newNotification(unicode(nick)[:20] \
             + "\n" + _("is offline"), self.position, self.scroll, \
             self.pixmap, self.close, None, None, userPixbuf, \
             self.fontname, self.fontcolor)
 def _on_email_changed(self, combobox):
     '''called when the user changes the email combobox'''
     newEmail = combobox.get_active_text()
     nick = self.parser.getParser(
         self.contacts.get_display_name(newEmail)).get()
     text = unescape(nick)
     self.set_title('%s' % text)
     self.contactMail = newEmail
     self.view.set_model(None)
     self.model.clear()
     self.fill()
     self.view.set_model(self.model)
    def addEntry(self, status, email=None):
        '''add a new entry to the liststore'''
        if email != None:
            nick = unescape(self.controller.unifiedParser.getParser(
                        self.controller.msn.contactManager.\
                        getContactNick(email)).get())
        else:
            nick = self.controller.msn.user

        time = strftime('[%H:%M:%S]', localtime())
        self.listStore.prepend([time, nick, status])
        self.comboBox.set_active(0)
    def getNickPM(self, email, name = ''):
        ''' returns the nick and pm of the contact '''

        contact = self.msn.contactManager.getContact(email)  # :(:(

        if not self.contacts.exists(email):
            text = name + ' &lt;' + email + '&gt;'
        else:
            # @roger, this is ugly
            nick = self.parser.getParser(
                self.contacts.get_display_name(email)).get()
            text = unescape(nick)

        return contact, text
예제 #15
0
    def offline(self, msnp, email):
        ''' called when someone get offline '''

        if not (self.notifyOffline and self.notifyEnabled(email)):
            return

        nick = unescape(self.controller.unifiedParser.getParser\
                (self.msn.getUserDisplayName(email)).get())
        contact = self.msn.contactManager.getContact(email)
        userPixbuf = self.theme.getUserDisplayPicture(contact)

        self.notificationManager.newNotification(unicode(nick)[:20] \
                + "\n" + _("is offline"), self.position, self.scroll, \
                self.pixmap, self.close, None, None, userPixbuf, \
                self.fontname, self.fontcolor)
예제 #16
0
 def receiveTyping(self, msn, switchboard, signal, args):
     '''called when someone starts typing'''
     email = args[0]
     if not (self.notifyTyping and self.notifyEnabled(email)):
         return
     if self.controller.conversationManager.getOpenConversation\
             (email, switchboard) != None:
         return
     nick = unescape(self.controller.unifiedParser.getParser\
             (self.msn.getUserDisplayName(email)).get())
     contact = self.msn.contactManager.getContact(email)
     userPixbuf = self.theme.getUserDisplayPicture(contact)
     self.notificationManager.newNotification(unicode(nick)[:20] \
             + "\n" + _('starts typing...'), self.position, self.scroll, \
             self.pixmap, self.close, self.startConversation, \
             (email, switchboard), userPixbuf, self.fontname, self.fontcolor)
예제 #17
0
 def newMail(self, msnp, From, FromAddr, Subject, MessageURL, PostURL, id):
     ''' called when receiving mail '''
     if not (self.notifyNewMail and self.notifyEnabled(FromAddr)):
         return
     contact = self.msn.contactManager.getContact(FromAddr)
     if contact == None:
         text = _('From: ') + From +' &lt;' + FromAddr + '&gt;'
         userPixbuf = None
     else:
         text = _('From: ') + unescape(self.controller.unifiedParser.\
             getParser(self.msn.getUserDisplayName(FromAddr)).get())
         userPixbuf = self.theme.getUserDisplayPicture(contact)
     text += '\n' + _('Subj: ') + escape(Subject)
     self.notificationManager.newNotification(_('New email') \
             + "\n" + text, self.position, self.scroll, self.pixmap, \
             self.close, self.openMail, (MessageURL, PostURL, id), \
             userPixbuf, self.fontname, self.fontcolor)
예제 #18
0
    def receiveTyping(self, msn, switchboard, signal, args):
        '''called when someone starts typing'''
        email = args[0]

        if not (self.notifyTyping and self.notifyEnabled(email)):
            return

        if self.controller.conversationManager.getOpenConversation\
                (email, switchboard) != None:
            return

        nick = unescape(self.controller.unifiedParser.getParser\
                (self.msn.getUserDisplayName(email)).get())
        contact = self.msn.contactManager.getContact(email)
        userPixbuf = self.theme.getUserDisplayPicture(contact)

        self.notificationManager.newNotification(unicode(nick)[:20] \
                + "\n" + _('starts typing...'), self.position, self.scroll, \
                self.pixmap, self.close, self.startConversation, \
                (email, switchboard), userPixbuf, self.fontname, self.fontcolor)
예제 #19
0
 def online(self, msnp, email, oldStatus):
     """ called when someone get online """
     if not (self.notifyOnline and self.notifyEnabled(email)):
         return
     if oldStatus != "FLN":
         return
     nick = unescape(self.controller.unifiedParser.getParser(self.msn.getUserDisplayName(email)).get())
     contact = self.msn.contactManager.getContact(email)
     userPixbuf = self.theme.getUserDisplayPicture(contact)
     self.notificationManager.newNotification(
         unicode(nick)[:20] + "\n" + _("is online"),
         self.position,
         self.scroll,
         self.pixmap,
         self.close,
         self.startConversation,
         (email, None),
         userPixbuf,
         self.fontname,
         self.fontcolor,
     )
예제 #20
0
    def newMail(self, msnp, From, FromAddr, Subject, MessageURL, PostURL, id):
        ''' called when receiving mail '''

        if not (self.notifyNewMail and self.notifyEnabled(FromAddr)):
            return

        contact = self.msn.contactManager.getContact(FromAddr)
        if contact == None:
            text = _('From: ') + From + ' &lt;' + FromAddr + '&gt;'
            userPixbuf = None
        else:
            text = _('From: ') + unescape(self.controller.unifiedParser.\
                getParser(self.msn.getUserDisplayName(FromAddr)).get())
            userPixbuf = self.theme.getUserDisplayPicture(contact)

        text += '\n' + _('Subj: ') + escape(Subject)

        self.notificationManager.newNotification(_('New email') \
                + "\n" + text, self.position, self.scroll, self.pixmap, \
                self.close, self.openMail, (MessageURL, PostURL, id), \
                userPixbuf, self.fontname, self.fontcolor)
예제 #21
0
    def __init__(self, controller, cache_path, contactMail):
        """Constructor"""
        gtk.Window.__init__(self)

        self.controller = controller
        self.cache_path = cache_path
        self.contactMail = contactMail

        self.parser = controller.unifiedParser
        self.contacts = controller.contacts
        nick = self.parser.getParser(self.contacts.get_display_name(self.contactMail)).get()
        text = unescape(nick)
        self.set_title("%s" % text)
        self.set_default_size(570, 400)
        self.set_border_width(4)
        self.set_position(gtk.WIN_POS_CENTER)
        self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)

        self.model = gtk.ListStore(gtk.gdk.Pixbuf, str, str)

        self.fill()

        self.view = gtk.IconView(self.model)

        self.view.set_pixbuf_column(0)
        self.view.set_tooltip_column(2)
        self.view.set_text_column(2)
        self.view.connect("button-press-event", self._on_button_press_event)

        scroll = gtk.ScrolledWindow()
        scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        scroll.set_shadow_type(gtk.SHADOW_IN)
        scroll.add(self.view)

        comboEmails = gtk.combo_box_new_text()
        clist = sorted(set(self.controller.contacts.contacts))
        for contact in clist:
            comboEmails.append_text(contact)
        comboEmails.set_active(clist.index(self.contactMail))

        comboEmails.connect("changed", self._on_email_changed)

        vbox = gtk.VBox(spacing=4)
        hbox = gtk.HBox(spacing=4)

        hbbox = gtk.HButtonBox()

        b_close = gtk.Button(stock=gtk.STOCK_CLOSE)

        b_close.connect("clicked", self._on_close_button)

        hbbox.pack_start(comboEmails, False)
        hbbox.pack_end(b_close, False)

        hbox.pack_start(scroll, True, True)

        vbox.pack_start(hbox, True, True)
        vbox.pack_start(hbbox, False)

        vbox.show_all()
        self.add(vbox)
예제 #22
0
 def subICE( self, data ):
     ce = data.groups()[0]
     customEmoticons = self.conversation.customEmoticons.get( self.username )
     return '<object type="application/x-emesene-emoticon" class="%s" ' \
         'data="%s"></object>' % (customEmoticons[unescape(ce)], ce)
    def __init__(self, controller, cache_path, contactMail):
        '''Constructor'''
        gtk.Window.__init__(self)

        self.controller = controller
        self.cache_path = cache_path
        self.contactMail = contactMail

        self.parser = controller.unifiedParser
        self.contacts = controller.contacts
        nick = self.parser.getParser(
            self.contacts.get_display_name(self.contactMail)).get()
        text = unescape(nick)
        self.set_title('%s' % text)
        self.set_default_size(570, 400)
        self.set_border_width(4)
        self.set_position(gtk.WIN_POS_CENTER)
        self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)

        self.model = gtk.ListStore(gtk.gdk.Pixbuf, str, str)

        self.fill()

        self.view = gtk.IconView(self.model)

        self.view.set_pixbuf_column(0)
        self.view.set_tooltip_column(2)
        self.view.set_text_column(2)
        self.view.connect("button-press-event", self._on_button_press_event)

        scroll = gtk.ScrolledWindow()
        scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        scroll.set_shadow_type(gtk.SHADOW_IN)
        scroll.add(self.view)

        comboEmails = gtk.combo_box_new_text()
        clist = sorted(set(self.controller.contacts.contacts))
        for contact in clist:
            comboEmails.append_text(contact)
        comboEmails.set_active(clist.index(self.contactMail))

        comboEmails.connect('changed', self._on_email_changed)

        vbox = gtk.VBox(spacing=4)
        hbox = gtk.HBox(spacing=4)

        hbbox = gtk.HButtonBox()

        b_close = gtk.Button(stock=gtk.STOCK_CLOSE)

        b_close.connect('clicked', self._on_close_button)

        hbbox.pack_start(comboEmails, False)
        hbbox.pack_end(b_close, False)

        hbox.pack_start(scroll, True, True)

        vbox.pack_start(hbox, True, True)
        vbox.pack_start(hbbox, False)

        vbox.show_all()
        self.add(vbox)