[misc] ability to request voice in moderated rooms. Fixes #2266
This commit is contained in:
parent
03c13ab6d4
commit
829892f4c0
|
@ -66,6 +66,19 @@
|
|||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="request_voice_separator">
|
||||
<property name="no_show_all">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="request_voice_menuitem">
|
||||
<property name="label" translatable="yes">_Request Voice</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">False</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="bookmark_separator">
|
||||
<property name="no_show_all">True</property>
|
||||
|
|
|
@ -2496,6 +2496,22 @@ class Connection(CommonConnection, ConnectionHandlers):
|
|||
c.setTagData('reason', reason)
|
||||
self.connection.send(message)
|
||||
|
||||
def request_voice(self, room, nick):
|
||||
"""
|
||||
Request voice in a moderated room
|
||||
"""
|
||||
message = common.xmpp.Message(to=room)
|
||||
|
||||
x = xmpp.DataForm(typ='submit')
|
||||
x.addChild(node=xmpp.DataField(name='FORM_TYPE',
|
||||
value=common.xmpp.NS_MUC + '#request'))
|
||||
x.addChild(node=xmpp.DataField(name='muc#role', value='participant',
|
||||
typ='text-single'))
|
||||
|
||||
message.addChild(node=x)
|
||||
|
||||
self.connection.send(message)
|
||||
|
||||
def check_pingalive(self):
|
||||
if self.awaiting_xmpp_ping_id:
|
||||
# We haven't got the pong in time, disco and reconnect
|
||||
|
|
|
@ -789,8 +789,10 @@ class GroupchatControl(ChatControlBase):
|
|||
change_subject_menuitem = xml.get_object('change_subject_menuitem')
|
||||
history_menuitem = xml.get_object('history_menuitem')
|
||||
minimize_menuitem = xml.get_object('minimize_menuitem')
|
||||
request_voice_menuitem = xml.get_object('request_voice_menuitem')
|
||||
bookmark_separator = xml.get_object('bookmark_separator')
|
||||
separatormenuitem2 = xml.get_object('separatormenuitem2')
|
||||
request_voice_separator = xml.get_object('request_voice_separator')
|
||||
|
||||
if hide_buttonbar_items:
|
||||
change_nick_menuitem.hide()
|
||||
|
@ -840,12 +842,17 @@ class GroupchatControl(ChatControlBase):
|
|||
destroy_room_menuitem.set_sensitive(True)
|
||||
change_subject_menuitem.set_sensitive(True)
|
||||
change_nick_menuitem.set_sensitive(True)
|
||||
if c.role == 'visitor':
|
||||
request_voice_menuitem.set_sensitive(True)
|
||||
else:
|
||||
request_voice_menuitem.set_sensitive(False)
|
||||
else:
|
||||
# We are not connected to this groupchat, disable unusable menuitems
|
||||
configure_room_menuitem.set_sensitive(False)
|
||||
destroy_room_menuitem.set_sensitive(False)
|
||||
change_subject_menuitem.set_sensitive(False)
|
||||
change_nick_menuitem.set_sensitive(False)
|
||||
request_voice_menuitem.set_sensitive(False)
|
||||
|
||||
# connect the menuitems to their respective functions
|
||||
id_ = bookmark_room_menuitem.connect('activate',
|
||||
|
@ -872,6 +879,10 @@ class GroupchatControl(ChatControlBase):
|
|||
self._on_history_menuitem_activate)
|
||||
self.handlers[id_] = history_menuitem
|
||||
|
||||
id_ = request_voice_menuitem.connect('activate',
|
||||
self._on_request_voice_menuitem_activate)
|
||||
self.handlers[id_] = request_voice_menuitem
|
||||
|
||||
id_ = minimize_menuitem.connect('toggled',
|
||||
self.on_minimize_menuitem_toggled)
|
||||
self.handlers[id_] = minimize_menuitem
|
||||
|
@ -2068,6 +2079,12 @@ class GroupchatControl(ChatControlBase):
|
|||
gajim.interface.add_gc_bookmark(self.account, self.name, self.room_jid,\
|
||||
'0', '0', password, self.nick)
|
||||
|
||||
def _on_request_voice_menuitem_activate(self, widget):
|
||||
"""
|
||||
Request voice in the current room
|
||||
"""
|
||||
gajim.connections[self.account].request_voice(self.room_jid)
|
||||
|
||||
def _on_drag_data_received(self, widget, context, x, y, selection,
|
||||
target_type, timestamp):
|
||||
# Invite contact to groupchat
|
||||
|
|
Loading…
Reference in New Issue