def validate_destination(usr,chat_no): login_id=usr.get_mobile_no() if(str(login_id)==str(chat_no)): raise DestNoSameException() msg=check_destination(chat_no) if(msg.get_destinaton()==None): raise DestinationNotFoundException()
def new_chat(usr,chat_no=''): try: while(1): print("\n") print(" New Chat ") print("-----------------------------") print("\n") if(chat_no==''): chat_no=raw_input("Mobile Number") validate_destination.validate_destination(usr, chat_no) print_messages.print_messages(usr, str(chat_no)) update_msg_status.update_msg_status(usr, chat_no) msg=checkdestination.check_destination(chat_no) print("Chat with ",msg.get_dis_name()) msg=raw_input("Message (#Exit to exit) : ") if(msg.upper()=='#EXIT'): break check_mesglength.check_msglength(msg) insert_msg.insert_msg(str(usr.get_mobile_no()),str(chat_no), msg) print("Message Sent.") except DestNoSameException as e: print(e) except DestinationNotFoundException as e: print(e) except MsgLengthException as e: print(e)