Example #1
0
def plus_text_parse(item, plus):
    '''parse plus in the contact list'''
    global plus_or_noplus
    # get a plain string with objects
    if plus_or_noplus and plus:
        item = Plus.msnplus_parse(item)
    else:
        item = Plus.msnplus_strip(item)
    return item
Example #2
0
    def _prepare_markup(self, markup, is_plus=True):
        if is_plus:
            text = Plus.msnplus_parse(markup)
        else:
            text = Plus.msnplus_strip(markup)

        text = MarkupParser.replace_markup(text)
        text_list = MarkupParser.replace_emoticons(text)
        return text_list
Example #3
0
    def _prepare_markup(self, markup, is_plus=True):
        if is_plus:
            text = Plus.msnplus_parse(markup)
        else:
            text = Plus.msnplus_strip(markup)

        text = MarkupParser.replace_markup(text)
        text_list = MarkupParser.replace_emoticons(text)
        return text_list
Example #4
0
def plus_text_parse(item, plus):
    '''parse plus in the contact list'''
    global plus_or_noplus
    # get a plain string with objects
    if plus_or_noplus and plus:
        item = Plus.msnplus_parse(item)
    else:
        item = Plus.msnplus_strip(item)
    return item
Example #5
0
 def plus_text_parse(self, item):
     '''parse plus in the contact list'''
     try:
         item = Plus.msnplus_parse(item)
     except Exception, error: # We really want to catch all exceptions
         log.exception("Text: '%s' made the parser go crazy, stripping. Error: %s" % (
                       item, error))
         try:
             item = Plus.msnplus_strip(item)
         except Exception, error: # We really want to catch all exceptions
             log.exception("Even stripping plus markup doesn't help. Error: %s" % error)
Example #6
0
def plus_text_parse(item):
    '''parse plus in the contact list'''
    global plus_or_noplus
    # get a plain string with objects
    if plus_or_noplus:
        try:
            item = Plus.msnplus_parse(item)
        except Exception, error: # We really want to catch all exceptions
            log.info("Text: '%s' made the parser go crazy, stripping. Error: %s" % (
                      item, error))
            try:
                item = Plus.msnplus_strip(item)
            except Exception, error: # We really want to catch all exceptions
                log.info("Even stripping plus markup doesn't help. Error: %s" % error)
Example #7
0
 def plus_text_parse(self, item):
     '''parse plus in the contact list'''
     try:
         item = Plus.msnplus_parse(item)
     except Exception, error:  # We really want to catch all exceptions
         log.exception(
             "Text: '%s' made the parser go crazy, stripping. Error: %s" %
             (item, error))
         try:
             item = Plus.msnplus_strip(item)
         except Exception, error:  # We really want to catch all exceptions
             log.exception(
                 "Even stripping plus markup doesn't help. Error: %s" %
                 error)
Example #8
0
def plus_text_parse(item):
    '''parse plus in the contact list'''
    global plus_or_noplus
    # get a plain string with objects
    if plus_or_noplus:
        try:
            item = Plus.msnplus_parse(item)
        except Exception, error: # We really want to catch all exceptions
            log.exception("Text: '%s' made the parser go crazy, stripping. Error: %s" % (
                      item, error))
            try:
                item = Plus.msnplus_strip(item)
            except Exception, error: # We really want to catch all exceptions
                log.exception("Even stripping plus markup doesn't help. Error: %s" % error)
Example #9
0
    def _on_drag_data_get(self, widget, context, selection, target_id, etime):
        if self.is_contact_selected():
            account = self.get_contact_selected().account
            display_name = self.get_contact_selected().display_name

            if selection.target == 'text/html':
                display_name = Plus.msnplus_parse(display_name)

                for x in range(len(display_name)):
                    if isinstance(display_name[x], dict):
                        display_name[x] = '<img src="file://%s" alt="%s">' %\
                                (display_name[x]["src"], display_name[x]["alt"])

                selection.set(selection.target,
                    8, u'{0} &lt;<a href="mailto:{1}">{1}</a>&gt;'.format(''.join(display_name), account))
            elif selection.target == 'text/plain':
                selection.set(selection.target, 8, u'%s <%s>' % (Plus.msnplus_strip(display_name), account))
Example #10
0
    def _on_drag_data_get(self, widget, context, selection, target_id, etime):
        if self.is_contact_selected():
            account = self.get_contact_selected().account
            display_name = self.get_contact_selected().display_name

            if selection.get_target() == 'text/html':
                display_name = Plus.msnplus_parse(display_name)

                for x in range(len(display_name)):
                    if isinstance(display_name[x], dict):
                        display_name[x] = '<img src="file://%s" alt="%s">' %\
                                (display_name[x]["src"], display_name[x]["alt"])

                selection.set(
                    selection.get_target(), 8,
                    u'{0} &lt;<a href="mailto:{1}">{1}</a>&gt;'.format(
                        ''.join(display_name), account))
            elif selection.get_target() == 'text/plain':
                selection.set(
                    selection.get_target(), 8,
                    u'%s <%s>' % (Plus.msnplus_strip(display_name), account))
            elif selection.get_target() == 'emesene-invite':
                selection.set(selection.get_target(), 8, u'%s' % (account))