Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
l-n-s
gajim
Commits
d8b7e228
Commit
d8b7e228
authored
21 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
add and remove contacts
parent
4593339e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
core/core.py
+21
-2
21 additions, 2 deletions
core/core.py
plugins/gtkgui.glade
+260
-8
260 additions, 8 deletions
plugins/gtkgui.glade
plugins/gtkgui.py
+62
-15
62 additions, 15 deletions
plugins/gtkgui.py
with
343 additions
and
25 deletions
core/core.py
+
21
−
2
View file @
d8b7e228
...
...
@@ -48,10 +48,10 @@ class GajimCore:
# END messageCB
def
presenceCB
(
self
,
con
,
prs
):
log
.
debug
(
"
PresenceCB
"
)
who
=
str
(
prs
.
getFrom
())
type
=
prs
.
getType
()
if
type
==
None
:
type
=
'
available
'
log
.
debug
(
"
PresenceCB : %s
"
%
type
)
if
type
==
'
available
'
:
if
prs
.
getShow
():
show
=
prs
.
getShow
()
...
...
@@ -59,9 +59,17 @@ class GajimCore:
show
=
'
online
'
self
.
hub
.
sendPlugin
(
'
NOTIFY
'
,
\
(
prs
.
getFrom
().
getBasic
(),
show
,
prs
.
getStatus
()))
if
type
==
'
unavailable
'
:
el
if
type
==
'
unavailable
'
:
self
.
hub
.
sendPlugin
(
'
NOTIFY
'
,
\
(
prs
.
getFrom
().
getBasic
(),
'
offline
'
,
prs
.
getStatus
()))
elif
type
==
'
subscribe
'
:
log
.
debug
(
"
subscribe request from %s
"
%
who
)
elif
type
==
'
subscribed
'
:
log
.
debug
(
"
we are now subscribed to %s
"
%
who
)
elif
type
==
'
unsubscribe
'
:
log
.
debug
(
"
unsubscribe request from %s
"
%
who
)
elif
type
==
'
unsubscribed
'
:
log
.
debug
(
"
we are now unsubscribed to %s
"
%
who
)
# END presenceCB
...
...
@@ -113,6 +121,7 @@ class GajimCore:
if
self
.
connected
==
1
:
self
.
con
.
disconnect
()
return
#('STATUS', status)
elif
ev
[
0
]
==
'
STATUS
'
:
if
(
ev
[
1
]
!=
'
offline
'
)
and
(
self
.
connected
==
0
):
self
.
connect
()
...
...
@@ -124,10 +133,20 @@ class GajimCore:
p
=
common
.
jabber
.
Presence
()
p
.
setShow
(
ev
[
1
])
self
.
con
.
send
(
p
)
#('MSG', (jid, msg))
elif
ev
[
0
]
==
'
MSG
'
:
msg
=
common
.
jabber
.
Message
(
ev
[
1
][
0
],
ev
[
1
][
1
])
msg
.
setType
(
'
chat
'
)
self
.
con
.
send
(
msg
)
#('SUB', (jid, txt))
elif
ev
[
0
]
==
'
SUB
'
:
log
.
debug
(
'
subscription request for %s
'
%
ev
[
1
][
0
])
self
.
con
.
send
(
common
.
jabber
.
Presence
(
ev
[
1
][
0
],
'
subscribe
'
))
#('UNSUB', jid)
elif
ev
[
0
]
==
'
UNSUB
'
:
self
.
con
.
send
(
common
.
jabber
.
Presence
(
ev
[
1
],
'
unsubscribe
'
))
else
:
log
.
debug
(
"
Unknown Command
"
)
elif
self
.
connected
==
1
:
self
.
con
.
process
(
1
)
time
.
sleep
(
0.1
)
...
...
This diff is collapsed.
Click to expand it.
plugins/gtkgui.glade
+
260
−
8
View file @
d8b7e228
...
...
@@ -2,6 +2,7 @@
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<requires
lib=
"gnome"
/>
<widget
class=
"GtkWindow"
id=
"Gajim"
>
<property
name=
"visible"
>
True
</property>
...
...
@@ -39,7 +40,7 @@
<property
name=
"use_underline"
>
True
</property>
<child
internal-child=
"image"
>
<widget
class=
"GtkImage"
id=
"image
23
"
>
<widget
class=
"GtkImage"
id=
"image
51
"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"stock"
>
gtk-convert
</property>
<property
name=
"icon_size"
>
1
</property>
...
...
@@ -54,10 +55,10 @@
<widget
class=
"GtkMenu"
id=
"gajim_menu_menu"
>
<child>
<widget
class=
"Gtk
Image
MenuItem"
id=
"preferences"
>
<widget
class=
"GtkMenuItem"
id=
"preferences"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
>
gtk-preferences
</property>
<property
name=
"use_
stock
"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
gtk-preferences
</property>
<property
name=
"use_
underline
"
>
True
</property>
<signal
name=
"activate"
handler=
"on_preferences_activate"
last_modification_time=
"Wed, 22 Oct 2003 21:18:29 GMT"
/>
</widget>
</child>
...
...
@@ -70,7 +71,7 @@
<signal
name=
"activate"
handler=
"on_accounts_activate"
last_modification_time=
"Wed, 22 Oct 2003 21:18:21 GMT"
/>
<child
internal-child=
"image"
>
<widget
class=
"GtkImage"
id=
"image2
4
"
>
<widget
class=
"GtkImage"
id=
"image
5
2"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"stock"
>
gtk-select-color
</property>
<property
name=
"icon_size"
>
1
</property>
...
...
@@ -89,6 +90,33 @@
</widget>
</child>
<child>
<widget
class=
"GtkImageMenuItem"
id=
"add"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
Add
</property>
<property
name=
"use_underline"
>
True
</property>
<signal
name=
"activate"
handler=
"on_add_activate"
last_modification_time=
"Sun, 26 Oct 2003 17:26:34 GMT"
/>
<child
internal-child=
"image"
>
<widget
class=
"GtkImage"
id=
"image53"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"stock"
>
gtk-add
</property>
<property
name=
"icon_size"
>
1
</property>
<property
name=
"xalign"
>
0.5
</property>
<property
name=
"yalign"
>
0.5
</property>
<property
name=
"xpad"
>
0
</property>
<property
name=
"ypad"
>
0
</property>
</widget>
</child>
</widget>
</child>
<child>
<widget
class=
"GtkMenuItem"
id=
"separator1"
>
<property
name=
"visible"
>
True
</property>
</widget>
</child>
<child>
<widget
class=
"GtkImageMenuItem"
id=
"about"
>
<property
name=
"visible"
>
True
</property>
...
...
@@ -97,7 +125,7 @@
<signal
name=
"activate"
handler=
"on_about_activate"
last_modification_time=
"Fri, 03 Oct 2003 12:49:50 GMT"
/>
<child
internal-child=
"image"
>
<widget
class=
"GtkImage"
id=
"image
2
5"
>
<widget
class=
"GtkImage"
id=
"image5
4
"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"stock"
>
gtk-help
</property>
<property
name=
"icon_size"
>
1
</property>
...
...
@@ -113,9 +141,22 @@
<child>
<widget
class=
"GtkImageMenuItem"
id=
"quit"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
>
gtk-q
uit
</property>
<property
name=
"use_
stock
"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
_Q
uit
</property>
<property
name=
"use_
underline
"
>
True
</property>
<signal
name=
"activate"
handler=
"on_quit_activate"
last_modification_time=
"Fri, 03 Oct 2003 12:49:50 GMT"
/>
<accelerator
key=
"Q"
modifiers=
"GDK_CONTROL_MASK"
signal=
"activate"
/>
<child
internal-child=
"image"
>
<widget
class=
"GtkImage"
id=
"image55"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"stock"
>
gtk-quit
</property>
<property
name=
"icon_size"
>
1
</property>
<property
name=
"xalign"
>
0.5
</property>
<property
name=
"yalign"
>
0.5
</property>
<property
name=
"xpad"
>
0
</property>
<property
name=
"ypad"
>
0
</property>
</widget>
</child>
</widget>
</child>
</widget>
...
...
@@ -816,6 +857,7 @@ David Ferlier (david@yazzy.org)</property>
<property
name=
"label"
>
gtk-close
</property>
<property
name=
"use_stock"
>
True
</property>
<property
name=
"relief"
>
GTK_RELIEF_NORMAL
</property>
<signal
name=
"clicked"
handler=
"gtk_widget_destroy"
last_modification_time=
"Sun, 26 Oct 2003 20:45:42 GMT"
/>
</widget>
</child>
</widget>
...
...
@@ -1243,4 +1285,214 @@ David Ferlier (david@yazzy.org)</property>
</child>
</widget>
<widget
class=
"GtkWindow"
id=
"Add"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"title"
translatable=
"yes"
>
Add user
</property>
<property
name=
"type"
>
GTK_WINDOW_TOPLEVEL
</property>
<property
name=
"window_position"
>
GTK_WIN_POS_NONE
</property>
<property
name=
"modal"
>
False
</property>
<property
name=
"resizable"
>
True
</property>
<property
name=
"destroy_with_parent"
>
False
</property>
<child>
<widget
class=
"GtkVBox"
id=
"vbox8"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"homogeneous"
>
False
</property>
<property
name=
"spacing"
>
0
</property>
<child>
<widget
class=
"GtkHBox"
id=
"hbox11"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"homogeneous"
>
False
</property>
<property
name=
"spacing"
>
0
</property>
<child>
<widget
class=
"GtkLabel"
id=
"label17"
>
<property
name=
"width_request"
>
145
</property>
<property
name=
"height_request"
>
8
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
Send subscription to :
</property>
<property
name=
"use_underline"
>
False
</property>
<property
name=
"use_markup"
>
False
</property>
<property
name=
"justify"
>
GTK_JUSTIFY_RIGHT
</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"
>
True
</property>
</packing>
</child>
<child>
<widget
class=
"GtkEntry"
id=
"entry_who"
>
<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"
translatable=
"yes"
>
*
</property>
<property
name=
"activates_default"
>
False
</property>
</widget>
<packing>
<property
name=
"padding"
>
0
</property>
<property
name=
"expand"
>
True
</property>
<property
name=
"fill"
>
True
</property>
</packing>
</child>
</widget>
<packing>
<property
name=
"padding"
>
10
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
</packing>
</child>
<child>
<widget
class=
"GtkScrolledWindow"
id=
"scrolledwindow6"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"hscrollbar_policy"
>
GTK_POLICY_AUTOMATIC
</property>
<property
name=
"vscrollbar_policy"
>
GTK_POLICY_AUTOMATIC
</property>
<property
name=
"shadow_type"
>
GTK_SHADOW_NONE
</property>
<property
name=
"window_placement"
>
GTK_CORNER_TOP_LEFT
</property>
<child>
<widget
class=
"GtkTextView"
id=
"textview_sub"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"editable"
>
True
</property>
<property
name=
"justification"
>
GTK_JUSTIFY_LEFT
</property>
<property
name=
"wrap_mode"
>
GTK_WRAP_NONE
</property>
<property
name=
"cursor_visible"
>
True
</property>
<property
name=
"pixels_above_lines"
>
0
</property>
<property
name=
"pixels_below_lines"
>
0
</property>
<property
name=
"pixels_inside_wrap"
>
0
</property>
<property
name=
"left_margin"
>
0
</property>
<property
name=
"right_margin"
>
0
</property>
<property
name=
"indent"
>
0
</property>
<property
name=
"text"
translatable=
"yes"
>
I would like to add you to my contact list, please
</property>
</widget>
</child>
</widget>
<packing>
<property
name=
"padding"
>
0
</property>
<property
name=
"expand"
>
True
</property>
<property
name=
"fill"
>
True
</property>
</packing>
</child>
<child>
<widget
class=
"GtkHSeparator"
id=
"hseparator4"
>
<property
name=
"visible"
>
True
</property>
</widget>
<packing>
<property
name=
"padding"
>
10
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
</packing>
</child>
<child>
<widget
class=
"GtkHButtonBox"
id=
"hbuttonbox1"
>
<property
name=
"border_width"
>
10
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"layout_style"
>
GTK_BUTTONBOX_END
</property>
<property
name=
"spacing"
>
30
</property>
<child>
<widget
class=
"GtkButton"
id=
"button_sub"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_default"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"relief"
>
GTK_RELIEF_NORMAL
</property>
<signal
name=
"clicked"
handler=
"on_button_sub_clicked"
last_modification_time=
"Sun, 26 Oct 2003 21:38:59 GMT"
/>
<child>
<widget
class=
"GtkAlignment"
id=
"alignment7"
>
<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>
<child>
<widget
class=
"GtkHBox"
id=
"hbox10"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"homogeneous"
>
False
</property>
<property
name=
"spacing"
>
2
</property>
<child>
<widget
class=
"GtkImage"
id=
"image32"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"stock"
>
gtk-apply
</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=
"label16"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
Subscribe
</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>
<child>
<widget
class=
"GtkButton"
id=
"button11"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_default"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"label"
>
gtk-cancel
</property>
<property
name=
"use_stock"
>
True
</property>
<property
name=
"relief"
>
GTK_RELIEF_NORMAL
</property>
<signal
name=
"clicked"
handler=
"gtk_widget_destroy"
last_modification_time=
"Sun, 26 Oct 2003 20:52:16 GMT"
/>
</widget>
</child>
</widget>
<packing>
<property
name=
"padding"
>
0
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
This diff is collapsed.
Click to expand it.
plugins/gtkgui.py
+
62
−
15
View file @
d8b7e228
...
...
@@ -47,12 +47,33 @@ class user:
self
.
status
=
args
[
0
].
status
else
:
raise
TypeError
,
'
bad arguments
'
class
add
:
def
delete_event
(
self
,
widget
):
self
.
Wadd
.
destroy
()
def
on_subscribe
(
self
,
widget
):
who
=
self
.
xml
.
get_widget
(
"
entry_who
"
).
get_text
()
buf
=
self
.
xml
.
get_widget
(
"
textview_sub
"
).
get_buffer
()
start_iter
=
buf
.
get_start_iter
()
end_iter
=
buf
.
get_end_iter
()
txt
=
buf
.
get_text
(
start_iter
,
end_iter
,
0
)
self
.
r
.
req_sub
(
who
,
txt
)
self
.
delete_event
(
self
)
def
__init__
(
self
,
roster
):
self
.
r
=
roster
self
.
xml
=
gtk
.
glade
.
XML
(
'
plugins/gtkgui.glade
'
,
'
Add
'
)
self
.
Wadd
=
self
.
xml
.
get_widget
(
"
Add
"
)
self
.
xml
.
signal_connect
(
'
gtk_widget_destroy
'
,
self
.
delete_event
)
self
.
xml
.
signal_connect
(
'
on_button_sub_clicked
'
,
self
.
on_subscribe
)
class
about
:
def
delete_event
(
self
,
widget
):
self
.
window
.
destroy
()
self
.
Wabout
.
destroy
()
def
__init__
(
self
):
self
.
xml
=
gtk
.
glade
.
XML
(
'
plugins/gtkgui.glade
'
,
'
About
'
)
self
.
Wabout
=
self
.
xml
.
get_widget
(
"
About
"
)
self
.
xml
.
signal_connect
(
'
gtk_widget_destroy
'
,
self
.
delete_event
)
class
accounts
:
...
...
@@ -73,7 +94,7 @@ class message:
if
contact
:
self
.
convTxtBuffer
.
insert_with_tags_by_name
(
end_iter
,
'
<moi>
'
,
'
outgoing
'
)
else
:
self
.
convTxtBuffer
.
insert_with_tags_by_name
(
end_iter
,
'
<lui>
'
,
'
incoming
'
)
self
.
convTxtBuffer
.
insert_with_tags_by_name
(
end_iter
,
'
<lui>
'
,
'
incom
m
ing
'
)
self
.
convTxtBuffer
.
insert
(
end_iter
,
txt
+
'
\n
'
)
self
.
conversation
.
scroll_to_mark
(
\
self
.
convTxtBuffer
.
get_mark
(
'
end
'
),
0.1
,
0
,
0
,
0
)
...
...
@@ -104,12 +125,12 @@ class message:
self
.
message
=
self
.
xml
.
get_widget
(
'
message
'
)
self
.
conversation
=
self
.
xml
.
get_widget
(
'
conversation
'
)
self
.
convTxtBuffer
=
self
.
conversation
.
get_buffer
()
end_iter
=
self
.
convTxtBuffer
.
get_end_iter
()
end_iter
=
self
.
convTxtBuffer
.
get_end_iter
()
self
.
convTxtBuffer
.
create_mark
(
'
end
'
,
end_iter
,
0
)
self
.
window
.
show
()
self
.
xml
.
signal_connect
(
'
gtk_widget_destroy
'
,
self
.
delete_event
)
self
.
xml
.
signal_connect
(
'
on_msg_key_press_event
'
,
self
.
on_msg_key_press_event
)
self
.
tag
=
self
.
convTxtBuffer
.
create_tag
(
"
incoming
"
)
self
.
tag
=
self
.
convTxtBuffer
.
create_tag
(
"
incom
m
ing
"
)
color
=
self
.
cfgParser
.
GtkGui_inmsgcolor
if
not
color
:
color
=
red
self
.
tag
.
set_property
(
"
foreground
"
,
color
)
...
...
@@ -128,7 +149,7 @@ class roster:
for
u
in
self
.
l_contact
:
if
not
self
.
l_group
.
has_key
(
u
.
group
):
iterG
=
self
.
treestore
.
append
(
None
,
(
self
.
pixbufs
[
'
online
'
],
u
.
group
,
'
group
'
))
self
.
l_group
[
u
.
group
]
=
iterG
self
.
l_group
[
u
.
group
]
=
iterG
def
mkroster
(
self
,
tab
):
self
.
l_contact
=
[]
...
...
@@ -170,14 +191,13 @@ class roster:
u
.
status
=
status
return
1
def
mk_menu_c
(
self
,
event
):
def
mk_menu_c
(
self
,
event
,
iter
):
self
.
menu_c
=
gtk
.
Menu
()
item
=
gtk
.
MenuItem
(
"
user1
"
)
self
.
menu_c
.
append
(
item
)
item
=
gtk
.
MenuItem
(
"
user2
"
)
self
.
menu_c
.
append
(
item
)
item
=
gtk
.
MenuItem
(
"
user3
"
)
item
=
gtk
.
MenuItem
(
"
Remove
"
)
self
.
menu_c
.
append
(
item
)
item
.
connect
(
"
activate
"
,
self
.
on_req_usub
,
iter
)
# item = gtk.MenuItem("user2")
# self.menu_c.append(item)
self
.
menu_c
.
popup
(
None
,
None
,
None
,
event
.
button
,
event
.
time
)
self
.
menu_c
.
show_all
()
...
...
@@ -196,7 +216,6 @@ class roster:
if
(
event
.
button
==
3
)
&
(
event
.
type
==
gtk
.
gdk
.
BUTTON_PRESS
):
try
:
path
,
column
,
x
,
y
=
self
.
tree
.
get_path_at_pos
(
int
(
event
.
x
),
int
(
event
.
y
))
except
TypeError
:
return
iter
=
self
.
treestore
.
get_iter
(
path
)
...
...
@@ -204,13 +223,37 @@ class roster:
if
data
==
'
group
'
:
self
.
mk_menu_g
(
event
)
else
:
self
.
mk_menu_c
(
event
)
self
.
mk_menu_c
(
event
,
iter
)
return
gtk
.
TRUE
return
gtk
.
FALSE
def
on_req_usub
(
self
,
widget
,
iter
):
who
=
self
.
treestore
.
get_value
(
iter
,
1
)
print
"
on vire %s
"
%
who
self
.
queueOUT
.
put
((
'
UNSUB
'
,
who
))
for
u
in
self
.
l_contact
:
if
u
.
name
==
who
:
self
.
l_contact
.
remove
(
u
)
self
.
treestore
.
remove
(
iter
)
def
req_sub
(
self
,
who
,
txt
):
self
.
queueOUT
.
put
((
'
SUB
'
,
(
who
,
txt
)))
found
=
0
for
u
in
self
.
l_contact
:
if
u
.
name
==
who
:
found
=
1
if
found
==
0
:
user1
=
user
(
who
,
'
general
'
,
'
requested
'
,
'
requested
'
)
self
.
l_contact
.
append
(
user1
)
#TODO: ajouter un grp si necessaire
self
.
treestore
.
append
(
self
.
l_group
[
'
general
'
],
(
self
.
pixbufs
[
'
requested
'
],
who
,
'
requested
'
))
def
on_status_changed
(
self
,
widget
):
self
.
queueOUT
.
put
((
'
STATUS
'
,
widget
.
name
))
def
on_add
(
self
,
widget
):
window_add
=
add
(
self
)
def
on_about
(
self
,
widget
):
window_about
=
about
()
...
...
@@ -240,7 +283,10 @@ class roster:
self
.
treestore
=
gtk
.
TreeStore
(
gtk
.
gdk
.
Pixbuf
,
str
,
str
)
add_pixbuf
=
self
.
get_icon_pixbuf
(
gtk
.
STOCK_ADD
)
remove_pixbuf
=
self
.
get_icon_pixbuf
(
gtk
.
STOCK_REMOVE
)
self
.
pixbufs
=
{
"
online
"
:
add_pixbuf
,
"
away
"
:
remove_pixbuf
,
"
xa
"
:
remove_pixbuf
,
"
dnd
"
:
remove_pixbuf
,
"
offline
"
:
remove_pixbuf
}
requested_pixbuf
=
self
.
get_icon_pixbuf
(
gtk
.
STOCK_QUIT
)
self
.
pixbufs
=
{
"
online
"
:
add_pixbuf
,
"
away
"
:
remove_pixbuf
,
\
"
xa
"
:
remove_pixbuf
,
"
dnd
"
:
remove_pixbuf
,
"
offline
"
:
remove_pixbuf
,
\
"
requested
"
:
requested_pixbuf
}
self
.
tree
.
set_model
(
self
.
treestore
)
self
.
queueOUT
=
queueOUT
self
.
optionmenu
=
self
.
xml
.
get_widget
(
'
optionmenu
'
)
...
...
@@ -266,6 +312,7 @@ class roster:
#signals
self
.
xml
.
signal_connect
(
'
gtk_main_quit
'
,
self
.
on_quit
)
self
.
xml
.
signal_connect
(
'
on_accounts_activate
'
,
self
.
on_accounts
)
self
.
xml
.
signal_connect
(
'
on_add_activate
'
,
self
.
on_add
)
self
.
xml
.
signal_connect
(
'
on_about_activate
'
,
self
.
on_about
)
self
.
xml
.
signal_connect
(
'
on_quit_activate
'
,
self
.
on_quit
)
self
.
xml
.
signal_connect
(
'
on_treeview_event
'
,
self
.
on_treeview_event
)
...
...
@@ -277,7 +324,7 @@ class plugin:
def
read_queue
(
self
):
while
self
.
queueIN
.
empty
()
==
0
:
ev
=
self
.
queueIN
.
get
()
print
ev
#
print ev
if
ev
[
0
]
==
'
ROSTER
'
:
self
.
r
.
mkroster
(
ev
[
1
])
elif
ev
[
0
]
==
'
NOTIFY
'
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment