Example #1
0
 def _onConnected(self, conn):
     assert conn in self.connecting
     self.connecting.remove(conn)
     self.connected.append(conn)
     self.ui.statusLabel.setText('Connected.')
     if self.pendingMessages:
         assert len(self.connected) == 1
         for msg in self.pendingMessages:
             conn.writeLine('msg %s' % wordEncode(msg))
         del self.pendingMessages[:]
Example #2
0
 def _onConnected( self, conn ) :
     assert conn in self.connecting
     self.connecting.remove( conn )
     self.connected.append( conn )
     self.ui.statusLabel.setText( 'Connected.' )
     if self.pendingMessages :
         assert len(self.connected) == 1
         for msg in self.pendingMessages :
             conn.writeLine( 'msg %s' % wordEncode(msg) )
         del self.pendingMessages[:]
Example #3
0
 def _onChatInputEnter(self):
     msg = unicode(self.ui.chatInputEdit.toPlainText()).encode('utf8')
     self.ui.chatInputEdit.clear()
     if msg.endswith('\n'): msg = msg[:-1]
     if msg.endswith('\r'): msg = msg[:-1]
     if not msg: return
     self._chatMessage(msg, env.user)
     self.lastSentTyping = False
     if not self.connected:
         self.pendingMessages.append(msg)
         self._onContactAction()
         return
     for conn in self.connected:
         conn.writeLine('msg %s' % wordEncode(msg))
Example #4
0
 def _onChatInputEnter( self ) :
     msg = unicode(self.ui.chatInputEdit.toPlainText()).encode('utf8')
     self.ui.chatInputEdit.clear()
     if msg.endswith('\n') : msg = msg[:-1]
     if msg.endswith('\r') : msg = msg[:-1]
     if not msg : return
     self._chatMessage( msg, env.user )
     self.lastSentTyping = False
     if not self.connected :
         self.pendingMessages.append( msg )
         self._onContactAction()
         return
     for conn in self.connected :
         conn.writeLine( 'msg %s' % wordEncode(msg) )
Example #5
0
 def _writeWords( self, words ) :
     words = [wordEncode(w) for w in words]
     self._writeData( ' '.join(words) + '\r\n' )