예제 #1
0
파일: dc.py 프로젝트: gnu-user/dtella
    def handleCmd_ADDPEER(self, out, args, prefix):
        if len(args) == 1:
            try:
                ad = Ad().setTextIPPort(args[0])
            except ValueError:
                pass
            else:
                if not ad.port:
                    out("Port number must be nonzero.")
                    
                elif ad.auth('sx', self.main):
                    self.main.state.refreshPeer(ad, 0)
                    out("Added to peer cache: %s" % ad.getTextIPPort())

                    # Jump-start stuff if it's not already going
                    self.main.startConnecting()
                else:
                    out("The address '%s' is not permitted on this network."
                        % ad.getTextIPPort())
                return

        self.syntaxHelp(out, 'ADDPEER', prefix)
예제 #2
0
    def handleCmd_ADDPEER(self, out, args, prefix):

        if len(args) == 1:
            try:
                ad = Ad().setTextIPPort(args[0])
            except ValueError:
                pass
            else:
                if not ad.port:
                    out("Port number must be nonzero.")

                elif ad.auth('sx', self.main):
                    self.main.state.refreshPeer(ad, 0)
                    out("Added to peer cache: %s" % ad.getTextIPPort())

                    # Jump-start stuff if it's not already going
                    self.main.startConnecting()
                else:
                    out("The address '%s' is not permitted on this network." %
                        ad.getTextIPPort())
                return

        self.syntaxHelp(out, 'ADDPEER', prefix)
예제 #3
0
파일: dc.py 프로젝트: gnu-user/dtella
    def handleCmd_INVITE(self, out, args, prefix):     
        if len(args) == 0:
            osm = self.main.osm
            if osm:
                ad = Ad().setRawIPPort(osm.me.ipp)
                extra_msg = ""
            else:
                # If I don't know my own IP, at least fill in a dummy one.
                ad = Ad().setAddrTuple(("0.0.0.0", self.main.state.udp_port))
                extra_msg = " (replace 0.0.0.0 with your real IP address)"

            out("Tell your friend to enter the following into their client "
                "to join the network%s:" % extra_msg)
            out("")
            out("  !addpeer %s" % ad.getTextIPPort())
            out("")
            return
        
        self.syntaxHelp(out, 'INVITE', prefix)
예제 #4
0
    def handleCmd_INVITE(self, out, args, prefix):

        if len(args) == 0:
            osm = self.main.osm
            if osm:
                ad = Ad().setRawIPPort(osm.me.ipp)
                extra_msg = ""
            else:
                # If I don't know my own IP, at least fill in a dummy one.
                ad = Ad().setAddrTuple(("0.0.0.0", self.main.state.udp_port))
                extra_msg = " (replace 0.0.0.0 with your real IP address)"

            out("Tell your friend to enter the following into their client "
                "to join the network%s:" % extra_msg)
            out("")
            out("  !addpeer %s" % ad.getTextIPPort())
            out("")
            return

        self.syntaxHelp(out, 'INVITE', prefix)
예제 #5
0
파일: dc.py 프로젝트: LiPeK/dtella
 def pushSearchRequest(self, ipp, search_string):
     ad = Ad().setRawIPPort(ipp)
     self.sendLine("$Search %s %s" % (ad.getTextIPPort(), search_string))
예제 #6
0
 def pushSearchRequest(self, ipp, search_string):
     ad = Ad().setRawIPPort(ipp)
     self.sendLine("$Search %s %s" % (ad.getTextIPPort(), search_string))