def _imc_login(self, line): """ Connect and identify to imc network as per the `self.auth_type` setting. Args: line (str): Incoming text. """ if self.auth_type == "plaintext": # Only support Plain text passwords. # SERVER Sends: PW <servername> <serverpw> version=<version#> <networkname> logger.log_infomsg("IMC2: AUTH< %s" % line) line_split = line.split(' ') pw_present = line_split[0] == 'PW' autosetup_present = line_split[0] == 'autosetup' if "reject" in line_split: auth_message = _("IMC2 server rejected connection.") logger.log_infomsg(auth_message) return if pw_present: self.server_name = line_split[1] self.network_name = line_split[4] elif autosetup_present: logger.log_infomsg(_("IMC2: Autosetup response found.")) self.server_name = line_split[1] self.network_name = line_split[3] self.is_authenticated = True self.sequence = int(time()) # Log to stdout and notify over MUDInfo. logger.log_infomsg('IMC2: Authenticated to %s' % self.factory.network) # Ask to see what other MUDs are connected. self._send_packet(pck.IMC2PacketKeepAliveRequest()) # IMC2 protocol states that KeepAliveRequests should be followed # up by the requester sending an IsAlive packet. self._send_packet(pck.IMC2PacketIsAlive()) # Get a listing of channels. self._send_packet(pck.IMC2PacketIceRefresh())
def _channellist(self): "Sync the network channel list." checked_networks = [] if not self.network in checked_networks: self._send_packet(pck.IMC2PacketIceRefresh()) checked_networks.append(self.network)