File: ComponentExample.tcl

package info (click to toggle)
coccinella 0.96.20-9
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 13,184 kB
  • sloc: tcl: 124,744; xml: 206; makefile: 66; sh: 62
file content (47 lines) | stat: -rw-r--r-- 1,409 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# ComponentExample.tcl --
# 
#       Demo of some of the functionality for components.
#       This is just a first sketch.

namespace eval ::ComponentExample {
    
    component::define ComponentExample  \
      "This is justa dummy example of the component mechanism."
}

proc ::ComponentExample::Init { } {

    ::Debug 2 "::ComponentExample::Init"
    
    set menuspec {
	command {More Junk...} ::ComponentExample::Cmd  {} {}
    }
    set mDef [list command "Plugin Junk" [namespace current]::Cmd]
    set mType {"Plugin Junk" user}
    
    ::WB::RegisterNewMenu junk "Mats Junk" $menuspec
    ::WB::RegisterMenuEntry file $menuspec
    ::JUI::RegisterMenuEntry action $menuspec
    ::JUI::RegisterMenuEntry file $menuspec
    ::Roster::RegisterPopupEntry $mDef $mType
    
    ::hooks::register jabberInitHook  ::ComponentExample::JabberInitHook

    component::register ComponentExample
}

proc ::ComponentExample::JabberInitHook {jlibname} {
    
    set xmlnsj "http://jabber.org/protocol/jingle"
    set subtags [list [wrapper::createtag "feature" \
      -attrlist [list var $xmlnsj]]]    
    $jlibname caps register jingle $subtags $xmlnsj
}

proc ::ComponentExample::Cmd { } {    

    tk_messageBox -type yesno -icon info -title "Component Example" \
      -message "Hi, do you expect more fun than this?" 
}

#-------------------------------------------------------------------------------