we can now receive normal and chat messages with subject and handle them ok. we can also reply to received normal message with RE: previous message and all the good stuff! hoooray!
This commit is contained in:
parent
fd03253594
commit
94c01aeecc
|
@ -831,7 +831,7 @@ class Chat:
|
||||||
|
|
||||||
def print_conversation_line(self, text, jid, kind, name, tim,
|
def print_conversation_line(self, text, jid, kind, name, tim,
|
||||||
other_tags_for_name = [], other_tags_for_time = [],
|
other_tags_for_name = [], other_tags_for_time = [],
|
||||||
other_tags_for_text = [], count_as_new = True):
|
other_tags_for_text = [], count_as_new = True, subject = None):
|
||||||
textview = self.xmls[jid].get_widget('conversation_textview')
|
textview = self.xmls[jid].get_widget('conversation_textview')
|
||||||
buffer = textview.get_buffer()
|
buffer = textview.get_buffer()
|
||||||
buffer.begin_user_action()
|
buffer.begin_user_action()
|
||||||
|
@ -890,6 +890,11 @@ class Chat:
|
||||||
end_iter = buffer.get_end_iter()
|
end_iter = buffer.get_end_iter()
|
||||||
buffer.insert_with_tags_by_name(end_iter, text[index:], *text_tags)
|
buffer.insert_with_tags_by_name(end_iter, text[index:], *text_tags)
|
||||||
|
|
||||||
|
if subject: # if we have subject, send it too!
|
||||||
|
subject = '\n' + _('Subject: %s') % subject
|
||||||
|
end_iter = buffer.get_end_iter()
|
||||||
|
buffer.insert_with_tags_by_name(end_iter, subject, *text_tags)
|
||||||
|
|
||||||
#scroll to the end of the textview
|
#scroll to the end of the textview
|
||||||
end = False
|
end = False
|
||||||
if at_the_end or kind == 'outgoing':
|
if at_the_end or kind == 'outgoing':
|
||||||
|
|
|
@ -212,6 +212,7 @@ class Connection:
|
||||||
"""Called when we receive a message"""
|
"""Called when we receive a message"""
|
||||||
msgtxt = msg.getBody()
|
msgtxt = msg.getBody()
|
||||||
mtype = msg.getType()
|
mtype = msg.getType()
|
||||||
|
subject = msg.getSubject() # if note there it's None
|
||||||
tim = msg.getTimestamp()
|
tim = msg.getTimestamp()
|
||||||
tim = time.strptime(tim, '%Y%m%dT%H:%M:%S')
|
tim = time.strptime(tim, '%Y%m%dT%H:%M:%S')
|
||||||
tim = time.localtime(timegm(tim))
|
tim = time.localtime(timegm(tim))
|
||||||
|
@ -237,7 +238,6 @@ class Connection:
|
||||||
self.dispatch('MSGERROR', (str(msg.getFrom()),
|
self.dispatch('MSGERROR', (str(msg.getFrom()),
|
||||||
msg.getErrorCode(), msg.getError(), msgtxt, tim))
|
msg.getErrorCode(), msg.getError(), msgtxt, tim))
|
||||||
elif mtype == 'groupchat':
|
elif mtype == 'groupchat':
|
||||||
subject = msg.getSubject()
|
|
||||||
if subject:
|
if subject:
|
||||||
self.dispatch('GC_SUBJECT', (str(msg.getFrom()), subject))
|
self.dispatch('GC_SUBJECT', (str(msg.getFrom()), subject))
|
||||||
else:
|
else:
|
||||||
|
@ -245,11 +245,24 @@ class Connection:
|
||||||
return
|
return
|
||||||
self.dispatch('GC_MSG', (str(msg.getFrom()), msgtxt, tim))
|
self.dispatch('GC_MSG', (str(msg.getFrom()), msgtxt, tim))
|
||||||
gajim.logger.write('gc', msgtxt, str(msg.getFrom()), tim = tim)
|
gajim.logger.write('gc', msgtxt, str(msg.getFrom()), tim = tim)
|
||||||
else:
|
elif mtype == 'normal': # it's single message
|
||||||
|
log_msgtxt = msgtxt
|
||||||
|
if subject:
|
||||||
|
log_msgtxt = _('Subject: %s\n%s') % (subject, msgtxt)
|
||||||
|
gajim.logger.write('incoming', log_msgtxt, str(msg.getFrom()),
|
||||||
|
tim = tim)
|
||||||
|
self.dispatch('MSG', (str(msg.getFrom()), msgtxt, tim, encrypted,
|
||||||
|
mtype, subject))
|
||||||
|
else: # it's type 'chat'
|
||||||
if not msg.getTag('body'): #no <body>
|
if not msg.getTag('body'): #no <body>
|
||||||
return
|
return
|
||||||
gajim.logger.write('incoming', msgtxt, str(msg.getFrom()), tim = tim)
|
log_msgtxt = msgtxt
|
||||||
self.dispatch('MSG', (str(msg.getFrom()), msgtxt, tim, encrypted))
|
if subject:
|
||||||
|
log_msgtxt = _('Subject: %s\n%s') % (subject, msgtxt)
|
||||||
|
gajim.logger.write('incoming', log_msgtxt, str(msg.getFrom()),
|
||||||
|
tim = tim)
|
||||||
|
self.dispatch('MSG', (str(msg.getFrom()), msgtxt, tim, encrypted,
|
||||||
|
mtype, subject))
|
||||||
# END messageCB
|
# END messageCB
|
||||||
|
|
||||||
def _presenceCB(self, con, prs):
|
def _presenceCB(self, con, prs):
|
||||||
|
|
|
@ -797,37 +797,92 @@ class PopupNotificationWindow:
|
||||||
self.adjust_height_and_move_popup_notification_windows()
|
self.adjust_height_and_move_popup_notification_windows()
|
||||||
|
|
||||||
|
|
||||||
class SendSingleMessageDialog:
|
class SingleMessageWindow:
|
||||||
def __init__(self, plugin, account, contact):
|
'''SingleMessageWindow can send or show a received
|
||||||
|
singled message depending on action argument'''
|
||||||
|
def __init__(self, plugin, account, contact, action='', from_whom='',\
|
||||||
|
subject='', message=''):
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
self.account = account
|
self.account = account
|
||||||
|
self.contact = contact
|
||||||
|
self.action = action
|
||||||
|
|
||||||
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'send_single_message_window', APP)
|
self.subject = subject
|
||||||
self.window = self.xml.get_widget('send_single_message_window')
|
self.message = message
|
||||||
|
|
||||||
|
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'single_message_window', APP)
|
||||||
|
self.window = self.xml.get_widget('single_message_window')
|
||||||
self.count_chars_label = self.xml.get_widget('count_chars_label')
|
self.count_chars_label = self.xml.get_widget('count_chars_label')
|
||||||
|
self.from_label = self.xml.get_widget('from_label')
|
||||||
|
self.from_entry = self.xml.get_widget('from_entry')
|
||||||
|
self.to_label = self.xml.get_widget('to_label')
|
||||||
self.to_entry = self.xml.get_widget('to_entry')
|
self.to_entry = self.xml.get_widget('to_entry')
|
||||||
self.subject_entry = self.xml.get_widget('subject_entry')
|
self.subject_entry = self.xml.get_widget('subject_entry')
|
||||||
self.message_tv_buffer = self.xml.get_widget('message_textview').\
|
self.message_textview = self.xml.get_widget('message_textview')
|
||||||
get_buffer()
|
self.message_tv_buffer = self.message_textview.get_buffer()
|
||||||
|
self.send_button = self.xml.get_widget('send_button')
|
||||||
|
self.reply_button = self.xml.get_widget('reply_button')
|
||||||
self.message_tv_buffer.connect('changed', self.update_char_counter)
|
self.message_tv_buffer.connect('changed', self.update_char_counter)
|
||||||
|
|
||||||
self.to_entry.set_text(contact.jid)
|
self.to_entry.set_text(self.contact.jid)
|
||||||
|
|
||||||
our_jid = gajim.config.get_per('accounts', self.account, 'name') + '@' + \
|
self.send_button.set_no_show_all(True)
|
||||||
gajim.config.get_per('accounts', self.account, 'hostname')
|
self.reply_button.set_no_show_all(True)
|
||||||
|
self.to_label.set_no_show_all(True)
|
||||||
|
self.to_entry.set_no_show_all(True)
|
||||||
|
self.from_label.set_no_show_all(True)
|
||||||
|
self.from_entry.set_no_show_all(True)
|
||||||
|
|
||||||
if len(gajim.connections) > 1:
|
self.prepare_widgets_for(self.action)
|
||||||
title = _('Send Single Message as %s') % our_jid
|
|
||||||
else:
|
|
||||||
title = _('Send Single Message')
|
|
||||||
self.window.set_title(title)
|
|
||||||
|
|
||||||
|
if self.action == 'send':
|
||||||
|
if self.message: # we come from a reply?
|
||||||
|
self.message_textview.grab_focus()
|
||||||
|
else: # we write a new message
|
||||||
self.subject_entry.grab_focus()
|
self.subject_entry.grab_focus()
|
||||||
|
elif self.action == 'receive':
|
||||||
|
self.from_whom = from_whom
|
||||||
|
self.from_entry.set_text(self.from_whom)
|
||||||
|
self.from_entry.set_property('editable', False)
|
||||||
|
self.subject_entry.set_property('editable', False)
|
||||||
|
self.message_textview.set_editable(False)
|
||||||
|
self.reply_button.grab_focus()
|
||||||
|
|
||||||
|
self.subject_entry.set_text(self.subject)
|
||||||
|
self.message_tv_buffer.set_text(self.message)
|
||||||
|
begin_iter = self.message_tv_buffer.get_start_iter()
|
||||||
|
self.message_tv_buffer.place_cursor(begin_iter)
|
||||||
|
|
||||||
self.xml.signal_autoconnect(self)
|
self.xml.signal_autoconnect(self)
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
|
|
||||||
|
def prepare_widgets_for(self, action):
|
||||||
|
our_jid = gajim.config.get_per('accounts', self.account, 'name') + '@' + \
|
||||||
|
gajim.config.get_per('accounts', self.account, 'hostname')
|
||||||
|
if len(gajim.connections) > 1:
|
||||||
|
title = _('Single Message as %s') % our_jid
|
||||||
|
else:
|
||||||
|
title = _('Single Message')
|
||||||
|
|
||||||
|
if action == 'send':
|
||||||
|
title = _('Send %s') % title
|
||||||
|
self.send_button.show()
|
||||||
|
self.to_label.show()
|
||||||
|
self.to_entry.show()
|
||||||
|
self.reply_button.hide()
|
||||||
|
self.from_label.hide()
|
||||||
|
self.from_entry.hide()
|
||||||
|
elif action == 'receive':
|
||||||
|
title = _('%s Received') % title
|
||||||
|
self.reply_button.show()
|
||||||
|
self.from_label.show()
|
||||||
|
self.from_entry.show()
|
||||||
|
self.send_button.hide()
|
||||||
|
self.to_label.hide()
|
||||||
|
self.to_entry.hide()
|
||||||
|
|
||||||
|
self.window.set_title(title)
|
||||||
|
|
||||||
def on_cancel_button_clicked(self, widget):
|
def on_cancel_button_clicked(self, widget):
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
|
@ -851,6 +906,14 @@ class SendSingleMessageDialog:
|
||||||
|
|
||||||
self.message_tv_buffer.set_text('') # we sent ok, clear the textview
|
self.message_tv_buffer.set_text('') # we sent ok, clear the textview
|
||||||
|
|
||||||
|
def on_reply_button_clicked(self, widget):
|
||||||
|
# we create a new blank window to send and we preset RE: and to jid
|
||||||
|
self.subject = _('RE: %s') % self.subject
|
||||||
|
self.message = _('\n-< Original Message >-\n%s') % self.message
|
||||||
|
SingleMessageWindow(self.plugin, self.account, self.contact,
|
||||||
|
action = 'send', from_whom = self.from_whom, subject = self.subject,
|
||||||
|
message = self.message)
|
||||||
|
|
||||||
class XMLConsoleWindow:
|
class XMLConsoleWindow:
|
||||||
def __init__(self, plugin, account):
|
def __init__(self, plugin, account):
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
|
|
11
src/gajim.py
11
src/gajim.py
|
@ -334,7 +334,7 @@ class Interface:
|
||||||
array[10], array[11], array[12], account)
|
array[10], array[11], array[12], account)
|
||||||
|
|
||||||
def handle_event_msg(self, account, array):
|
def handle_event_msg(self, account, array):
|
||||||
#('MSG', account, (user, msg, time, encrypted))
|
#('MSG', account, (contact, msg, time, encrypted, mtype, subject))
|
||||||
jid = array[0].split('/')[0]
|
jid = array[0].split('/')[0]
|
||||||
if jid.find('@') <= 0:
|
if jid.find('@') <= 0:
|
||||||
jid = jid.replace('@', '')
|
jid = jid.replace('@', '')
|
||||||
|
@ -353,9 +353,9 @@ class Interface:
|
||||||
self.roster.nb_unread += 1
|
self.roster.nb_unread += 1
|
||||||
gc = self.windows[account]['gc'][jid]
|
gc = self.windows[account]['gc'][jid]
|
||||||
show = gc.contacts[jid][nick].show
|
show = gc.contacts[jid][nick].show
|
||||||
u = Contact(jid = fjid, name = nick, groups = ['none'], show = show,
|
c = Contact(jid = fjid, name = nick, groups = ['none'], show = show,
|
||||||
ask = 'none')
|
ask = 'none')
|
||||||
self.roster.new_chat(u, account)
|
self.roster.new_chat(c, account)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@ -378,7 +378,10 @@ class Interface:
|
||||||
instance = dialogs.PopupNotificationWindow(self,
|
instance = dialogs.PopupNotificationWindow(self,
|
||||||
_('New Message'), jid, account)
|
_('New Message'), jid, account)
|
||||||
self.roster.popup_notification_windows.append(instance)
|
self.roster.popup_notification_windows.append(instance)
|
||||||
self.roster.on_message(jid, array[1], array[2], account, array[3])
|
|
||||||
|
# array : (contact, msg, time, encrypted, mtype, subject)
|
||||||
|
self.roster.on_message(jid, array[1], array[2], account, array[3],
|
||||||
|
array[4], array[5])
|
||||||
if gajim.config.get_per('soundevents', 'first_message_received',
|
if gajim.config.get_per('soundevents', 'first_message_received',
|
||||||
'enabled') and first:
|
'enabled') and first:
|
||||||
self.play_sound('first_message_received')
|
self.play_sound('first_message_received')
|
||||||
|
|
196
src/gtkgui.glade
196
src/gtkgui.glade
|
@ -15394,7 +15394,7 @@ the Jabber network.</property>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
<widget class="GtkWindow" id="send_single_message_window">
|
<widget class="GtkWindow" id="single_message_window">
|
||||||
<property name="border_width">6</property>
|
<property name="border_width">6</property>
|
||||||
<property name="title" translatable="yes"></property>
|
<property name="title" translatable="yes"></property>
|
||||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||||
|
@ -15417,38 +15417,14 @@ the Jabber network.</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkTable" id="table35">
|
<widget class="GtkTable" id="headers_table">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="n_rows">2</property>
|
<property name="n_rows">3</property>
|
||||||
<property name="n_columns">3</property>
|
<property name="n_columns">3</property>
|
||||||
<property name="homogeneous">False</property>
|
<property name="homogeneous">False</property>
|
||||||
<property name="row_spacing">6</property>
|
<property name="row_spacing">6</property>
|
||||||
<property name="column_spacing">12</property>
|
<property name="column_spacing">12</property>
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label336">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">To:</property>
|
|
||||||
<property name="use_underline">False</property>
|
|
||||||
<property name="use_markup">False</property>
|
|
||||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
|
||||||
<property name="wrap">False</property>
|
|
||||||
<property name="selectable">False</property>
|
|
||||||
<property name="xalign">0.5</property>
|
|
||||||
<property name="yalign">0.5</property>
|
|
||||||
<property name="xpad">0</property>
|
|
||||||
<property name="ypad">0</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">0</property>
|
|
||||||
<property name="right_attach">1</property>
|
|
||||||
<property name="top_attach">0</property>
|
|
||||||
<property name="bottom_attach">1</property>
|
|
||||||
<property name="x_options">fill</property>
|
|
||||||
<property name="y_options"></property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label335">
|
<widget class="GtkLabel" id="label335">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -15466,13 +15442,34 @@ the Jabber network.</property>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="right_attach">1</property>
|
<property name="right_attach">1</property>
|
||||||
<property name="top_attach">1</property>
|
<property name="top_attach">2</property>
|
||||||
<property name="bottom_attach">2</property>
|
<property name="bottom_attach">3</property>
|
||||||
<property name="x_options">fill</property>
|
<property name="x_options">fill</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"></property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkEntry" id="from_entry">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="editable">True</property>
|
||||||
|
<property name="visibility">True</property>
|
||||||
|
<property name="max_length">0</property>
|
||||||
|
<property name="text" translatable="yes"></property>
|
||||||
|
<property name="has_frame">True</property>
|
||||||
|
<property name="invisible_char">*</property>
|
||||||
|
<property name="activates_default">False</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">3</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
<property name="bottom_attach">1</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkEntry" id="subject_entry">
|
<widget class="GtkEntry" id="subject_entry">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -15488,8 +15485,8 @@ the Jabber network.</property>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="right_attach">2</property>
|
<property name="right_attach">2</property>
|
||||||
<property name="top_attach">1</property>
|
<property name="top_attach">2</property>
|
||||||
<property name="bottom_attach">2</property>
|
<property name="bottom_attach">3</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"></property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -15511,8 +15508,8 @@ the Jabber network.</property>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">2</property>
|
<property name="left_attach">2</property>
|
||||||
<property name="right_attach">3</property>
|
<property name="right_attach">3</property>
|
||||||
<property name="top_attach">1</property>
|
<property name="top_attach">2</property>
|
||||||
<property name="bottom_attach">2</property>
|
<property name="bottom_attach">3</property>
|
||||||
<property name="x_options">fill</property>
|
<property name="x_options">fill</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"></property>
|
||||||
</packing>
|
</packing>
|
||||||
|
@ -15533,8 +15530,56 @@ the Jabber network.</property>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="right_attach">3</property>
|
<property name="right_attach">3</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="bottom_attach">2</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="from_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">From:</property>
|
||||||
|
<property name="use_underline">False</property>
|
||||||
|
<property name="use_markup">False</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap">False</property>
|
||||||
|
<property name="selectable">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="right_attach">1</property>
|
||||||
<property name="top_attach">0</property>
|
<property name="top_attach">0</property>
|
||||||
<property name="bottom_attach">1</property>
|
<property name="bottom_attach">1</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="to_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">To:</property>
|
||||||
|
<property name="use_underline">False</property>
|
||||||
|
<property name="use_markup">False</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap">False</property>
|
||||||
|
<property name="selectable">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="right_attach">1</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="bottom_attach">2</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"></property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -15546,10 +15591,6 @@ the Jabber network.</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkScrolledWindow" id="scrolledwindow40">
|
<widget class="GtkScrolledWindow" id="scrolledwindow40">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -15612,10 +15653,10 @@ the Jabber network.</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
<property name="focus_on_click">True</property>
|
<property name="focus_on_click">True</property>
|
||||||
<signal name="clicked" handler="on_send_button_clicked" last_modification_time="Thu, 30 Jun 2005 23:51:32 GMT"/>
|
<signal name="clicked" handler="on_send_button_clicked" last_modification_time="Tue, 05 Jul 2005 18:37:42 GMT"/>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkAlignment" id="alignment79">
|
<widget class="GtkAlignment" id="alignment81">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="xalign">0.5</property>
|
<property name="xalign">0.5</property>
|
||||||
<property name="yalign">0.5</property>
|
<property name="yalign">0.5</property>
|
||||||
|
@ -15627,13 +15668,13 @@ the Jabber network.</property>
|
||||||
<property name="right_padding">0</property>
|
<property name="right_padding">0</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox2977">
|
<widget class="GtkHBox" id="hbox2981">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="homogeneous">False</property>
|
<property name="homogeneous">False</property>
|
||||||
<property name="spacing">2</property>
|
<property name="spacing">2</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkImage" id="image778">
|
<widget class="GtkImage" id="image861">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-ok</property>
|
<property name="stock">gtk-ok</property>
|
||||||
<property name="icon_size">4</property>
|
<property name="icon_size">4</property>
|
||||||
|
@ -15650,7 +15691,7 @@ the Jabber network.</property>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label333">
|
<widget class="GtkLabel" id="label345">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes">_Send</property>
|
<property name="label" translatable="yes">_Send</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
@ -15675,6 +15716,77 @@ the Jabber network.</property>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="reply_button">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_default">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
|
<signal name="clicked" handler="on_reply_button_clicked" last_modification_time="Tue, 05 Jul 2005 18:47:49 GMT"/>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkAlignment" id="alignment82">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xscale">0</property>
|
||||||
|
<property name="yscale">0</property>
|
||||||
|
<property name="top_padding">0</property>
|
||||||
|
<property name="bottom_padding">0</property>
|
||||||
|
<property name="left_padding">0</property>
|
||||||
|
<property name="right_padding">0</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox2982">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="homogeneous">False</property>
|
||||||
|
<property name="spacing">2</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImage" id="image862">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="stock">gtk-ok</property>
|
||||||
|
<property name="icon_size">4</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label346">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">_Reply</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="use_markup">False</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap">False</property>
|
||||||
|
<property name="selectable">False</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">6</property>
|
<property name="padding">6</property>
|
||||||
|
|
|
@ -579,7 +579,7 @@ class RosterWindow:
|
||||||
HistoryWindow(self.plugin, user.jid, account)
|
HistoryWindow(self.plugin, user.jid, account)
|
||||||
|
|
||||||
def on_send_single_message_menuitem_activate(self, wiget, account, contact):
|
def on_send_single_message_menuitem_activate(self, wiget, account, contact):
|
||||||
dialogs.SendSingleMessageDialog(self, account, contact)
|
dialogs.SingleMessageWindow(self, account, contact, 'send')
|
||||||
|
|
||||||
def mk_menu_user(self, event, iter):
|
def mk_menu_user(self, event, iter):
|
||||||
'''Make user's popup menu'''
|
'''Make user's popup menu'''
|
||||||
|
@ -1147,7 +1147,8 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
self.plugin.windows[account]['gc'][jid] = \
|
self.plugin.windows[account]['gc'][jid] = \
|
||||||
groupchat_window.GroupchatWindow(jid, nick, self.plugin, account)
|
groupchat_window.GroupchatWindow(jid, nick, self.plugin, account)
|
||||||
|
|
||||||
def on_message(self, jid, msg, tim, account, encrypted = False):
|
def on_message(self, jid, msg, tim, account, encrypted = False,\
|
||||||
|
msg_type = '', subject = None):
|
||||||
'''when we receive a message'''
|
'''when we receive a message'''
|
||||||
if not self.contacts[account].has_key(jid):
|
if not self.contacts[account].has_key(jid):
|
||||||
keyID = ''
|
keyID = ''
|
||||||
|
@ -1160,6 +1161,7 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
status = 'not in the roster', ask = 'none', keyID = keyID)
|
status = 'not in the roster', ask = 'none', keyID = keyID)
|
||||||
self.contacts[account][jid] = [user1]
|
self.contacts[account][jid] = [user1]
|
||||||
self.add_user_to_roster(jid, account)
|
self.add_user_to_roster(jid, account)
|
||||||
|
|
||||||
iters = self.get_user_iter(jid, account)
|
iters = self.get_user_iter(jid, account)
|
||||||
if iters:
|
if iters:
|
||||||
path = self.tree.get_model().get_path(iters[0])
|
path = self.tree.get_model().get_path(iters[0])
|
||||||
|
@ -1167,15 +1169,26 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
path = None
|
path = None
|
||||||
autopopup = gajim.config.get('autopopup')
|
autopopup = gajim.config.get('autopopup')
|
||||||
autopopupaway = gajim.config.get('autopopupaway')
|
autopopupaway = gajim.config.get('autopopupaway')
|
||||||
# Do we have a queue ?
|
|
||||||
|
|
||||||
|
if msg_type == 'normal': # it's single message
|
||||||
|
#FIXME: take into account autopopup and autopopupaway
|
||||||
|
# if user doesn't want to be bugged do it as we do the 'chat'
|
||||||
|
contact = self.contacts[account][jid][0]
|
||||||
|
dialogs.SingleMessageWindow(self.plugin, account, contact,
|
||||||
|
action = 'receive', from_whom = jid, subject = subject, message = msg)
|
||||||
|
return
|
||||||
|
|
||||||
|
# Do we have a queue?
|
||||||
qs = self.plugin.queues[account]
|
qs = self.plugin.queues[account]
|
||||||
no_queue = True
|
no_queue = True
|
||||||
if qs.has_key(jid):
|
if qs.has_key(jid):
|
||||||
no_queue = False
|
no_queue = False
|
||||||
if self.plugin.windows[account]['chats'].has_key(jid):
|
if self.plugin.windows[account]['chats'].has_key(jid):
|
||||||
self.plugin.windows[account]['chats'][jid].print_conversation(msg,
|
self.plugin.windows[account]['chats'][jid].print_conversation(msg,
|
||||||
jid, tim = tim, encrypted = encrypted)
|
jid, tim = tim, encrypted = encrypted, subject = subject)
|
||||||
return
|
return
|
||||||
|
|
||||||
#We save it in a queue
|
#We save it in a queue
|
||||||
if no_queue:
|
if no_queue:
|
||||||
qs[jid] = []
|
qs[jid] = []
|
||||||
|
|
|
@ -370,7 +370,7 @@ class TabbedChatWindow(chat.Chat):
|
||||||
self.plugin.roster.really_remove_user(user, self.account)
|
self.plugin.roster.really_remove_user(user, self.account)
|
||||||
|
|
||||||
def print_conversation(self, text, jid, contact = '', tim = None,
|
def print_conversation(self, text, jid, contact = '', tim = None,
|
||||||
encrypted = False):
|
encrypted = False, subject = None):
|
||||||
"""Print a line in the conversation:
|
"""Print a line in the conversation:
|
||||||
if contact is set to status: it's a status message
|
if contact is set to status: it's a status message
|
||||||
if contact is set to another value: it's an outgoing message
|
if contact is set to another value: it's an outgoing message
|
||||||
|
@ -382,11 +382,15 @@ class TabbedChatWindow(chat.Chat):
|
||||||
else:
|
else:
|
||||||
ec = gajim.encrypted_chats[self.account]
|
ec = gajim.encrypted_chats[self.account]
|
||||||
if encrypted and jid not in ec:
|
if encrypted and jid not in ec:
|
||||||
chat.Chat.print_conversation_line(self, 'Encryption enabled', jid,
|
msg_in_two_langs = _('Encryption enabled')\
|
||||||
|
+ ' - Encryption enabled'
|
||||||
|
chat.Chat.print_conversation_line(self, msg_in_two_langs, jid,
|
||||||
'status', '', tim)
|
'status', '', tim)
|
||||||
ec.append(jid)
|
ec.append(jid)
|
||||||
if not encrypted and jid in ec:
|
if not encrypted and jid in ec:
|
||||||
chat.Chat.print_conversation_line(self, 'Encryption disabled', jid,
|
msg_in_two_langs = _('Encryption disabled')\
|
||||||
|
+ ' - Encryption disabled'
|
||||||
|
chat.Chat.print_conversation_line(self, msg_in_two_langs, jid,
|
||||||
'status', '', tim)
|
'status', '', tim)
|
||||||
ec.remove(jid)
|
ec.remove(jid)
|
||||||
self.xmls[jid].get_widget('gpg_togglebutton').set_active(encrypted)
|
self.xmls[jid].get_widget('gpg_togglebutton').set_active(encrypted)
|
||||||
|
@ -397,7 +401,8 @@ class TabbedChatWindow(chat.Chat):
|
||||||
kind = 'incoming'
|
kind = 'incoming'
|
||||||
name = user.name
|
name = user.name
|
||||||
|
|
||||||
chat.Chat.print_conversation_line(self, text, jid, kind, name, tim)
|
chat.Chat.print_conversation_line(self, text, jid, kind, name, tim,
|
||||||
|
subject = subject)
|
||||||
|
|
||||||
def restore_conversation(self, jid):
|
def restore_conversation(self, jid):
|
||||||
# don't restore lines if it's a transport
|
# don't restore lines if it's a transport
|
||||||
|
|
Loading…
Reference in New Issue