Example #1
0
 def OnStatus(self, event):
     status_dict = statuscombo.status_dict
     for status in status_dict:
         if status_dict[status] == event.GetId():
             import hooks
             hooks.notify('digsby.statistics.ui.select_status')
             profile.set_status(status)
Example #2
0
    def on_state_change(self, src, attr, old, new):
        assert attr in ('state', None)

        hooks.notify('account.state', src, new)

        # Update "connected_accounts" list
        conn = [a for a in self.accounts + [self.profile] if a.connected]
        if self.connected_accounts != conn:
            self.connected_accounts[:] = conn

        if new != StateMixin.Statuses.OFFLINE:
            if src in self.cancellers:
                self.cancellers.pop(src).cancel()
            x = self.reconnect_timers.pop(src,None)

            if x is not None:
                x.stop()

        if new == StateMixin.Statuses.OFFLINE:
            self._on_account_offline(src)
            self._check_all_offline()

        if new == StateMixin.Statuses.ONLINE:
            src.error_count = 0

            # for IM accounts signing on, set their profile.
            if src in self.accounts:
                self.profile.set_formatted_profile(src.connection)
Example #3
0
    def OnOk(self,event):

        self.Show(False)

        import hooks; hooks.notify('digsby.statistics.contact_added')
        proto    = self.protocombo.Value.id
        name     = self.namefield.Value
        group    = self.groupcombo.Value if isinstance(self.groupcombo.Value,basestring) else self.groupcombo.Value.GetContentAsString()
        alias    = self.aliasfield.Value
        accounts = self.accountchecks.theset


        import hub
        from common import profile
        meta = False
        x = None
        for account in accounts:
            with traceguard:
                account.connection.add_new_buddy(name, group, proto, alias)
                x = (name, account.connection.service)
                if x in profile.blist.metacontacts.buddies_to_metas:
                    meta = True

        if meta:
            id = list(profile.blist.metacontacts.buddies_to_metas[x])[0].id
            m = profile.blist.metacontacts[id]
            alias = m.alias
            group = list(m.groups)[0][-1]
            hub.get_instance().user_message(
            "That buddy is already part of metacontact \"" + alias +
            "\" in group \"" + group + "\"")

        self.Close()
Example #4
0
    def OnComposeEmail(self, to='', subject='', body='', cc='', bcc='', callback = None):
        import hooks; hooks.notify('digsby.statistics.email.compose')
        for name in ('to','subject', 'body', 'cc', 'bcc'):
            assert isinstance(vars()[name], basestring), (name, type(vars()[name]), vars()[name])

        if self.mailclient and try_this(lambda: self.mailclient.startswith('file:'), False):
            os.startfile(self.mailclient[5:])

        elif self.mailclient == 'sysdefault':
            kw = {}
            for name in ('subject', 'body', 'cc',  'bcc'):
                if vars()[name]:
                    kw[name] = vars()[name]

            query = UrlQuery('mailto:' + quote(to), **kw)
            log.info('OnComposeEmail is launching query: %s' % query)
            try:
                os.startfile(query)
            except WindowsError:
                # WindowsError: [Error 1155] No application is associated with the specified file for this operation: 'mailto:'
                mailclient_error()
                raise

        elif self.mailclient == '__urls__':
            url = self.custom_compose_url
            if url is not None: launch_browser(url)

        else:
            url = self.compose(to, subject, body, cc, bcc)
            if url:
                launch_browser(url)

        callback.success()
Example #5
0
    def download_success(self, success_files):
        log.info("Downloaded files. %d files downloaded", len(success_files))

        updater = self.updater
        if updater is None:
            self.cancel()
            return
        self.write_file_changes(updater.temp_dir, updater.update_files, updater.delete_files)

        hooks.notify('digsby.updater.update_complete')
        if not common.pref("digsby.updater.install_prompt", type = bool, default = False):
            log.debug("Update install prompt disabled. Scheduling install")
            self.schedule_install()
        else:
            res = []

            def after_popup():
                if (not res) or res[0] is None:
                    log.debug("Popup was not shown. Scheduling install")
                    self.schedule_install()

            @wx.CallAfter
            def do_popup():
                res.append(gui.toast.popup(
                    icon = gui.skin.get('serviceicons.digsby'),
                    header = _("Update Ready"),
                    minor = _("A new version of Digsby is ready to install. Restart Digsby to apply the update."),
                    sticky = True,
                    buttons = [(_("Restart Now"), self.do_install),
                               (_("Restart Later"), self.schedule_install)],
                    onclose = self._install_popup_closed,
#                    popupid = 'digsby.update',
                ))
                wx.CallAfter(after_popup)
Example #6
0
 def markAsRead(self, email_message):
     '''
     Mark the email object as read.
     '''
     import hooks
     hooks.notify('digsby.statistics.email.mark_as_read')
     self._remove_email(email_message)
Example #7
0
    def handle_response(self, stanza):
        try:
            c = CounterQuery(stanza.get_query())
        except ValueError:
            return
        with self.lock:
            for action in c: #usually one element, but whatever.
                if action.type is None:
                    continue
                self.cached[action.type] = action.result
        import hooks #has protected notify

        actions = []
        for action in c: #usually one element, but whatever.
            if action.type is None:
                continue
            actions.append(dict(
                                                 type    = action.type,
                                                 initial = action.initial,
                                                 value   = action.value,
                                                 result  = action.result,
                                                 )
            )
        for action in actions:
            hooks.notify('digsby.stats_counter', **action)
        hooks.notify('digsby.stats_counter.batch', actions)
Example #8
0
    def got_file(self, file, resp, backup_exception = None):
        dest_path = self.local_path_for_file(file)
        if not dest_path.parent.isdir():
            dest_path.parent.makedirs()
        with open(dest_path, 'wb') as f:
            data = resp.read(32768)
            while data:
                f.write(data)
                data = resp.read(32768)

        resp.close()

        if file.match_local(dest_path):
            log.debug("successful download: %r", file.path)
            self.downloaded_files.append(file)
            hooks.notify("digsby.updater.file_download_complete", file)
        else:
            try:
                dest_path.remove()
            except Exception, e:
                log.debug("Error deleting bad file: %r", e)

            if backup_exception is None:
                self.try_backup(file, Exception("Bad data from primary server"))
                return # Don't queue next file yet.
            else:
                log.error("Error downloading %r. Bad data from backup server; primary server error was: %r",
                          file.path, backup_exception)
                self.errored_files.append(file)
                hooks.notify("digsby.updater.file_download_error", file)
Example #9
0
    def append_comments(self, webview, id, post_id):
        hooks.notify('digsby.linkedin.comment_added', {})
        t = LinkedInIB(self)
        context = {}
        context['item'] = self.connection.get_post_by_id(post_id)
        comments_html = t.get_html(
            None,
            set_dirty=False,
            file='comments_list.tenjin',
            dir=t.get_context()['app'].get_res_dir('base'),
            context=context)
        comment_link_html = t.get_html(
            None,
            set_dirty=False,
            file='comment_link.tenjin',
            dir=t.get_context()['app'].get_res_dir('base'),
            context=context)

        log.debug("comments_html = %r; comment_link_html = %r", comments_html,
                  comment_link_html)

        self.Dsuccess(webview,
                      id,
                      comments_html=comments_html,
                      comment_link_html=comment_link_html)
Example #10
0
    def set_blob(self, elem_name, data, force=False, callback=None):
        '''
        Decide to send a blob to the server, or not.
        Run caching routine before doing so.
        response goes to self.set_blob_success
        '''
        try:
            hooks.notify('digsby.identity.save_data', elem_name, data)
        except Exception:
            callback.error()
        else:
            callback.success()
        finally:
            return
        blob = name_to_obj[elem_name](data=data)

        stored = self.blobhashes.get(elem_name, sentinel)
        if stored is not sentinel:
            stored1 = stored[1]
        else:
            stored1 = sentinel

        if stored1 == self.calc_blob_hash(blob) and not force:
            log.info('set_blob %s: no change', elem_name)
            return callback.success()

        #cache here
        sending_stamp = blob.tstamp
        try:
            int(sending_stamp)
        except Exception, e:
            if stored is not sentinel:
                blob.tstamp = stored[0]
            else:
                blob.tstamp = 0
Example #11
0
    def CheckBoxClicked(self, item, checkbox):
        uinfo    = self.UserNotifications
        topic    = self.TopicForIndex(item)
        reaction = self.checkBoxReactions[checkbox]

        if not None in uinfo: uinfo[None] = {}
        reactions = uinfo[None].setdefault(topic, [])

        #
        # remove
        #
        foundOne = False
        for rdict in list(reactions):
            if rdict['reaction'] == reaction:
                foundOne = True
                log.info('removing %r', rdict)
                reactions.remove(rdict)
        #
        # add
        #
        if not foundOne:
            # adding one
            newEntry = self.ReactionEntry(topic, reaction)
            log.info('adding %r', newEntry)
            reactions.append(newEntry)

        import hooks
        hooks.notify('digsby.notifications.changed')

        self.RefreshLine(item)
Example #12
0
 def do_acct_math(*a, **k):
     has_accts = set(a.protocol for a in self.profile.all_accounts)
     if (has_accts & set(accttypes)): #user has accounts we're targeting
         log.critical('sending message obj to hook')
         hooks.notify('digsby.server.announcement', messageobj)
     else:
         log.critical('filtering conditional message for no accounts in common')
Example #13
0
    def on_close(self):
        if getattr(self, "_closed", False):
            log.warning("FIXME: imwin_ctrl.on_close was called more than once!!!")
            return

        self._closed = True

        del self.capsbar.buddy_callback
        del self.capsbar

        import hooks

        hooks.notify("digsby.overlay_icon_updated", self)

        from plugin_manager import plugin_hub

        plugin_hub.act("digsby.im.conversation.close.async", self.convo)

        self.unlink_observers()
        if self.convo is not None:
            self.unwatch_conversation(self.convo)
            try:
                self.convo.explicit_exit()
            except Exception:
                print_exc()
Example #14
0
    def check_for_updates(self, rpc, webview, id):
        if self._update_check_rpc_id is not None:
            return self.Derror(self.webview, id, message="checking")

        self._update_check_rpc_id = id
        log.info("Requesting update check from about dialog")
        hooks.notify('digsby.updater.check')
Example #15
0
    def OnOk(self, event):

        self.Show(False)

        import hooks
        hooks.notify('digsby.statistics.contact_added')
        proto = self.protocombo.Value.id
        name = self.namefield.Value
        group = self.groupcombo.Value if isinstance(
            self.groupcombo.Value,
            basestring) else self.groupcombo.Value.GetContentAsString()
        alias = self.aliasfield.Value
        accounts = self.accountchecks.theset

        import hub
        from common import profile
        meta = False
        x = None
        for account in accounts:
            with traceguard:
                account.connection.add_new_buddy(name, group, proto, alias)
                x = (name, account.connection.service)
                if x in profile.blist.metacontacts.buddies_to_metas:
                    meta = True

        if meta:
            id = list(profile.blist.metacontacts.buddies_to_metas[x])[0].id
            m = profile.blist.metacontacts[id]
            alias = m.alias
            group = list(m.groups)[0][-1]
            hub.get_instance().user_message(
                "That buddy is already part of metacontact \"" + alias +
                "\" in group \"" + group + "\"")

        self.Close()
Example #16
0
 def session_started_notify(self, s):
     '''
     whatever needs to be done after most setup and before the callback/state change happens.
     usually that will be plugins doing their own setup.
     allows notify to be overridden in subclass
     '''
     hooks.notify('digsby.jabber.session_started', self, s)
Example #17
0
    def download_error(self, error_files, success_files):
        log.error("Update incomplete. %d successful files, %d errored files",
                  len(success_files), len(error_files))
        for f in error_files:
            log.error("\t%r", f.path)

        self.cancel()
        hooks.notify('digsby.updater.update_failed')

        auto_download = common.pref("digsby.updater.auto_download",
                                    type=bool,
                                    default=True)

        if not auto_download:
            popup = gui.toast.popup(
                icon=gui.skin.get('serviceicons.digsby'),
                header=_("Update Failed"),
                minor=
                _("Digsby was unable to complete the download. This update will be attempted again later."
                  ),
                sticky=True,
                buttons=[(_("Manual Update"), lambda: wx.LaunchDefaultBrowser(
                    "http://install.digsby.com")),
                         (_("Close"), lambda: popup.cancel())],
                #                popupid = 'digsby.update',
            )
Example #18
0
    def notify_click(self):
        ppe = self.content['net_ppe']
        if ppe is not None:
            cents = int(ppe*100)
            hooks.notify('digsby.statistics.feed_ads.citygrid.click_cents', cents)

        hooks.notify('digsby.statistics.feed_ads.citygrid.click')
Example #19
0
    def set_blob(self, elem_name, data, force = False, callback = None):
        '''
        Decide to send a blob to the server, or not.
        Run caching routine before doing so.
        response goes to self.set_blob_success
        '''
        try:
            hooks.notify('digsby.identity.save_data', elem_name, data)
        except Exception:
            callback.error()
        else:
            callback.success()
        finally:
            return
        blob = name_to_obj[elem_name](data=data)

        stored = self.blobhashes.get(elem_name, sentinel)
        if stored is not sentinel:
            stored1 = stored[1]
        else:
            stored1 = sentinel

        if stored1 == self.calc_blob_hash(blob) and not force:
            log.info('set_blob %s: no change', elem_name)
            return callback.success()

        #cache here
        sending_stamp = blob.tstamp
        try:
            int(sending_stamp)
        except Exception, e:
            if stored is not sentinel:
                blob.tstamp = stored[0]
            else:
                blob.tstamp = 0
Example #20
0
    def _incoming_blob_notifications(self, newdata):
        def fix_underscore(d):
            for key in d.keys()[:]:
                if key and '_' in key:
                    d[key.replace('_', '.')] = d.pop(key)

        if not hasattr(self, 'notifications'):
            self.notifications = ObservableDict()
        else:
            fix_underscore(self.notifications)

        fix_underscore(newdata)

        self.notifications.update(newdata)
        import common.notifications

        # for any notification keys that exist in YAML, but not in the users
        # blob, add them with the values in the YAML 'default' key
        ni = common.notifications.get_notification_info()
        base = self.notifications[None]
        for k in ni:
            if k in base:
                continue

            try:
                defaults = ni[k].get('default', {})
                base[k] = [dict(reaction=v) for v in defaults.get('reaction', ())]
            except Exception:
                traceback.print_exc()
                continue

        import hooks
        hooks.notify('digsby.notifications.changed')
Example #21
0
    def on_state_change(self, src, attr, old, new):
        assert attr in ('state', None)

        hooks.notify('account.state', src, new)

        # Update "connected_accounts" list
        conn = [a for a in self.accounts + [self.profile] if a.connected]
        if self.connected_accounts != conn:
            self.connected_accounts[:] = conn

        if new != StateMixin.Statuses.OFFLINE:
            if src in self.cancellers:
                self.cancellers.pop(src).cancel()
            x = self.reconnect_timers.pop(src, None)

            if x is not None:
                x.stop()

        if new == StateMixin.Statuses.OFFLINE:
            self._on_account_offline(src)
            self._check_all_offline()

        if new == StateMixin.Statuses.ONLINE:
            src.error_count = 0

            # for IM accounts signing on, set their profile.
            if src in self.accounts:
                self.profile.set_formatted_profile(src.connection)
Example #22
0
    def check_for_updates(self, rpc, webview, id):
        if self._update_check_rpc_id is not None:
            return self.Derror(self.webview, id, message="checking")

        self._update_check_rpc_id = id
        log.info("Requesting update check from about dialog")
        hooks.notify('digsby.updater.check')
Example #23
0
    def on_close(self):
        if getattr(self, '_closed', False):
            log.warning(
                'FIXME: imwin_ctrl.on_close was called more than once!!!')
            return

        self._closed = True

        del self.capsbar.buddy_callback
        del self.capsbar

        import hooks
        hooks.notify('digsby.overlay_icon_updated', self)

        from plugin_manager import plugin_hub

        plugin_hub.act('digsby.im.conversation.close.async', self.convo)

        self.unlink_observers()
        if self.convo is not None:
            self.unwatch_conversation(self.convo)
            try:
                self.convo.explicit_exit()
            except Exception:
                print_exc()
Example #24
0
    def on_send_message_sms(self):
        'Invoked when enter is pressed in the message input box during SMS mode.'

        # Early exit if there is no message to send.
        if not self.input_area.Value: return

        to, frm = self.SMSControl.ToSMS, self.SMSControl.FromAccount
        if to is None:
            MessageBox(_('Please add an SMS number first.'),
                       _('Send SMS Message'))
        elif frm is None:
            MessageBox(
                _('You are not signed in to any accounts which can send SMS messages.'
                  ), _('Send SMS Message'))
        else:

            message = self.input_area.Value

            def on_success():
                self.show_message(
                    Message(buddy=frm.self_buddy,
                            message=message[:SMS_MAX_LENGTH],
                            conversation=self.convo,
                            type='outgoing'))
                self.ClearAndFocus()

            def on_error(errstr=None):
                if errstr is not None:
                    more = '\n' + _(
                        'The error message received was:') + '\n\t%s' % errstr
                else:
                    more = ''

                MessageBox(
                    _('There was an error in sending your SMS message.') +
                    more,
                    _('Send SMS Message Error'),
                    style=wx.ICON_ERROR)

            # Check the length--even though we limit the number of characters in SMS mode, the input box
            # may already have had too many characters.
            if len(message) > SMS_MAX_LENGTH:
                sms_line1 = _(
                    'Only the first {max_length:d} characters of your message can be sent over SMS:'
                ).format(max_length=SMS_MAX_LENGTH)
                sms_line2 = _('Do you want to send this message now?')

                if wx.NO == wx.MessageBox(u'%s\n\n"%s"\n\n%s' %
                                          (sms_line1, message, sms_line2),
                                          _('Send SMS - Character Limit'),
                                          style=wx.YES_NO):
                    return

            import hooks
            hooks.notify('digsby.statistics.sms.sent')
            frm.send_sms(to,
                         message[:SMS_MAX_LENGTH],
                         success=on_success,
                         error=on_error)
Example #25
0
def set_profile_status(msg):
    '''
    The combo calls this method by default when setting a new status.

    This can be changed in the constructor.
    '''
    import hooks; hooks.notify('digsby.statistics.ui.select_status')
    return profile.set_status(msg)
Example #26
0
    def onsave(diag):
        status = diag.StatusMessageFromInfo()
        if diag.SaveForLater:
            # only save if the checkbox is checked
            profile.add_status_message(status)

        import hooks; hooks.notify('digsby.statistics.ui.select_status')
        profile.set_status(status)
Example #27
0
    def notify_click(self):
        ppe = self.content['net_ppe']
        if ppe is not None:
            cents = int(ppe * 100)
            hooks.notify('digsby.statistics.feed_ads.citygrid.click_cents',
                         cents)

        hooks.notify('digsby.statistics.feed_ads.citygrid.click')
Example #28
0
 def add_account(self, protocol_name):
     with self.create_account_dialog(protocol_name) as diag:
         unusedres = diag.ShowModal()
         if diag.ReturnCode == wx.ID_SAVE:
             info = diag.info()
             common.profile.add_email_account(**info)
             import hooks
             hooks.notify('digsby.email.new_account', parent = self.Top, **info)
Example #29
0
 def _update_afters(self):
     with self.lock:
         old_afters = self.afters
         self.afters = dict((self.ids[i - 1], id)
                            for i, id in enumerate(self.ids)
                            if isfinishedad(id))
         if old_afters != self.afters:
             hooks.notify('social.feed.mark_dirty', self.context)
Example #30
0
 def later():
     try:
         p.ShowModal()
     except Exception:
         print_exc()
     else:
         hooks.notify('proxy.info_changed', util.GetProxyInfo())
     finally:
         p.Destroy()
Example #31
0
def set_profile_status(msg):
    '''
    The combo calls this method by default when setting a new status.

    This can be changed in the constructor.
    '''
    import hooks
    hooks.notify('digsby.statistics.ui.select_status')
    return profile.set_status(msg)
Example #32
0
 def later():
     try:
         p.ShowModal()
     except Exception:
         print_exc()
     else:
         hooks.notify('proxy.info_changed', util.GetProxyInfo())
     finally:
         p.Destroy()
Example #33
0
 def do_acct_math(*a, **k):
     has_accts = set(a.protocol for a in self.profile.all_accounts)
     if (has_accts
             & set(accttypes)):  #user has accounts we're targeting
         log.critical('sending message obj to hook')
         hooks.notify('digsby.server.announcement', messageobj)
     else:
         log.critical(
             'filtering conditional message for no accounts in common')
Example #34
0
    def resort(self, mock = False):
        assert on_thread('sorter').now

        rootgroups = [display_copy(g) for g in self.rootgroups if isinstance(g, GroupTypes)]
        self.personalities = self.track_personalities(rootgroups)

        metacontacts = self.safe_metacontacts(rootgroups)

        # Always collect metacontacts, but exit early here if sorting is paused.
        if self.sorting_paused:# or not profile.prefs_loaded:
            return

        metrics.event('Buddylist Sort')

        self._setup_blist_sorter()

        # invalidate all sorter knowledge of contacts.
        # results in more CPU usage, but until we put metacontact combining into the sorter
        # this might be necessary.
        self.new_sorter.removeAllContacts()

        newroots = rootgroups[:] + [metacontacts]
        for i, root in enumerate(newroots):
            root.name = "Root" + str(i)
            root._root = True
        root = DGroup('none', [], [], newroots)
        if mock: self.mock_root = make_mocklist(root)
        self.new_sorter.set_root(root)

        view = get_view_from_sorter(self.new_sorter)

        if getattr(self, '_search_by', ''):
            if len(view) > 0:
                contacts_group = view[0]

                # don't allow renaming, etc of the search "Contacts" group
                contacts_group._disallow_actions = True
                num_contacts = len(contacts_group)
            else:
                num_contacts = -1

            self._search_results = self._search_results[1], num_contacts
        else:
            if pref('buddylist.hide_offline_dependant', False, bool):
                hide_offline_groups = not pref('buddylist.show_offline') and pref('buddylist.hide_offline_groups')
            else:
                hide_offline_groups = pref('buddylist.hide_offline_groups')
            if hide_offline_groups:
                view[:] = filter((lambda g: not offline_nonempty_group_re.match(g.display_string)), view)

        for g in view: remove_duplicate_contacts(g)

        self.add_search_entries(view)

        hooks.notify('buddylist.sorted', view)

        return view
Example #35
0
    def OnClickInboxURL(self, e = None):
        import hooks; hooks.notify('digsby.statistics.email.inbox_opened')
        if self.mailclient:
            url = self.start_client_email()
            if url is None:
                return
        else:
            url = self.inbox_url

        launch_browser(self.inbox_url)
Example #36
0
 def finished(self):
     cb, self.callback = self.callback, None
     if self.errored_files:
         hooks.notify("digsby.updater.update_download_error", self.errored_files, self.downloaded_files)
         if cb is not None:
             cb.error(self.errored_files, self.downloaded_files)
     else:
         hooks.notify("digsby.updater.update_download_complete", self.downloaded_files)
         if cb is not None:
             cb.success(self.downloaded_files)
Example #37
0
    def SetStatusMessage(self, message, editable = True, edit_toggle = True, **k):
        new_status = StatusMessage(title = None,
                                   status = self.status.status,
                                   message = message,
                                   editable = editable,
                                   edit_toggle = edit_toggle)

        import hooks
        hooks.notify('digsby.statistics.ui.select_status')
        self.set_status(new_status)
Example #38
0
 def add_account(self, protocol_name):
     with self.create_account_dialog(protocol_name) as diag:
         unusedres = diag.ShowModal()
         if diag.ReturnCode == wx.ID_SAVE:
             info = diag.info()
             common.profile.add_email_account(**info)
             import hooks
             hooks.notify('digsby.email.new_account',
                          parent=self.Top,
                          **info)
Example #39
0
    def on_send_message_sms(self):
        "Invoked when enter is pressed in the message input box during SMS mode."

        # Early exit if there is no message to send.
        if not self.input_area.Value:
            return

        to, frm = self.SMSControl.ToSMS, self.SMSControl.FromAccount
        if to is None:
            MessageBox(_("Please add an SMS number first."), _("Send SMS Message"))
        elif frm is None:
            MessageBox(_("You are not signed in to any accounts which can send SMS messages."), _("Send SMS Message"))
        else:

            message = self.input_area.Value

            def on_success():
                self.show_message(
                    Message(
                        buddy=frm.self_buddy, message=message[:SMS_MAX_LENGTH], conversation=self.convo, type="outgoing"
                    )
                )
                self.ClearAndFocus()

            def on_error(errstr=None):
                if errstr is not None:
                    more = "\n" + _("The error message received was:") + "\n\t%s" % errstr
                else:
                    more = ""

                MessageBox(
                    _("There was an error in sending your SMS message.") + more,
                    _("Send SMS Message Error"),
                    style=wx.ICON_ERROR,
                )

            # Check the length--even though we limit the number of characters in SMS mode, the input box
            # may already have had too many characters.
            if len(message) > SMS_MAX_LENGTH:
                sms_line1 = _("Only the first {max_length:d} characters of your message can be sent over SMS:").format(
                    max_length=SMS_MAX_LENGTH
                )
                sms_line2 = _("Do you want to send this message now?")

                if wx.NO == wx.MessageBox(
                    u'%s\n\n"%s"\n\n%s' % (sms_line1, message, sms_line2),
                    _("Send SMS - Character Limit"),
                    style=wx.YES_NO,
                ):
                    return

            import hooks

            hooks.notify("digsby.statistics.sms.sent")
            frm.send_sms(to, message[:SMS_MAX_LENGTH], success=on_success, error=on_error)
Example #40
0
 def handle_comment_remove_resp(self, resp, comment_id, callback):
     if resp:
         for post_id, comments in self.last_stream['comments'].items():
             for i, comment in enumerate(comments):
                 if comment['id'] == comment_id:
                     c = comments.pop(i)
                     post = self.last_stream['post_ids'][post_id]
                     post['comments']['count'] -= 1
                     callback.success(post_id)
                     hooks.notify('digsby.facebook.comment_removed', c)
                     return
Example #41
0
 def handle_comment_remove_resp(self, resp, comment_id, callback):
     if resp:
         for post_id, comments in self.last_stream['comments'].items():
             for i, comment in enumerate(comments):
                 if comment['id'] == comment_id:
                     c = comments.pop(i)
                     post = self.last_stream['post_ids'][post_id]
                     post['comments']['count'] -= 1
                     callback.success(post_id)
                     hooks.notify('digsby.facebook.comment_removed', c)
                     return
Example #42
0
    def OnClickInboxURL(self, e=None):
        import hooks
        hooks.notify('digsby.statistics.email.inbox_opened')
        if self.mailclient:
            url = self.start_client_email()
            if url is None:
                return
        else:
            url = self.inbox_url

        launch_browser(self.inbox_url)
Example #43
0
        def success(*a):
            log.info('Email send success')
            # store history
            profile.blist.add_tofrom('email', to, frm)

            epanel.Clear()
            epanel.SetStatusMessage(_('Message Sent'))
            epanel.send_button.Enable(True)
            epanel.openin.Enable(True)

            import hooks
            hooks.notify('digsby.statistics.email.sent_from_imwindow')
Example #44
0
    def MakeOrShow(cls,group='', service = '', name = '', account = None):

        if not hasattr(cls,'current_instance'):
            cls.current_instance = None

        if cls.current_instance:
            cls.current_instance.Show(True)
            cls.current_instance.Raise()
        else:
            cls.current_instance = AddContactDialog(None, group, service, name, account)
            cls.current_instance.Show(True)

        import hooks; hooks.notify('digsby.statistics.ui.dialogs.add_contact.shown')
Example #45
0
        def ViewLogForFile(logpath, do_aliases=True):
            '''
            Update the log viewer with the file specified
            '''
            with viewer.Frozen():
                viewer.SetPageSource(logpath.text('utf-8', 'replace'), logpath.url())
                viewer.RunScript('window.scroll(0, 0);')

                if do_aliases:
                    substitue_aliases()

                import hooks
                hooks.notify('digsby.statistics.logviewer.log_viewed')
Example #46
0
        def success(*a):
            log.info("Email send success")
            # store history
            profile.blist.add_tofrom("email", to, frm)

            epanel.Clear()
            epanel.SetStatusMessage(_("Message Sent"))
            epanel.send_button.Enable(True)
            epanel.openin.Enable(True)

            import hooks

            hooks.notify("digsby.statistics.email.sent_from_imwindow")
Example #47
0
    def OnClickEmail(self, email):
        import hooks; hooks.notify('digsby.statistics.email.email_opened')
        if self.mailclient:
            self.start_client_email(email)
        else:
            url = self.urlForEmail(email)
            launch_browser(url)

        # For accounts where we are guaranteed to actually read the email
        # on click (i.e., ones that use webclients and have autologin on),
        # decrement the email count.
        if self.opening_email_marks_as_read:
            self._remove_email(email)
Example #48
0
 def handle_comment_resp(self, response, post_id, comment, callback):
     comment_id = response
     post = self.last_stream['post_ids'][post_id]
     post['comments']['count'] += 1
     import time
     comment_dict = S({'fromid': post['viewer_id'],
                     'id': comment_id,
                     'post_id': post_id,
                     'text': comment,
                     'time': time.time()})
     self.last_stream['comments'].setdefault(post_id, []).append(comment_dict)
     callback.success(post_id, comment_dict)
     hooks.notify('digsby.facebook.comment_added', comment_dict)
Example #49
0
def show(tabname='accounts'):
    '''
    Displays the Preferences dialog with the specified tab active.

    For tab names, see "prefstrings.py"
    '''

    if not isinstance(tabname, str):
        raise TypeError('prefsdialog.show takes a tab name')

    import hooks; hooks.notify('digsby.statistics.prefs.prefs_opened')

    tabindex = [c[0] for c in tabnames].index(tabname)
    return show_prefs_window(None, tabindex)
Example #50
0
    def OnClickEmail(self, email):
        import hooks
        hooks.notify('digsby.statistics.email.email_opened')
        if self.mailclient:
            self.start_client_email(email)
        else:
            url = self.urlForEmail(email)
            launch_browser(url)

        # For accounts where we are guaranteed to actually read the email
        # on click (i.e., ones that use webclients and have autologin on),
        # decrement the email count.
        if self.opening_email_marks_as_read:
            self._remove_email(email)
Example #51
0
 def save_local_info(self):
     'Writes our local account data to disk.'
     hooks.notify('digsby.identity.save_data', 'accounts', self.all_accounts)
     return
     if not SAVE_ACCOUNTS:
         return
     try:
         digsby.digsbylocal.save_local_info(
             self.profile.username, self.profile.password,
             self.all_accounts, self.order)
         log.info('serialized local accounts')
     except Exception:
         log.error('failed to serialize local accounts')
         traceback.print_exc()
Example #52
0
    def MakeOrShow(cls, group='', service='', name='', account=None):

        if not hasattr(cls, 'current_instance'):
            cls.current_instance = None

        if cls.current_instance:
            cls.current_instance.Show(True)
            cls.current_instance.Raise()
        else:
            cls.current_instance = AddContactDialog(None, group, service, name,
                                                    account)
            cls.current_instance.Show(True)

        import hooks
        hooks.notify('digsby.statistics.ui.dialogs.add_contact.shown')