all incomming stanza are printed in xml console

need much more work (out going stanza ...)
This commit is contained in:
Yann Leboulanger 2005-08-04 20:32:38 +00:00
parent fa5ddbe498
commit 899396bc90
3 changed files with 14 additions and 1 deletions

View File

@ -126,7 +126,8 @@ class Connection:
'ACC_OK': [], 'MYVCARD': [], 'OS_INFO': [], 'VCARD': [], 'GC_MSG': [], 'ACC_OK': [], 'MYVCARD': [], 'OS_INFO': [], 'VCARD': [], 'GC_MSG': [],
'GC_SUBJECT': [], 'GC_CONFIG': [], 'BAD_PASSPHRASE': [], 'GC_SUBJECT': [], 'GC_CONFIG': [], 'BAD_PASSPHRASE': [],
'ROSTER_INFO': [], 'ERROR_ANSWER': [], 'BOOKMARKS': [], 'CON_TYPE': [], 'ROSTER_INFO': [], 'ERROR_ANSWER': [], 'BOOKMARKS': [], 'CON_TYPE': [],
'FILE_REQUEST': [], 'FILE_RCV_COMPLETED': [], 'FILE_PROGRESS': [] 'FILE_REQUEST': [], 'FILE_RCV_COMPLETED': [], 'FILE_PROGRESS': [],
'STANZA_ARRIVED': []
} }
self.name = name self.name = name
self.connected = 0 # offline self.connected = 0 # offline
@ -868,6 +869,7 @@ class Connection:
self.dispatch('ERROR_ANSWER', (id, jid_from, errmsg, errcode)) self.dispatch('ERROR_ANSWER', (id, jid_from, errmsg, errcode))
def _StanzaArrivedCB(self, con, obj): def _StanzaArrivedCB(self, con, obj):
self.dispatch('STANZA_ARRIVED', str(obj))
self.last_incoming = time.time() self.last_incoming = time.time()
self.keep_alive_sent = False self.keep_alive_sent = False

View File

@ -1357,6 +1357,11 @@ class XMLConsoleWindow:
self.xml.signal_autoconnect(self) self.xml.signal_autoconnect(self)
self.window.show_all() self.window.show_all()
def print_incomming_stanza(self, stanza):
buffer = self.stanzas_log_textview.get_buffer()
end_iter = buffer.get_end_iter()
buffer.insert(end_iter, stanza)
def on_send_button_clicked(self, widget): def on_send_button_clicked(self, widget):
begin_iter, end_iter = self.input_tv_buffer.get_bounds() begin_iter, end_iter = self.input_tv_buffer.get_bounds()
stanza = self.input_tv_buffer.get_text(begin_iter, end_iter) stanza = self.input_tv_buffer.get_text(begin_iter, end_iter)

View File

@ -760,6 +760,11 @@ class Interface:
instance = dialogs.PopupNotificationWindow(self, event_type, instance = dialogs.PopupNotificationWindow(self, event_type,
jid, account, msg_type, file_props) jid, account, msg_type, file_props)
self.roster.popup_notification_windows.append(instance) self.roster.popup_notification_windows.append(instance)
def handle_event_stanza_arrived(self, account, stanza):
if self.windows[account].has_key('xml_console'):
self.windows[account]['xml_console'].print_incomming_stanza(stanza)
def read_sleepy(self): def read_sleepy(self):
'''Check idle status and change that status if needed''' '''Check idle status and change that status if needed'''
if not self.sleeper.poll(): if not self.sleeper.poll():
@ -926,6 +931,7 @@ class Interface:
con.register_handler('BOOKMARKS', self.handle_event_bookmarks) con.register_handler('BOOKMARKS', self.handle_event_bookmarks)
con.register_handler('CON_TYPE', self.handle_event_con_type) con.register_handler('CON_TYPE', self.handle_event_con_type)
con.register_handler('FILE_REQUEST', self.handle_event_file_request) con.register_handler('FILE_REQUEST', self.handle_event_file_request)
con.register_handler('STANZA_ARRIVED', self.handle_event_stanza_arrived)
def process_connections(self): def process_connections(self):
try: try: