Changeset 8552

Show
Ignore:
Timestamp:
08/22/07 19:20:44 (16 months ago)
Author:
steve-e
Message:

Transform Chat2MUC via DND. Fixes #1408. See #2095

Location:
trunk/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/chat_control.py

    r8537 r8552  
    17741774        def _on_drag_data_received(self, widget, context, x, y, selection, 
    17751775                target_type, timestamp): 
    1776                 # If no resource is known, we can't send a file 
     1776                if not selection.data: 
     1777                        return 
    17771778                if self.TYPE_ID == message_control.TYPE_PM: 
    17781779                        c = self.gc_contact 
    17791780                else: 
    17801781                        c = self.contact 
    1781                 if not c.resource: 
    1782                         return 
    17831782                if target_type == self.TARGET_TYPE_URI_LIST: 
    1784                         if not selection.data: 
     1783                        if not c.resource: # If no resource is known, we can't send a file 
    17851784                                return 
    17861785                        uri = selection.data.strip() 
     
    17911790                                        ft = gajim.interface.instances['file_transfers'] 
    17921791                                        ft.send_file(self.account, c, path) 
     1792                        return 
     1793 
     1794                # chat2muc 
     1795                treeview = gajim.interface.roster.tree 
     1796                model = treeview.get_model() 
     1797                data = selection.data 
     1798                path = treeview.get_selection().get_selected_rows()[1][0] 
     1799                iter = model.get_iter(path) 
     1800                type = model[iter][2] 
     1801                account = model[iter][4].decode('utf-8') 
     1802                if type != 'contact': # source is not a contact 
     1803                        return 
     1804                dropped_jid = data.decode('utf-8') 
     1805 
     1806                dropped_transport = gajim.get_transport_name_from_jid(dropped_jid) 
     1807                c_transport = gajim.get_transport_name_from_jid(c.jid) 
     1808                if dropped_transport or c_transport: 
     1809                        return # transport contacts cannot be invited 
     1810 
     1811                dialogs.TransformChatToMUC(self.account, [c.jid], [dropped_jid]) 
    17931812 
    17941813        def _on_message_tv_buffer_changed(self, textbuffer): 
  • trunk/src/dialogs.py

    r8548 r8552  
    32003200 
    32013201class TransformChatToMUC: 
    3202         def __init__(self, account, jids): 
     3202        def __init__(self, account, jids, preselected = None): 
    32033203                '''This window is used to trasform a one-to-one chat to a MUC. 
    32043204                We do 2 things: first select the server and then make a guests list.''' 
     
    32063206                self.account = account 
    32073207                self.auto_jids = jids 
     3208                self.preselected_jids = preselected 
    32083209 
    32093210                self.xml = gtkgui_helpers.get_glade('chat_to_muc_window.glade') 
     
    32723273                                                if name == '': 
    32733274                                                        name = jid.split('@')[0] 
    3274                                                 self.store.append([img.get_pixbuf(), name, jid]) 
     3275                                                iter = self.store.append([img.get_pixbuf(), name, jid]) 
     3276                                                # preselect treeview rows 
     3277                                                if self.preselected_jids and jid in self.preselected_jids: 
     3278                                                        path = self.store.get_path(iter) 
     3279                                                        self.guests_treeview.get_selection().\ 
     3280                                                                select_path(path) 
    32753281 
    32763282                # show all