Ejemplo n.º 1
0
    def btnActSnd(self, event):
        cmd = acc.CommandCall(self.as400)
        #curUsr = self.as400.getUserId()
        selected = self.users.getSelectedItem()
        sndUsr =selected.split(':')[0]
        chatTxt = self.chatTxt.getText()
        dq = acc.KeyedDataQueue(self.as400, CHATQ)
        if not dq.exists():
            dq.create(KEYLEN, 512)
        try:
            if not sndUsr == "ALL TRASH":
            	dq.write(sndUsr, "%s:%s"%(curUsr, chatTxt) )
            if not curUsr == sndUsr:
                self.rpyTxt.append("%s -->> %s\n%s\n"%(curUsr, sndUsr, chatTxt))
                self.rpyTxt.setCaretPosition( len(self.rpyTxt.getText()) )
            if not sndUsr == "ALL TRASH":
				self.statusTxt.text='Message Sended.'
            else:
                self.rpyTxt.append("MESSAGE IS SENDED TO TRASHCAN !!!")
                self.rpyTxt.append("\nALWAYS PAY ATTENTION WHO YOU'RE SENDING TO !!!!\n")
                self.rpyTxt.setCaretPosition( len(self.rpyTxt.getText()) )
                self.statusTxt.text='Message sended to trashcan - Pay Attention Please !'
            self.chatTxt.selectAll()
            self.chatTxt.cut()
        except:
            self.statusTxt.text='Message send Failed - Contact your system-operator.'
        self.chatTxt.requestFocus()
Ejemplo n.º 2
0
 def windowOpened(self, event):
     keys = self.jobDct.keys()
     keys.sort()
     dq = acc.KeyedDataQueue(self.as400, CHATQ)
     for key_usr in keys:
         user = key_usr
         if not dq.exists():
             dq.create(KEYLEN, 512)
         try:
             dq.write(user, "%s:%s"%(curUsr, 'Logged and ready'))
         except:
             None
Ejemplo n.º 3
0
    def run(self):
        done = 0
        dq = acc.KeyedDataQueue(self.parent.as400, CHATQ)
        #curUsr = self.parent.as400.getUserId() # Current User ID.
        if not dq.exists():
            dq.create(KEYLEN, 512)

        while not done:
            try:
                entry = dq.read(curUsr, -1, "EQ")
                mail = entry.getString()
                sndUsr = mail.split(':')[0]
                if not self.parent.jobDct.has_key(sndUsr):
                    self.parent.rtvIntJobs()
                # Split only once do avoid problems text containing more :'s
                msg = mail.split(':', 1)[1]
                if msg == 'Logged and ready':
                    continue
                elif msg == 'Logged Out':
                    # wait for refreshing and give the sessions some time to close.
                    time.sleep(5)
                    self.parent.rtvIntJobs()
                    continue
                self.parent.rpyTxt.append("--== Received from " + sndUsr \
                + " ==--\n" + msg + "\n")
                self.parent.rpyTxt.setCaretPosition(
                    len(self.parent.rpyTxt.getText()))
            except:
                done = 1
                exc = sys.exc_info()
                print "Thread interrupted at line ", exc[2].tb_lineno
                print exc[0]
                print "type = %s" % type(exc[0])
                self.statusTxt.text = 'There was an error, contact the System-Administrator'
            if self.parent.chkActive.isSelected():
                item = sndUsr + ': ' + self.parent.usrDct[sndUsr]
            else:
                if self.parent.jobDct.has_key(sndUsr):
                    item = sndUsr + ': ' + self.parent.usrDct[sndUsr] + ' *'
                else:
                    item = sndUsr + ': ' + self.parent.usrDct[sndUsr]
            try:
                self.parent.users.setSelectedItem(item)
            except:
                None
            if self.parent.getState() == swing.JFrame.ICONIFIED:
                self.parent.state = (swing.JFrame.NORMAL)
            self.parent.chatTxt.requestFocus()
            self.parent.show()
Ejemplo n.º 4
0
 def windowClosing(self, event):
     System.setProperty("chat400", "None")
     keys = self.jobDct.keys()
     keys.sort()
     dq = acc.KeyedDataQueue(self.as400, CHATQ)
     for key_usr in keys:
         user = key_usr
         if user ==  curUsr:
             continue
         if not dq.exists():
             dq.create(KEYLEN, 512)
         try:
             dq.write(user, "%s:%s"%(curUsr, 'Logged Out'))
         except:
             None
     self.sessionManager = _session.getSessionManager()
     self.sessions = self.sessionManager.getSessions()
     self.sessList = self.sessions.getSessionsList()
     for x in self.sessList:
         self.sessionManager.closeSession(x)