Logo Search packages:      
Sourcecode: scenic version File versions  Download package

def scenic::application::Application::send_invite (   self )
Does the flight check. If OK, send an INVITE.

Definition at line 1070 of file application.py.

        Does the flight check. If OK, send an INVITE.
        self._is_negotiating = True
        contact = self.address_book.get_currently_selected_contact()
        if contact is None:
            dialogs.ErrorDialog.create(_("You must select a contact to invite."), parent=self.gui.main_window)
            return  # important
            ip = contact["address"]
        def _check_cb(result):
            #TODO: use the Deferred it will return
            if result is True:
                msg = {
                    "protocol": self.protocol_version,
                    "please_send_to_port": self.config.negotiation_port, # FIXME: rename to listening_port
                port = self.config.negotiation_port
                def _on_connected(proto):
                    return proto

                def _on_error(reason):
                    #FIXME: do we need this error dialog?
                    exc_type = type(reason.value)
                    if exc_type is error.ConnectionRefusedError:
                        msg = _("Could not invite contact %(name)s. \n\nScenic is not listening on port %(port)d of host %(ip)s.") % {"ip": ip, "name": contact["name"], "port": port}
                    elif exc_type is error.ConnectError:
                        msg = _("Could not invite contact %(name)s. \n\nHost %(ip)s is unreachable.") % {"ip": ip, "name": contact["name"]}
                    elif exc_type is error.NoRouteError:
                        msg = _("Could not invite contact %(name)s. \n\nHost %(ip)s is unreachable.") % {"ip": ip, "name": contact["name"]}
                        msg = _("Could not invite contact %(name)s. \n\nError trying to connect to %(ip)s:%(port)s:\n %(reason)s") % {"ip": ip, "name": contact["name"], "port": port, "reason": reason.value}
                    log.error(msg.replace("\n", " "))
                    #if self._is_negotiating: # ???
                    #    log.debug("Not showing an error since we were not negotiating.")
                    self._is_negotiating = False
                    return None
                log.debug("sending %s to %s:%s" % (msg, ip, port))
                deferred = self.client.connect(ip, port)
                # window will be hidden when we receive ACCEPT or REFUSE, or when we cancel
                log.error("Cannot send INVITE. Reason is : %s" % (result))
                self._is_negotiating = False

        check_deferred = self.check_if_ready_to_stream(role="offerer")

Generated by  Doxygen 1.6.0   Back to index