Exemplo n.º 1
0
def search_for_buddy(metas, convo, sms):
    for win in ImWinPanel.all():
        with traceguard:
            c = win.Conversation

            # already talking to this buddy?
            if c is convo:
                LOG('direct conversation object match: win: %r, convo: %r', win, convo)
                return win

            # is this an SMS message?
            if validate_sms(convo.buddy.name):
                for num in win.SMS:
                    if validate_sms(num):
                        if smsize(num) == smsize(convo.buddy.name):
                            return win

            # chat messages will go only to windows with matching conversation objects.
            if convo.ischat != win.convo.ischat:
                continue

            # is there a window already open talking to another contact in this
            # contact's metacontact?
            winbud = win.Buddy
            if winbud is None:
                continue

            for meta in metas:
                for contact in meta:
                    if winbud == contact:
                        LOG('matched %r with %r', winbud, contact)
                        return win

                # a looser match--one that might not match "From:" but only "To:"
                for contact in meta:
                    if winbud.name == contact.name and winbud.protocol.name == contact.protocol.name:
                        LOG('loosely matched %r with %r', winbud, contact)
                        return win

            if winbud.info_key == convo.buddy.info_key:
                return win
Exemplo n.º 2
0
def im():
    from gui.imwin.imwin_gui import ImWinPanel
    for win in ImWinPanel.all():
        return win
Exemplo n.º 3
0
def im():
    from gui.imwin.imwin_gui import ImWinPanel
    for win in ImWinPanel.all():
        return win
Exemplo n.º 4
0
def on_status(status, on_done=None):
    for imwin in ImWinPanel.all():
        if imwin.Buddy == status.buddy:
            wx.CallAfter(imwin.show_status, status, on_done)
            break