6a524af1f12c — cedricbonhomme 11 years ago
Some improvements about the authentication process.
2 files changed, 9 insertions(+), 6 deletions(-)

A source/configurations/clients_informations.xml
M source/simpleGui.py
A source/configurations/clients_informations.xml +1 -0
@@ 0,0 1,1 @@ 
+<?xml version="1.0" ?><clients><client><name>bob</name><password>5ed25af7b1ed23fb00122e13d7f74c4d8262acd8</password><ontology>ontoBOB1</ontology><pubkey>26132083131104328772915520935906375741258270791954907144762536711849699668443-39405459139698945953820799021932797301078095534722266488704157617712445066389</pubkey></client><client><name>alice</name><password>92ef57ba40706594b46425705e989cbc256d9724</password><ontology>ChatTout</ontology><pubkey>54454921728377717257547813832479245729136087241850165130075873362087690308127-65531769888088421015639757020470536864719945014583667952974249971550025211857</pubkey></client></clients>
  No newline at end of file

          
M source/simpleGui.py +8 -6
@@ 242,7 242,7 @@ class SimpleGui(object):
         msg.title('Connection to the SPADE platform')
         msg.resizable(height = False, width = False)
 
-        Label(msg, text='Username : ').grid(row = 0, column = 0, sticky = W)
+        Label(msg, text='Your username : ').grid(row = 0, column = 0, sticky = W)
         username_entry = Entry(msg)
         username_entry.grid(row = 0, column = 1, pady = 2, sticky = W)
         username_entry.insert(0, self.agent_name.lower())

          
@@ 486,8 486,7 @@ class SimpleGui(object):
         """
         client = None
         try:
-            client = self.listbox.get(int(self.listbox.curselection()[0])) \
-                    .split(' ')[0].lower()
+            client = self.listbox.get(int(self.listbox.curselection()[0]))
         except IndexError:
             pass
         if client is not None:

          
@@ 504,8 503,7 @@ class SimpleGui(object):
         """
         if client is None:
             try:
-                client = self.listbox.get(int(self.listbox.curselection()[0])) \
-                        .split(' ')[0].lower()
+                client = self.listbox.get(int(self.listbox.curselection()[0]))
             except IndexError:
                 pass
         if client not in self.client_agent.receiver.keys():

          
@@ 574,8 572,12 @@ class SimpleGui(object):
         message = str(self.message_to_send.get(0.0, END).encode('utf-8'))
         self.message_to_send.delete(1.0, END)
 
+        if self.client_agent is None:
+            self.show_info('You are not connected to the SPADE platform.')
+            return
+
         if len(message) <= 1:
-            self.show_info('Enter a message')
+            self.show_info('Enter a message.')
             return
 
         if len(self.client_agent.receiver) == 0: