From 7c9617812674e39fb3d2e91ead5a4a79d7294788 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Tue, 10 Feb 2009 21:45:44 +0000 Subject: [PATCH] add XEP-202 in vcard window. Fixes #4007 --- data/glade/data_form_window.glade | 1347 ++++++-------- data/glade/vcard_information_window.glade | 1947 +++++++++++---------- src/common/connection.py | 23 +- src/common/connection_handlers.py | 50 + src/gajim.py | 13 + src/remote_control.py | 4 + src/vcard.py | 44 +- 7 files changed, 1671 insertions(+), 1757 deletions(-) diff --git a/data/glade/data_form_window.glade b/data/glade/data_form_window.glade index 2d73ee5dd..40360616f 100644 --- a/data/glade/data_form_window.glade +++ b/data/glade/data_form_window.glade @@ -1,800 +1,551 @@ - - - + + + - - - 6 - Room Configuration - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 650 - 450 - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - - - - - True - False - 6 - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_ETCHED_IN - GTK_CORNER_TOP_LEFT - - - - True - GTK_SHADOW_IN - - - - True - False - 0 - - - - 5 - True - False - 5 - - - - True - - False - False - GTK_JUSTIFY_LEFT - True - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 5 - False - False - - - - - - True - - - 5 - False - True - - - - - - - - - 0 - True - True - - - - - - True - - - 5 - False - True - - - - - - 5 - True - False - 5 - - - - - - - 0 - True - True - - - - - - - - - 0 - True - True - - - - - - True - GTK_BUTTONBOX_END - 6 - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - - - - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - - - - - - 0 - False - True - - - - - - - - True - window1 - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - - - - True - False - 10 - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - GTK_SHADOW_IN - - - - 5 - True - False - 5 - - - - True - - False - False - GTK_JUSTIFY_LEFT - True - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 5 - False - False - - - - - - True - - - 5 - False - True - - - - - - - - - - - - - 0 - True - True - - - - - - True - 1 - 2 - False - 0 - 0 - - - - True - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - False - True - False - False - False - - - - - 0 - 1 - 0 - 1 - - - - - - True - False - 0 - - - - True - True - gtk-clear - True - GTK_RELIEF_NORMAL - True - - - 0 - False - True - GTK_PACK_END - - - - - - True - True - gtk-remove - True - GTK_RELIEF_NORMAL - True - - - 0 - False - True - GTK_PACK_END - - - - - - True - True - gtk-add - True - GTK_RELIEF_NORMAL - True - - - 0 - False - True - - - - - - True - True - gtk-edit - True - GTK_RELIEF_NORMAL - True - - - 0 - False - False - - - - - - - - - 1 - 2 - 0 - 1 - fill - fill - - - - - 0 - True - True - - - - - - - - True - window1 - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - - - - 3 - True - False - 3 - - - - True - Fill in the form. - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - False - GTK_POS_TOP - False - False - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - GTK_SHADOW_NONE - - - - - - - - - True - True - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - True - False - 0 - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - 0 - True - True - - - - - - True - False - 0 - - - - True - True - gtk-add - True - GTK_RELIEF_NORMAL - True - - - - 0 - False - False - - - - - - True - True - gtk-remove - True - GTK_RELIEF_NORMAL - True - - - - 0 - False - False - - - - - - True - - - 3 - False - False - - - - - - True - True - gtk-edit - True - GTK_RELIEF_NORMAL - True - - - - 0 - False - False - - - - - - True - - - 3 - False - True - - - - - - True - True - gtk-go-up - True - GTK_RELIEF_NORMAL - True - - - - 0 - False - False - - - - - - True - True - gtk-go-down - True - GTK_RELIEF_NORMAL - True - - - - 0 - False - False - - - - - - True - - - 3 - False - True - - - - - - True - True - gtk-clear - True - GTK_RELIEF_NORMAL - True - - - - 0 - False - False - - - - - 0 - False - True - - - - - False - True - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - 0 - True - True - - - - - - + + 6 + Room Configuration + 650 + 450 + + + + True + 6 + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_ETCHED_IN + + + True + + + True + + + True + 5 + 5 + + + True + 0 + True + + + False + False + 5 + + + + + True + + + False + 5 + 1 + + + + + + + + + + True + + + False + 5 + 1 + + + + + True + 5 + 5 + + + + + + 2 + + + + + + + + + + + True + 6 + GTK_BUTTONBOX_END + + + True + True + True + gtk-cancel + True + 0 + + + + + + True + True + True + gtk-ok + True + 0 + + + + 1 + + + + + False + 1 + + + + + + + True + window1 + + + True + 10 + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + + + True + 5 + 5 + + + True + 0 + True + + + False + False + 5 + + + + + True + + + False + 5 + 1 + + + + + + + + + + + + + + True + 1 + 2 + + + True + + + True + True + gtk-add + True + 0 + + + False + 2 + + + + + True + True + gtk-edit + True + 0 + + + False + False + 3 + + + + + + + + True + True + gtk-remove + True + 0 + + + False + GTK_PACK_END + 1 + + + + + True + True + gtk-clear + True + 0 + + + False + GTK_PACK_END + + + + + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + True + GTK_SHADOW_IN + + + True + True + False + + + + + + + 1 + + + + + + + True + window1 + + + True + 3 + 3 + + + True + + + True + 0 + Fill in the form. + True + + + + + False + False + + + + + True + False + False + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + GTK_SHADOW_NONE + + + + + + + + True + + + + + True + + + tab + False + + + + + + + + True + + + tab + 1 + False + + + + + True + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + + + + + + + True + + + True + True + gtk-add + True + 0 + + + + False + False + + + + + True + True + gtk-remove + True + 0 + + + + False + False + 1 + + + + + True + + + False + False + 3 + 2 + + + + + True + True + gtk-edit + True + 0 + + + + False + False + 3 + + + + + True + + + False + 3 + 4 + + + + + True + True + gtk-go-up + True + 0 + + + + False + False + 5 + + + + + True + True + gtk-go-down + True + 0 + + + + False + False + 6 + + + + + True + + + False + 3 + 7 + + + + + True + True + gtk-clear + True + 0 + + + + False + False + 8 + + + + + False + 1 + + + + + 2 + + + + + True + + + tab + 2 + False + + + + + + + + True + + + tab + 3 + False + + + + + 1 + + + + + True + True + GTK_POLICY_NEVER + GTK_POLICY_NEVER + + + True + True + False + GTK_WRAP_WORD + False + + + + + 2 + + + + + diff --git a/data/glade/vcard_information_window.glade b/data/glade/vcard_information_window.glade index beb93121e..b0a24c8ec 100644 --- a/data/glade/vcard_information_window.glade +++ b/data/glade/vcard_information_window.glade @@ -38,85 +38,90 @@ True - 5 + 6 2 12 6 - + True - 1 + 0 0 - <b>Jabber ID:</b> - True + 5 + 5 + True + True + PANGO_ELLIPSIZE_END - GTK_FILL + 1 + 2 + 5 + 6 - + True 1 0 - <b>Resource:</b> + <b>Contact time:</b> True - 1 - 2 + 5 + 6 GTK_FILL - - + True - 1 - 0 - <b>Status:</b> - True + + + True + True + 0 + 0 + 5 + 5 + True + PANGO_ELLIPSIZE_END + + + 1 + 2 2 3 GTK_FILL - + GTK_FILL - + True - 1 + True + 0 0 - <b>Client:</b> - True - - - 3 - 4 - GTK_FILL - - - - - - True - 1 - 0 - <b>System:</b> - True + 5 + 5 + True + True + PANGO_ELLIPSIZE_END + 1 + 2 4 5 - GTK_FILL - + True True 0 @@ -124,10 +129,13 @@ 5 5 True + PANGO_ELLIPSIZE_END 1 2 + 3 + 4 @@ -156,7 +164,7 @@ - + True True 0 @@ -164,59 +172,84 @@ 5 5 True - PANGO_ELLIPSIZE_END 1 2 - 3 - 4 - + True - True - 0 + 1 0 - 5 - 5 - True - True - PANGO_ELLIPSIZE_END + <b>System:</b> + True - 1 - 2 4 5 + GTK_FILL - + True - - - True - True - 0 - 0 - 5 - 5 - True - PANGO_ELLIPSIZE_END - - + 1 + 0 + <b>Client:</b> + True + + + 3 + 4 + GTK_FILL + + + + + + True + 1 + 0 + <b>Status:</b> + True - 1 - 2 2 3 GTK_FILL - GTK_FILL + + + + + + True + 1 + 0 + <b>Resource:</b> + True + + + 1 + 2 + GTK_FILL + + + + + + True + 1 + 0 + <b>Jabber ID:</b> + True + + + GTK_FILL + @@ -304,22 +337,30 @@ 12 6 - + True - False - - - True - 0 - 0 - 5 - 5 - - + 0 + 0 + <b>Ask:</b> + True - 1 - 2 + 2 + 3 + GTK_FILL + + + + + + True + 0 + 0 + <b>Subscription:</b> + True + + + GTK_FILL @@ -344,30 +385,22 @@ - + True - 0 - 0 - <b>Subscription:</b> - True + False + + + True + 0 + 0 + 5 + 5 + + - GTK_FILL - - - - - - True - 0 - 0 - <b>Ask:</b> - True - - - 2 - 3 - GTK_FILL + 1 + 2 @@ -423,490 +456,101 @@ - + True True - - - True - 6 - 3 - 4 - 12 - 6 - - - - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 1 - 2 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 3 - 4 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 1 - 2 - 1 - 2 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 1 - 2 - 2 - 3 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 3 - 4 - 2 - 3 - - - - - - True - 1 - 0 - <b>Family:</b> - True - - - GTK_FILL - - - - - - True - 1 - 0 - <b>Middle:</b> - True - - - 1 - 2 - GTK_FILL - - - - - - True - 1 - 0 - <b>Prefix:</b> - True - - - 2 - 3 - GTK_FILL - - - - - - True - 0 - 0 - <b>Given:</b> - True - - - 2 - 3 - GTK_FILL - - - - - - True - 0 - 0 - <b>Suffix:</b> - True - - - 2 - 3 - 2 - 3 - GTK_FILL - - - - - - - - True - 0 - 0 - <b>Full Name</b> - True - - - label_item - - - - - 4 - 1 - 2 - - - - - - True - True - - - True - 6 - 3 - 4 - 5 - 5 - - - True - True - 0 - 0 - 5 - 5 - True - - - 1 - 2 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 3 - 4 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 1 - 2 - 1 - 2 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 3 - 4 - 1 - 2 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 1 - 2 - 2 - 3 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 3 - 4 - 2 - 3 - - - - - - True - 1 - 0 - <b>Street:</b> - True - - - GTK_FILL - - - - - - True - 1 - 0 - <b>City:</b> - True - - - 1 - 2 - GTK_FILL - - - - - - True - 1 - 0 - <b>State:</b> - True - - - 2 - 3 - GTK_FILL - - - - - - True - 0 - 0 - <b>Extra Address:</b> - True - - - 2 - 3 - GTK_FILL - - - - - - True - 0 - 0 - <b>Postal Code:</b> - True - - - 2 - 3 - 1 - 2 - GTK_FILL - - - - - - True - 0 - 0 - <b>Country:</b> - True - - - 2 - 3 - 2 - 3 - GTK_FILL - - - - - - - - True - 0 - 0 - <b>Address</b> - True - - - label_item - - - - - 4 - 2 - 3 - - - - - - True - 1 - 0 - <b>Homepage:</b> - True - - - 3 - 4 - - - - - - - True 0 0 - <b>Name:</b> - True - - - GTK_FILL - - - - - - True - 0 - 0 - <b>Nickname:</b> - True - - - 2 - 3 - GTK_FILL - - - - - - True - 1 - 0 - <b>Phone No.:</b> - True + 5 + 5 + True + 3 + 4 5 6 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 1 + 2 + 5 + 6 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 1 + 4 + 4 + 5 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 1 + 2 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 3 + 4 + + + + + + True + 1 + <b>E-Mail:</b> + True + + + 4 + 5 GTK_FILL @@ -935,102 +579,491 @@ - + True 1 - <b>E-Mail:</b> + 0 + <b>Phone No.:</b> True - 4 - 5 + 5 + 6 GTK_FILL - + True - True 0 0 - 5 - 5 - True + <b>Nickname:</b> + True + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + 0 + <b>Name:</b> + True + + + GTK_FILL + + + + + + True + 1 + 0 + <b>Homepage:</b> + True + + + 3 + 4 + + + + + + + True + True + + + True + 6 + 3 + 4 + 5 + 5 + + + True + 0 + 0 + <b>Country:</b> + True + + + 2 + 3 + 2 + 3 + GTK_FILL + + + + + + True + 0 + 0 + <b>Postal Code:</b> + True + + + 2 + 3 + 1 + 2 + GTK_FILL + + + + + + True + 0 + 0 + <b>Extra Address:</b> + True + + + 2 + 3 + GTK_FILL + + + + + + True + 1 + 0 + <b>State:</b> + True + + + 2 + 3 + GTK_FILL + + + + + + True + 1 + 0 + <b>City:</b> + True + + + 1 + 2 + GTK_FILL + + + + + + True + 1 + 0 + <b>Street:</b> + True + + + GTK_FILL + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 3 + 4 + 2 + 3 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 1 + 2 + 2 + 3 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 3 + 4 + 1 + 2 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 1 + 2 + 1 + 2 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 3 + 4 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 1 + 2 + + + + + + + + True + 0 + 0 + <b>Address</b> + True + + + label_item + + - 3 4 + 2 + 3 - + True True - 0 - 0 - 5 - 5 - True + + + True + 6 + 3 + 4 + 12 + 6 + + + + + + + + + True + 0 + 0 + <b>Suffix:</b> + True + + + 2 + 3 + 2 + 3 + GTK_FILL + + + + + + True + 0 + 0 + <b>Given:</b> + True + + + 2 + 3 + GTK_FILL + + + + + + True + 1 + 0 + <b>Prefix:</b> + True + + + 2 + 3 + GTK_FILL + + + + + + True + 1 + 0 + <b>Middle:</b> + True + + + 1 + 2 + GTK_FILL + + + + + + True + 1 + 0 + <b>Family:</b> + True + + + GTK_FILL + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 3 + 4 + 2 + 3 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 1 + 2 + 2 + 3 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 1 + 2 + 1 + 2 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 3 + 4 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 1 + 2 + + + + + + + + True + 0 + 0 + <b>Full Name</b> + True + + + label_item + + - 1 - 2 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 1 4 - 4 - 5 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 1 - 2 - 5 - 6 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 3 - 4 - 5 - 6 + 1 + 2 @@ -1067,92 +1100,110 @@ - + True - True - 0 + 1 0 - 5 - 5 - True - PANGO_ELLIPSIZE_END + <b>Phone No.:</b> + True - 1 - 2 + 4 + 5 + GTK_FILL - + True - True - 0 + 1 0 - 5 - 5 - True - PANGO_ELLIPSIZE_END + <b>E-Mail:</b> + True - 3 - 4 - - - - - - True - True - 0 - 0 - 5 - 5 - True - PANGO_ELLIPSIZE_END - - - 1 - 2 - 1 - 2 - - - - - - True - True - 0 - 0 - 5 - 5 - True - PANGO_ELLIPSIZE_END - - - 3 - 4 - 1 - 2 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 1 - 4 3 4 + GTK_FILL + + + + + + True + 0 + 0 + <b>Role:</b> + True + + + 2 + 3 + 1 + 2 + GTK_FILL + + + + + + True + 0 + 0 + <b>Department:</b> + True + + + 2 + 3 + GTK_FILL + + + + + + True + 1 + 0 + <b>Position:</b> + True + + + 1 + 2 + GTK_FILL + + + + + + True + 1 + 0 + <b>Company:</b> + True + + + GTK_FILL + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 1 + 2 + 4 + 5 @@ -1169,164 +1220,18 @@ 5 5 - + True - True 0 0 - 5 - 5 - True - - - 1 - 2 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 3 - 4 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 1 - 2 - 1 - 2 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 3 - 4 - 1 - 2 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 1 - 2 - 2 - 3 - - - - - - True - True - 0 - 0 - 5 - 5 - True - - - 3 - 4 - 2 - 3 - - - - - - True - 1 - 0 - <b>Street:</b> + <b>Country:</b> True - - GTK_FILL - - - - - - True - 1 - 0 - <b>City:</b> - True - - - 1 - 2 - GTK_FILL - - - - - - True - 1 - 0 - <b>State:</b> - True - - - 2 - 3 - GTK_FILL - - - - - - True - 0 - 0 - <b>Extra Address:</b> - True - True - 2 3 + 2 + 3 GTK_FILL @@ -1349,22 +1254,168 @@ - + True 0 0 - <b>Country:</b> + <b>Extra Address:</b> True + True 2 3 + GTK_FILL + + + + + + True + 1 + 0 + <b>State:</b> + True + + 2 3 GTK_FILL + + + True + 1 + 0 + <b>City:</b> + True + + + 1 + 2 + GTK_FILL + + + + + + True + 1 + 0 + <b>Street:</b> + True + + + GTK_FILL + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 3 + 4 + 2 + 3 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 1 + 2 + 2 + 3 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 3 + 4 + 1 + 2 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 1 + 2 + 1 + 2 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 3 + 4 + + + + + + True + True + 0 + 0 + 5 + 5 + True + + + 1 + 2 + + + @@ -1388,7 +1439,7 @@ - + True True 0 @@ -1399,99 +1450,81 @@ 1 - 2 - 4 - 5 - - - - - - True - 1 - 0 - <b>Company:</b> - True - - - GTK_FILL - - - - - - True - 1 - 0 - <b>Position:</b> - True - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - 0 - <b>Department:</b> - True - - - 2 - 3 - GTK_FILL - - - - - - True - 0 - 0 - <b>Role:</b> - True - - - 2 - 3 - 1 - 2 - GTK_FILL - - - - - - True - 1 - 0 - <b>E-Mail:</b> - True - - + 4 3 4 - GTK_FILL - + True - 1 + True + 0 0 - <b>Phone No.:</b> - True + 5 + 5 + True + PANGO_ELLIPSIZE_END - 4 - 5 - GTK_FILL + 3 + 4 + 1 + 2 + + + + + + True + True + 0 + 0 + 5 + 5 + True + PANGO_ELLIPSIZE_END + + + 1 + 2 + 1 + 2 + + + + + + True + True + 0 + 0 + 5 + 5 + True + PANGO_ELLIPSIZE_END + + + 3 + 4 + + + + + + True + True + 0 + 0 + 5 + 5 + True + PANGO_ELLIPSIZE_END + + + 1 + 2 diff --git a/src/common/connection.py b/src/common/connection.py index 0097ec219..1940de163 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -1481,7 +1481,7 @@ class Connection(ConnectionHandlers): to_whom_jid = jid if resource: to_whom_jid += '/' + resource - iq = common.xmpp.Iq(to = to_whom_jid, typ = 'get', queryNS =\ + iq = common.xmpp.Iq(to=to_whom_jid, typ='get', queryNS=\ common.xmpp.NS_VERSION) id_ = self.connection.getAnID() iq.setID(id_) @@ -1490,6 +1490,27 @@ class Connection(ConnectionHandlers): self.version_ids.append(id_) self.connection.send(iq) + def request_entity_time(self, jid, resource, groupchat_jid=None): + '''groupchat_jid is used when we want to send a request to a real jid + and act as if the answer comes from the groupchat_jid''' + if not self.connection: + return + # If we are invisible, do not request + if self.connected == gajim.SHOW_LIST.index('invisible'): + self.dispatch('ENTITY_TIME', (jid, resource, _('Not fetched because of invisible status'))) + return + to_whom_jid = jid + if resource: + to_whom_jid += '/' + resource + iq = common.xmpp.Iq(to=to_whom_jid, typ='get', queryNS=\ + common.xmpp.NS_TIME_REVISED) + id_ = self.connection.getAnID() + iq.setID(id_) + if groupchat_jid: + self.groupchat_jids[id_] = groupchat_jid + self.entity_time_ids.append(id_) + self.connection.send(iq) + def get_settings(self): ''' Get Gajim settings as described in XEP 0049 ''' if not self.connection: diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index 9ac8dc2c7..8e74f9181 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -38,6 +38,7 @@ import hashlib from time import (altzone, daylight, gmtime, localtime, mktime, strftime, time as time_time, timezone, tzname) from calendar import timegm +import datetime import socks5 import common.xmpp @@ -1426,6 +1427,8 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, self.last_ids = [] # IDs of jabber:iq:version requests self.version_ids = [] + # IDs of urn:xmpp:time requests + self.entity_time_ids = [] # ID of urn:xmpp:ping requests self.awaiting_xmpp_ping_id = None self.continue_connect_info = None @@ -1475,6 +1478,10 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, self.dispatch('LAST_STATUS_TIME', (jid_stripped, resource, -1, '')) self.last_ids.remove(id_) return + if id_ in self.entity_time_ids: + self.dispatch('ENTITY_TIME', (jid_stripped, resource, '')) + self.entity_time_ids.remove(id_) + return if id_ == self.awaiting_xmpp_ping_id: self.awaiting_xmpp_ping_id = None errmsg = iq_obj.getErrorMsg() @@ -1639,6 +1646,47 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, self.connection.send(iq_obj) raise common.xmpp.NodeProcessed + def _TimeRevisedResultCB(self, con, iq_obj): + log.debug('TimeRevisedResultCB') + time_info = '' + qp = iq_obj.getTag('time') + tzo = qp.getTag('tzo').getData() + if tzo == 'Z': + tzo = '0:0' + tzoh, tzom = tzo.split(':') + utc_time = qp.getTag('utc').getData() + ZERO = datetime.timedelta(0) + class UTC(datetime.tzinfo): + def utcoffset(self, dt): + return ZERO + def tzname(self, dt): + return "UTC" + def dst(self, dt): + return ZERO + + class contact_tz(datetime.tzinfo): + def utcoffset(self, dt): + return datetime.timedelta(hours=int(tzoh), minutes=int(tzom)) + def tzname(self, dt): + return "remote timezone" + def dst(self, dt): + return ZERO + + t = datetime.datetime.strptime(utc_time, '%Y-%m-%dT%H:%M:%SZ') + t = t.replace(tzinfo=UTC()) + + time_info = t.astimezone(contact_tz()).strftime('%c') + id_ = iq_obj.getID() + if id_ in self.groupchat_jids: + who = self.groupchat_jids[id_] + del self.groupchat_jids[id_] + else: + who = helpers.get_full_jid_from_iq(iq_obj) + jid_stripped, resource = gajim.get_room_and_nick_from_fjid(who) + if id_ in self.entity_time_ids: + self.entity_time_ids.remove(id_) + self.dispatch('ENTITY_TIME', (jid_stripped, resource, time_info)) + def _gMailNewMailCB(self, con, gm): '''Called when we get notified of new mail messages in gmail account''' if not self.connection or self.connected < 2: @@ -2543,6 +2591,8 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, common.xmpp.NS_LAST) con.RegisterHandler('iq', self._VersionResultCB, 'result', common.xmpp.NS_VERSION) + con.RegisterHandler('iq', self._TimeRevisedResultCB, 'result', + common.xmpp.NS_TIME_REVISED) con.RegisterHandler('iq', self._MucOwnerCB, 'result', common.xmpp.NS_MUC_OWNER) con.RegisterHandler('iq', self._MucAdminCB, 'result', diff --git a/src/gajim.py b/src/gajim.py index 6ec553dc0..544c3f6d0 100644 --- a/src/gajim.py +++ b/src/gajim.py @@ -1178,6 +1178,18 @@ class Interface: if self.remote_ctrl: self.remote_ctrl.raise_signal('OsInfo', (account, array)) + def handle_event_entity_time(self, account, array): + #'ENTITY_TIME' (account, (jid, resource, time_info)) + win = None + if array[0] in self.instances[account]['infos']: + win = self.instances[account]['infos'][array[0]] + elif array[0] + '/' + array[1] in self.instances[account]['infos']: + win = self.instances[account]['infos'][array[0] + '/' + array[1]] + if win: + win.set_entity_time(array[1], array[2]) + if self.remote_ctrl: + self.remote_ctrl.raise_signal('EntityTime', (account, array)) + def handle_event_gc_notify(self, account, array): #'GC_NOTIFY' (account, (room_jid, show, status, nick, # role, affiliation, jid, reason, actor, statusCode, newNick, avatar_sha)) @@ -2163,6 +2175,7 @@ class Interface: 'VCARD': self.handle_event_vcard, 'LAST_STATUS_TIME': self.handle_event_last_status_time, 'OS_INFO': self.handle_event_os_info, + 'ENTITY_TIME': self.handle_event_entity_time, 'GC_NOTIFY': self.handle_event_gc_notify, 'GC_MSG': self.handle_event_gc_msg, 'GC_SUBJECT': self.handle_event_gc_subject, diff --git a/src/remote_control.py b/src/remote_control.py index ccd01abfa..5135ca2e1 100644 --- a/src/remote_control.py +++ b/src/remote_control.py @@ -171,6 +171,10 @@ class SignalObject(dbus.service.Object): def OsInfo(self, account_and_array): pass + @dbus.service.signal(INTERFACE, signature='av') + def EntityTime(self, account_and_array): + pass + @dbus.service.signal(INTERFACE, signature='av') def GCPresence(self, account_and_array): pass diff --git a/src/vcard.py b/src/vcard.py index f3f639a30..06c4bbb89 100644 --- a/src/vcard.py +++ b/src/vcard.py @@ -112,6 +112,7 @@ class VcardWindow: self.avatar_encoded = None self.vcard_arrived = False self.os_info_arrived = False + self.entity_time_arrived = False self.update_progressbar_timeout_id = gobject.timeout_add(100, self.update_progressbar) @@ -215,7 +216,7 @@ class VcardWindow: def test_remove_progressbar(self): if self.update_progressbar_timeout_id is not None and \ - self.vcard_arrived and self.os_info_arrived: + self.vcard_arrived and self.os_info_arrived and self.entity_time_arrived: gobject.source_remove(self.update_progressbar_timeout_id) self.progressbar.hide() self.update_progressbar_timeout_id = None @@ -250,6 +251,26 @@ class VcardWindow: self.os_info_arrived = True self.test_remove_progressbar() + def set_entity_time(self, resource, time_info): + if self.xml.get_widget('information_notebook').get_n_pages() < 5: + return + i = 0 + time_s = '' + while i in self.time_info: + if not self.time_info[i]['resource'] or \ + self.time_info[i]['resource'] == resource: + self.time_info[i]['time'] = time_info + if i > 0: + time_s += '\n' + time_s += self.time_info[i]['time'] + i += 1 + + if time_s == '': + time_s = Q_('?Time:Unknown') + self.xml.get_widget('time_label').set_text(time_s) + self.entity_time_arrived = True + self.test_remove_progressbar() + def fill_status_label(self): if self.xml.get_widget('information_notebook').get_n_pages() < 5: return @@ -364,8 +385,25 @@ class VcardWindow: else: gobject.idle_add(gajim.connections[self.account].request_os_info, self.contact.jid, self.contact.resource) + + # do not wait for entity_time if contact is not connected or has error + # additional check for observer is needed, as show is offline for him + if self.contact.show in ('offline', 'error')\ + and not self.contact.is_observer(): + self.entity_time_arrived = True + else: # Request entity time if contact is connected + if self.gc_contact: + j, r = gajim.get_room_and_nick_from_fjid(self.real_jid) + gobject.idle_add(gajim.connections[self.account].\ + request_entity_time, j, r, self.contact.jid) + else: + gobject.idle_add(gajim.connections[self.account].\ + request_entity_time, self.contact.jid, self.contact.resource) + + self.os_info = {0: {'resource': self.contact.resource, 'client': '', 'os': ''}} + self.time_info = {0: {'resource': self.contact.resource, 'time': ''}} i = 1 contact_list = gajim.contacts.get_contacts(self.account, self.contact.jid) if contact_list: @@ -379,11 +417,15 @@ class VcardWindow: gobject.idle_add( gajim.connections[self.account].request_os_info, c.jid, c.resource) + gobject.idle_add(gajim.connections[self.account].\ + request_entity_time, c.jid, c.resource) gajim.connections[self.account].request_last_status_time(c.jid, c.resource) self.os_info[i] = {'resource': c.resource, 'client': '', 'os': ''} + self.time_info[i] = {'resource': c.resource, 'time': ''} i += 1 + self.xml.get_widget('resource_prio_label').set_text(resources) resource_prio_label_eventbox = self.xml.get_widget( 'resource_prio_label_eventbox')