Beispiel #1
0
 def alert_active_users(self, usrName, addr):
     args = messageFormat.quickMess["ALERT_ONLINE"]
     args["data"] = usrName
     message = dMessage(**args).makePickle()
     for hash_ip, socket in self.known_conns.iteritems():
         if (hash(addr) != hash_ip):
             self.socket.sendall(message)
Beispiel #2
0
 def read_tel(self):
     while True:
         rfd, wfd, xfd = select.select([self.tel_connect], [], [])
         try:
             if self.tel_connect in rfd:
                 data = self.tel_connect.read_eager()
                 if data:
                     self.queue1.put(dMessage(0, "", 0, 0, 0, data))
         except EOFError:
             print("Something wrong w/ tellie receive " +
                   str(sys.exc_info()[0]) + "\n")
             break
 def manager(self):
     while self.manage:
         while (self.messQueue.empty()):
             pass
         dataM = self.messQueue.get()
         if (dataM.messageType == "gui_msg"):
             if (dataM.dataMsg == True):
                 args = messageFormat.quickMess["DATA_MSG"]
                 args["data"] = dataM.data["data"]
                 args["target"] = dataM.data["target"]
                 self.client.sendMsg(dMessage(**args).makePickle())
             elif (dataM.quit == True):
                 args = messageFormat.quickMess["END_CONN"]
                 self.client.sendMsg(dMessage(**args).makePickle())
                 self.client.endConnection()
                 self.manage = False
             elif (dataM.telnet == True):
                 self.client.tellie(dataM.data)
             elif (dataM.cmd == True):
                 self.client.cmd_tel(dataM.data)
         else:
             self.GUIdataqueue.put(dataM)
Beispiel #4
0
 def connect(self, address):
     pwd = os.getenv("pwd")
     e_pwd = self.encrypt_pwd(pwd)
     self.sock.connect((address, 9000))
     data = "{uname} {pwd} {token}".format(uname=os.getenv("username"),
                                           pwd=e_pwd.decode('utf-8'),
                                           token=os.getenv("token"))
     self.sock.sendall(dMessage(1, None, 0, 0, 0, data).makePickle())
     data = self.sock.recv(4096)
     print("Begin Chatting...")
     self.recv_bool = True
     rThread = threading.Thread(target=self.recvMsg)
     rThread.daemon = True
     rThread.start()
Beispiel #5
0
 def send_names_list(self, sock):
     args = messageFormat.quickMess["FRIENDS_LIST"]
     args["data"] = get_all_names()
     message = dMessage(**args).makePickle()
     sock.sendall(message)
     sock.close()
Beispiel #6
0
 def send_end_conn(self, sock, text):
     args = messageFormat.quickMess["END_CONN"]
     args["data"] = text
     message = dMessage(**args).makePickle()
     sock.sendall(message)
     sock.close()