1# $Id$
2# Personal eventing via pubsub XEP-0163
3
4package require xmpp::pep
5
6namespace eval pep {
7
8    custom::defgroup Plugins \
9	[::msgcat::mc "Plugins options."] \
10	-group Tkabber
11
12    custom::defgroup PEP \
13	[::msgcat::mc "Personal eventing via pubsub plugins options."] \
14	-group Plugins
15}
16
17##########################################################################
18# Returns a name of a submenu (of menu $m) for PEP commands to perform on
19# the roster item for a user with JID $jid.
20# This command automatically creates this submenu if needed.
21
22proc pep::get_roster_menu_pep_submenu {m xlib jid} {
23    set pm $m.pep
24
25    if {![winfo exists $pm]} {
26	menu $pm -tearoff no
27	$m add cascade -menu $pm \
28		-label [::msgcat::mc "Personal eventing"]
29    }
30
31    return $pm
32}
33
34##########################################################################
35# Returns pathname of a frame comprising a page for PEP info in
36# the userinfo (vCard) dialog which notebook widget is $notebook.
37# If that page is not yet exist, it's created.
38
39proc pep::get_userinfo_dialog_pep_frame {notebook} {
40    if {[$notebook index PEP] < 0} {
41	return [$notebook insert end PEP \
42			-text [::msgcat::mc "Personal eventing"]]
43    } else {
44	return [$notebook getframe PEP]
45    }
46}
47
48proc pep::get_main_menu_pep_submenu {} {
49    return [.mainframe getmenu services].pep
50}
51
52proc pep::on_init {} {
53    set m [.mainframe getmenu services]
54    set idx [$m index [::msgcat::mc "Service Discovery"]]
55    set pm [menu $m.pep -tearoff $::ifacetk::options(show_tearoffs)]
56    $m insert [expr {$idx + 2}] cascade -menu $pm \
57	    -label [::msgcat::mc "Personal eventing"]
58}
59
60hook::add finload_hook [namespace current]::pep::on_init
61
62# vim:ts=8:sw=4:sts=4:noet
63