Changeset 9960
- Timestamp:
- 07/19/08 19:36:21 (7 weeks ago)
- Location:
- trunk
- Files:
-
- 1 removed
- 4 modified
-
data/glade/invitation_received_dialog.glade (deleted)
-
src/dialogs.py (modified) (2 diffs)
-
src/gajim.py (modified) (5 diffs)
-
src/groupchat_control.py (modified) (1 diff)
-
src/roster_window.py (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/dialogs.py
r9903 r9960 2215 2215 2216 2216 def set_cursor_to_end(self): 2217 end_iter = self.message_tv_buffer.get_end_iter()2218 self.message_tv_buffer.place_cursor(end_iter)2217 end_iter = self.message_tv_buffer.get_end_iter() 2218 self.message_tv_buffer.place_cursor(end_iter) 2219 2219 2220 2220 def save_pos(self): … … 2921 2921 self.password = password 2922 2922 self.is_continued = is_continued 2923 xml = gtkgui_helpers.get_glade('invitation_received_dialog.glade') 2924 self.dialog = xml.get_widget('invitation_received_dialog') 2925 2923 2924 pritext = _('''You are invited to a groupchat''') 2926 2925 #Don't translate $Contact 2927 2926 if is_continued: 2928 pritext = _('$Contact has invited you to join a discussion')2929 else: 2930 pritext = _('$Contact has invited you to group chat %(room_jid)s')\2927 sectext = _('$Contact has invited you to join a discussion') 2928 else: 2929 sectext = _('$Contact has invited you to group chat %(room_jid)s')\ 2931 2930 % {'room_jid': room_jid} 2932 2931 contact = gajim.contacts.get_first_contact_from_jid(account, contact_jid) 2933 if contact and contact.name: 2934 contact_text = '%s (%s)' % (contact.name, contact_jid) 2935 else: 2936 contact_text = contact_jid 2937 pritext = pritext.replace('$Contact', contact_text) 2938 2939 label_text = '<big><b>%s</b></big>' % pritext 2932 contact_text = contact and contact.name or contact_jid 2933 sectext = sectext.replace('$Contact', contact_text) 2940 2934 2941 2935 if comment: # only if not None and not '' 2942 2936 comment = gobject.markup_escape_text(comment) 2943 sectext = _('Comment: %s') % comment 2944 label_text += '\n\n%s' % sectext 2945 2946 xml.get_widget('label').set_markup(label_text) 2947 2948 xml.get_widget('deny_button').connect('clicked', 2949 self.on_deny_button_clicked) 2950 xml.get_widget('accept_button').connect('clicked', 2951 self.on_accept_button_clicked) 2952 self.dialog.show_all() 2953 2954 def on_deny_button_clicked(self, widget): 2955 self.dialog.destroy() 2956 2957 def on_accept_button_clicked(self, widget): 2958 self.dialog.destroy() 2959 try: 2960 if self.is_continued: 2961 gajim.interface.join_gc_room(self.account, self.room_jid, 2962 gajim.nicks[self.account], None, is_continued=True) 2963 else: 2964 JoinGroupchatWindow(self.account, self.room_jid) 2965 except GajimGeneralException: 2966 pass 2937 comment = _('Comment: %s') % comment 2938 sectext += '\n\n%s' % comment 2939 sectext += '\n\n' + _('Do you want to accept the invitation?') 2940 2941 dialog = YesNoDialog(pritext, sectext) 2942 if dialog.get_response() == gtk.RESPONSE_YES: 2943 try: 2944 if self.is_continued: 2945 gajim.interface.join_gc_room(self.account, self.room_jid, 2946 gajim.nicks[self.account], None, is_continued=True) 2947 else: 2948 JoinGroupchatWindow(self.account, self.room_jid) 2949 except GajimGeneralException: 2950 pass 2967 2951 2968 2952 class ProgressDialog: -
trunk/src/gajim.py
r9956 r9960 2129 2129 if type_ in ('printed_gc_msg', 'printed_marked_gc_msg', 'gc_msg'): 2130 2130 w = self.msg_win_mgr.get_window(jid, account) 2131 if self.minimized_controls[account].has_key(jid): 2132 if not w: 2133 ctrl = self.minimized_controls[account][jid] 2134 w = self.msg_win_mgr.create_window(ctrl.contact, \ 2135 ctrl.account, ctrl.type_id) 2131 if jid in self.minimized_controls[account]: 2136 2132 self.roster.on_groupchat_maximized(None, jid, account) 2137 2133 … … 2474 2470 2475 2471 def join_gc_room(self, account, room_jid, nick, password, minimize=False, 2476 is_continued=False):2472 is_continued=False): 2477 2473 '''joins the room immediately''' 2478 2474 if not nick: 2479 2475 nick = gajim.nicks[account] 2476 2480 2477 if self.msg_win_mgr.has_window(room_jid, account) and \ 2481 gajim.gc_connected[account][room_jid]:2478 gajim.gc_connected[account][room_jid]: 2482 2479 gc_ctrl = self.msg_win_mgr.get_gc_control(room_jid, account) 2483 2480 win = gc_ctrl.parent_win … … 2485 2482 dialogs.ErrorDialog(_('You are already in group chat %s') % room_jid) 2486 2483 return 2487 minimized_control_exists = False 2488 if room_jid in gajim.interface.minimized_controls[account]: 2489 minimized_control_exists = True 2484 2490 2485 invisible_show = gajim.SHOW_LIST.index('invisible') 2491 2486 if gajim.connections[account].connected == invisible_show: … … 2493 2488 _('You cannot join a group chat while you are invisible')) 2494 2489 return 2495 if minimize and not minimized_control_exists and \ 2490 2491 minimized_control_exists = False 2492 if room_jid in gajim.interface.minimized_controls[account]: 2493 minimized_control_exists = True 2494 2495 if not minimized_control_exists and \ 2496 2496 not self.msg_win_mgr.has_window(room_jid, account): 2497 contact = gajim.contacts.create_contact(jid=room_jid, name=nick) 2498 gc_control = GroupchatControl(None, contact, account) 2499 self.minimized_controls[account][room_jid] = gc_control 2500 gajim.connections[account].join_gc(nick, room_jid, password) 2501 if password: 2502 gajim.gc_passwords[room_jid] = password 2497 # Join new groupchat 2498 if minimize: 2499 contact = gajim.contacts.create_contact(jid=room_jid, name=nick) 2500 gc_control = GroupchatControl(None, contact, account) 2501 gajim.interface.minimized_controls[account][room_jid] = gc_control 2502 self.roster.add_groupchat(room_jid, account) 2503 else: 2504 self.new_room(room_jid, nick, account, is_continued=is_continued) 2505 elif not minimized_control_exists: 2506 # We are already in that groupchat 2507 gc_control = self.msg_win_mgr.get_gc_control(room_jid, account) 2508 gc_control.parent_win.set_active_tab(gc_control) 2509 else: 2510 # We are already in this groupchat and it is minimized 2503 2511 self.roster.add_groupchat(room_jid, account) 2504 return 2505 if not minimized_control_exists and \ 2506 not self.msg_win_mgr.has_window(room_jid, account): 2507 self.new_room(room_jid, nick, account, is_continued=is_continued) 2508 if not minimized_control_exists: 2509 gc_control = self.msg_win_mgr.get_gc_control(room_jid, account) 2510 gc_control.parent_win.set_active_tab(gc_control) 2512 2513 # Connect 2511 2514 gajim.connections[account].join_gc(nick, room_jid, password) 2512 2515 if password: 2513 2516 gajim.gc_passwords[room_jid] = password 2514 contact = gajim.contacts.get_contact_with_highest_priority(account, \2515 room_jid)2516 if contact or minimized_control_exists:2517 self.roster.add_groupchat(room_jid, account)2518 2517 2519 2518 def new_room(self, room_jid, nick, account, is_continued=False): … … 2822 2821 # Only join non-opened groupchats. Opened one are already 2823 2822 # auto-joined on re-connection 2824 if not gajim.gc_connected[account].has_key(jid):2823 if not jid in gajim.gc_connected[account]: 2825 2824 # we are not already connected 2826 2825 minimize = bm['minimize'] in ('1', 'true') 2827 2826 gajim.interface.join_gc_room(account, jid, bm['nick'], 2828 2827 bm['password'], minimize = minimize) 2828 elif jid in self.minimized_controls[account]: 2829 # more or less a hack: 2830 # On disconnect the minimized gc contact instances 2831 # were set to offline. Reconnect them to show up in the roster. 2832 self.roster.add_groupchat(jid, account) 2829 2833 2830 2834 def add_gc_bookmark(self, account, name, jid, autojoin, minimize, password, -
trunk/src/groupchat_control.py
r9931 r9960 1625 1625 ctrl.parent_win = None 1626 1626 1627 gajim.interface.minimized_controls[self.account][self.contact.jid] = \1628 ctrl1629 1630 del win._controls[self.account][self.contact.jid]1631 1632 1627 gajim.interface.roster.add_groupchat(self.contact.jid, self.account, 1633 1628 status = self.subject) 1629 1630 del win._controls[self.account][self.contact.jid] 1634 1631 1635 1632 def shutdown(self, status='offline'): -
trunk/src/roster_window.py
r9945 r9960 706 706 self._remove_entity(contact, account) 707 707 708 709 708 if backend: 710 709 # Remove contact before redrawing, otherwise the old … … 731 730 ''' 732 731 contact = gajim.contacts.get_contact_with_highest_priority(account, jid) 732 # Do not show gc if we are disconnected and minimize it 733 if gajim.account_is_connected(account): 734 show = 'online' 735 else: 736 show = 'offline' 737 status = '' 738 733 739 if contact is None: 734 # Do not show gc if we are disconnected and minimize it 735 if gajim.account_is_connected(account): 736 show = 'online' 737 else: 738 show = 'offline' 739 status = '' 740 # New groupchat 740 741 contact = gajim.contacts.create_contact(jid=jid, name=jid, 741 742 groups=[_('Groupchats')], show=show, status=status, sub='none') 742 743 gajim.contacts.add_contact(account, contact) 744 gc_control = gajim.interface.msg_win_mgr.get_gc_control(jid, account) 745 if gc_control: 746 # there is a window that we can minimize 747 gajim.interface.minimized_controls[account][jid] = gc_control 743 748 self.add_contact(jid, account) 744 749 else: 745 contact.show = 'online' 750 contact.show = show 751 contact.status = status 746 752 self.draw_completely_and_show_if_needed(jid, account) 753 747 754 return contact 748 755 … … 752 759 contact = gajim.contacts.get_contact_with_highest_priority(account, jid) 753 760 if contact.is_groupchat(): 761 if jid in gajim.interface.minimized_controls[account]: 762 gajim.interface.minimized_controls[account][jid] 754 763 self.remove_contact(jid, account, force=True, backend=True) 755 764 return True … … 962 971 963 972 # gets number of unread gc marked messages 964 if jid in gajim.interface.minimized_controls[account]: 973 if jid in gajim.interface.minimized_controls[account] and \ 974 gajim.interface.minimized_controls[account][jid]: 965 975 nb_unread = len(gajim.events.get_events(account, jid, 966 976 ['printed_marked_gc_msg'])) … … 1582 1592 return False 1583 1593 1584 def auto_join_bookmarks(self, account):1585 '''autojoin bookmarks that have 'auto join' on for this account'''1586 for bm in gajim.connections[account].bookmarks:1587 if bm['autojoin'] in ('1', 'true'):1588 jid = bm['jid']1589 if not gajim.gc_connected[account].has_key(jid) or\1590 not gajim.gc_connected[account][jid]:1591 # we are not already connected1592 minimize = bm['minimize'] in ('1', 'true')1593 gajim.interface.join_gc_room(account, jid, bm['nick'],1594 bm['password'], minimize = minimize)1595 1596 1594 def on_event_removed(self, event_list): 1597 1595 '''Remove contacts on last events removed. … … 2652 2650 def on_disconnect(self, widget, jid, account): 2653 2651 '''When disconnect menuitem is activated: disconect from room''' 2654 ctrl = gajim.interface.minimized_controls[account][jid]2655 delgajim.interface.minimized_controls[account][jid]2656 ctrl.shutdown()2652 if jid in gajim.interface.minimized_controls[account]: 2653 ctrl = gajim.interface.minimized_controls[account][jid] 2654 ctrl.shutdown() 2657 2655 self.remove_groupchat(jid, account) 2658 2656 … … 2723 2721 def on_groupchat_maximized(self, widget, jid, account): 2724 2722 '''When a groupchat is maximised''' 2723 if not jid in gajim.interface.minimized_controls[account]: 2724 return 2725 2725 ctrl = gajim.interface.minimized_controls[account][jid] 2726 2726 mw = gajim.interface.msg_win_mgr.get_window(ctrl.contact.jid, … … 2732 2732 mw.new_tab(ctrl) 2733 2733 mw.set_active_tab(ctrl) 2734 del gajim.interface.minimized_controls[account][jid] 2735 2734 2736 2735 self.remove_groupchat(jid, account) 2737 2736 … … 3241 3240 jid = model[path][C_JID].decode('utf-8') 3242 3241 resource = None 3243 contact = None3242 contact = gajim.contacts.get_first_contact_from_jid(account, jid) 3244 3243 titer = model.get_iter(path) 3245 3244 if type_ in ('group', 'account'): … … 3248 3247 else: 3249 3248 self.tree.expand_row(path, False) 3250 elif jid in gajim.interface.minimized_controls[account]: 3251 self.on_groupchat_maximized(None, jid, account) 3249 elif contact.is_groupchat(): 3250 first_ev = gajim.events.get_first_event(account, jid) 3251 if first_ev and self.open_event(account, jid, first_ev): 3252 # We are invited to a GC 3253 # open event cares about connecting to it 3254 self.remove_groupchat(jid, account) 3255 else: 3256 self.on_groupchat_maximized(None, jid, account) 3252 3257 else: 3253 3258 first_ev = gajim.events.get_first_event(account, jid)
