def acceptSessionRequest(self, username, host, port): self.logger.debug('accepted session request from %s at %s:%d)' % (username, host, port)) status_bar.status_message('accepted session request from %s, trying to connect to %s:%d' % (username, host, port)) self.logger.info('Establishing session with %s at %s:%d' % (username, host, port)) session = basic.BasicPeer(username, self) session.clientConnect(host, port) registry.registerSession(session)
def negotiateSession(self, username): """ Negotiate through the instant messaging layer a direct peer-to-peer connection with the user that has the given username. Note the username in question must represent another SubliminalCollaborator Negotiator instance used by another user. If the user identified by the given username is not in the C{Array} returned by listUsers(), the expectation is that successful execution of this function will result in the given username being added to the list of known users. """ if (not username in self.peerUsers) and (not username in self.unverifiedUsers): self.addUserToLists(username) if self.hostAddressToTryQueue == None or len( self.hostAddressToTryQueue) == 0: self.hostAddressToTryQueue = socket.gethostbyname_ex( socket.gethostname())[2] ipaddress = self.hostAddressToTryQueue.pop() session = basic.BasicPeer(username, self) port = session.hostConnect() self.logger.debug('attempting to start session with %s at %s:%d' % (username, ipaddress, port)) status_bar.status_message('trying to share with %s@%s' % (username, ipaddress)) self.pendingSession = session registry.registerSession(session) self.ctcpMakeQuery( username, [('DCC CHAT', '%s %s %d' % (base.DCC_PROTOCOL_COLLABORATE, ipaddress, port))])
def acceptSessionRequest(self, username, host, port): self.logger.debug('accepted session request from %s at %s:%d)' % (username, host, port)) status_bar.status_message( 'accepted session request from %s, trying to connect to %s:%d' % (username, host, port)) self.logger.info('Establishing session with %s at %s:%d' % (username, host, port)) session = basic.BasicPeer(username, self) session.clientConnect(host, port) registry.registerSession(session)
def negotiateSession(self, username): """ Negotiate through the instant messaging layer a direct peer-to-peer connection with the user that has the given username. Note the username in question must represent another SubliminalCollaborator Negotiator instance used by another user. If the user identified by the given username is not in the C{Array} returned by listUsers(), the expectation is that successful execution of this function will result in the given username being added to the list of known users. """ if (not username in self.peerUsers) and (not username in self.unverifiedUsers): self.addUserToLists(username) if self.hostAddressToTryQueue == None or len(self.hostAddressToTryQueue) == 0: self.hostAddressToTryQueue = socket.gethostbyname_ex(socket.gethostname())[2] ipaddress = self.hostAddressToTryQueue.pop() session = basic.BasicPeer(username, self) port = session.hostConnect() self.logger.debug('attempting to start session with %s at %s:%d' % (username, ipaddress, port)) status_bar.status_message('trying to share with %s@%s' % (username, ipaddress)) self.pendingSession = session registry.registerSession(session) self.ctcpMakeQuery(username, [('DCC CHAT', '%s %s %d' % (base.DCC_PROTOCOL_COLLABORATE, ipaddress, port))])