35
35
* POSSIBILITY OF SUCH DAMAGE.
36
36
*
37
37
*/
38
-
39
- if ($ argc < 3 ) {
40
- echo "Usage: $ argv [0 ] jid pass \n" ;
41
- exit ;
42
- }
43
-
44
- //
45
- // initialize JAXL object with initial config
46
- //
47
- require_once 'jaxl.php ' ;
48
- $ client = new JAXL (array (
49
- 'jid ' => $ argv [1 ],
50
- 'pass ' => $ argv [2 ]
51
- ));
52
-
53
- $ client ->require_xep (array (
54
- '0060 ' // Publish-Subscribe
55
- ));
56
-
57
- //
58
- // add necessary event callbacks here
59
- //
60
-
61
- $ client ->add_cb ('on_auth_success ' , function () {
62
- global $ client ;
63
- _debug ("got on_auth_success cb, jid " .$ client ->full_jid ->to_string ());
64
-
65
- // create node
66
- //$client->xeps['0060']->create_node('pubsub.localhost', 'dummy_node');
67
-
38
+
39
+ if ($ argc < 3 ) {
40
+ echo "Usage: $ argv [0 ] jid pass \n" ;
41
+ exit ;
42
+ }
43
+
44
+ //
45
+ // initialize JAXL object with initial config
46
+ //
47
+ require_once 'jaxl.php ' ;
48
+ $ client = new JAXL (array (
49
+ 'jid ' => $ argv [1 ],
50
+ 'pass ' => $ argv [2 ]
51
+ ));
52
+
53
+ $ client ->require_xep (array (
54
+ '0060 ' // Publish-Subscribe
55
+ ));
56
+
57
+ //
58
+ // add necessary event callbacks here
59
+ //
60
+
61
+ $ client ->add_cb ('on_auth_success ' , function () {
62
+ global $ client ;
63
+ _debug ("got on_auth_success cb, jid " .$ client ->full_jid ->to_string ());
64
+
65
+ // create node
66
+ //$client->xeps['0060']->create_node('pubsub.localhost', 'dummy_node');
67
+
68
68
// publish
69
69
$ item = new JAXLXml ('item ' , null );
70
70
$ item ->c ('entry ' , 'http://www.w3.org/2005/Atom ' );
73
73
$ item ->c ('link ' , null , array ('rel ' =>'alternate ' , 'type ' =>'text/html ' , 'href ' =>'http://denmark.lit/2003/12/13/atom03 ' ))->up ();
74
74
$ item ->c ('id ' )->t ('tag:denmark.lit,2003:entry-32397 ' )->up ();
75
75
$ item ->c ('published ' )->t ('2003-12-13T18:30:02Z ' )->up ();
76
- $ item ->c ('updated ' )->t ('2003-12-13T18:30:02Z ' )->up ();
77
- $ client ->xeps ['0060 ' ]->publish_item ('pubsub.localhost ' , 'dummy_node ' , $ item );
78
- });
79
-
80
- $ client ->add_cb ('on_auth_failure ' , function ($ reason ) {
81
- global $ client ;
82
- $ client ->send_end_stream ();
83
- _debug ("got on_auth_failure cb with reason $ reason " );
84
- });
85
-
86
- $ client ->add_cb ('on_disconnect ' , function () {
87
- _debug ("got on_disconnect cb " );
88
- });
89
-
90
- //
91
- // finally start configured xmpp stream
92
- //
93
- $ client ->start ();
76
+ $ item ->c ('updated ' )->t ('2003-12-13T18:30:02Z ' )->up ();
77
+ $ client ->xeps ['0060 ' ]->publish_item ('pubsub.localhost ' , 'dummy_node ' , $ item );
78
+ });
79
+
80
+ $ client ->add_cb ('on_auth_failure ' , function ($ reason ) {
81
+ global $ client ;
82
+ $ client ->send_end_stream ();
83
+ _debug ("got on_auth_failure cb with reason $ reason " );
84
+ });
85
+
86
+ $ client ->add_cb ('on_disconnect ' , function () {
87
+ _debug ("got on_disconnect cb " );
88
+ });
89
+
90
+ //
91
+ // finally start configured xmpp stream
92
+ //
93
+ $ client ->start ();
94
94
echo "done \n" ;
95
95
96
- ?>
96
+ ?>
0 commit comments