strophe_ruby 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.autotest ADDED
@@ -0,0 +1,9 @@
1
+ Autotest.add_hook :initialize do |at|
2
+ at.add_mapping(/ext\/.*\/(.*)\.[ch]/) do |_, m|
3
+ ["test/test_#{m[1]}_extn.rb"]
4
+ end
5
+ end
6
+
7
+ Autotest.add_hook :run_command do |at|
8
+ system "rake compile"
9
+ end
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ == 0.0.1 2008-12-05
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
data/Manifest.txt ADDED
@@ -0,0 +1,24 @@
1
+ .autotest
2
+ History.txt
3
+ Manifest.txt
4
+ PostInstall.txt
5
+ README.rdoc
6
+ Rakefile
7
+ ext/strophe_ruby/extconf.rb
8
+ ext/strophe_ruby/libexpat.a
9
+ ext/strophe_ruby/libstrophe.a
10
+ ext/strophe_ruby/strophe.h
11
+ ext/strophe_ruby/strophe/common.h
12
+ ext/strophe_ruby/strophe/hash.h
13
+ ext/strophe_ruby/strophe/sock.h
14
+ ext/strophe_ruby/strophe/tls.h
15
+ ext/strophe_ruby/strophe_ruby.c
16
+ lib/strophe_ruby.rb
17
+ script/console
18
+ script/destroy
19
+ script/generate
20
+ tasks/extconf.rake
21
+ tasks/extconf/strophe_ruby.rake
22
+ test/test_helper.rb
23
+ test/test_strophe_ruby.rb
24
+ test/test_strophe_ruby_extn.rb
data/PostInstall.txt ADDED
@@ -0,0 +1,7 @@
1
+
2
+ For more information on strophe_ruby, see http://strophe_ruby.rubyforge.org
3
+
4
+ NOTE: Change this information in PostInstall.txt
5
+ You can also delete it if you don't want it.
6
+
7
+
data/README.rdoc ADDED
@@ -0,0 +1,152 @@
1
+ = strophe_ruby
2
+
3
+ * http://stropheruby.rubyforge.org
4
+
5
+ == DESCRIPTION:
6
+
7
+ Ruby bindings for Strophe 'http://code.stanziq.com/strophe/', a C library for
8
+ writing XMPP clients. If all you need is a simple XMPP bot that
9
+ react to message and presence notifications, you might be better off
10
+ with XMPPBot, which is an implementation I wrote on top of StropheRuby.
11
+
12
+ IMPORTANT : This gem is quite experimental currently... it is not ready
13
+ for production!
14
+
15
+ Strophe 'http://code.stanziq.com/strophe/' is a robust and well written
16
+ C library that allows the developer to implement XMPP clients.
17
+
18
+ I wanted to be able to use the power of this library with the ruby
19
+ syntax. I didn't use SWIG to generate the bindings for 2 reasons :
20
+
21
+ 1. I wanted to learn how to write a C extension for ruby
22
+ 2. I didn't like how SWIG generate gazilions of lines of code
23
+
24
+ My other project, XMPPBot, is an implementation of Strophe Ruby that
25
+ allows the ruby developer to write a XMPP bot in a few lines of code.
26
+
27
+ License: GNU General Public License (GPL)
28
+
29
+ == FEATURES/PROBLEMS:
30
+
31
+ - Currently no Support for TLS
32
+
33
+ == SYNOPSIS:
34
+
35
+ require 'strophe_ruby'
36
+ def announce_presence
37
+ presence = StropheRuby::Stanza.new
38
+ presence.name="presence"
39
+ presence.set_attribute("show", "available")
40
+ @conn.send(presence)
41
+ end
42
+
43
+ def register_callbacks
44
+ @conn.add_handler("presence") do |pres|
45
+ if pres.type == "subscribe"
46
+
47
+ #We accept everyone
48
+ stanza = StropheRuby::Stanza.new
49
+ stanza.name = "presence"
50
+ stanza.type = "subscribed"
51
+ stanza.set_attribute("to",pres.attribute("from"))
52
+
53
+ @conn.send(stanza)
54
+
55
+ #Now it's our turn to send a subscription request
56
+ stanza = StropheRuby::Stanza.new
57
+ stanza.name = "presence"
58
+ stanza.type = "subscribe"
59
+ stanza.set_attribute("to",pres.attribute("from"))
60
+ @conn.send(stanza)
61
+
62
+ end
63
+ end
64
+
65
+ #Echo every messages
66
+ @conn.add_handler("message") do |msg|
67
+ body=msg.child_by_name("body")
68
+ if body
69
+ if body.text.to_s == "exit"
70
+ disconnect
71
+ else
72
+ stanza = StropheRuby::Stanza.new
73
+ stanza.name = "message"
74
+ stanza.set_attribute("to",msg.attribute("from"))
75
+
76
+ body_stanza = StropheRuby::Stanza.new
77
+ body_stanza.name="body"
78
+
79
+ text_stanza = StropheRuby::Stanza.new
80
+ text_stanza.text="I'm very happy for you"
81
+
82
+ body_stanza.add_child(text_stanza)
83
+ stanza.add_child(body_stanza)
84
+
85
+ @conn.send(stanza)
86
+ end
87
+ end
88
+ end
89
+ end
90
+
91
+ StropheRuby::EventLoop.prepare
92
+
93
+ @ctx = StropheRuby::Context.new(StropheRuby::Logging::DEBUG)
94
+ @conn = StropheRuby::Connection.new(@ctx)
95
+
96
+ @conn.jid = "bot@example.com"
97
+ @conn.password = "secret"
98
+
99
+ @conn.connect do |status|
100
+ if status == StropheRuby::ConnectionEvents::CONNECT
101
+ announce_presence
102
+ register_callbacks
103
+ else
104
+ StropheRuby::EventLoop.stop(@ctx)
105
+ end
106
+ end
107
+
108
+ def disconnect
109
+ StropheRuby::EventLoop.stop(@ctx)
110
+ end
111
+
112
+
113
+ #This is a blocking call
114
+ StropheRuby::EventLoop.run(@ctx)
115
+
116
+ #Once the loop has exit, we can shutdown strophe
117
+ StropheRuby::EventLoop.shutdown
118
+ puts "Program has ended normally"
119
+ exit
120
+
121
+ == REQUIREMENTS:
122
+
123
+ * Coming soon...
124
+
125
+ == INSTALL:
126
+
127
+ * Coming soon...
128
+
129
+ == LICENSE:
130
+
131
+ (The MIT License)
132
+
133
+ Copyright (c) 2008 François Lamontagne
134
+
135
+ Permission is hereby granted, free of charge, to any person obtaining
136
+ a copy of this software and associated documentation files (the
137
+ 'Software'), to deal in the Software without restriction, including
138
+ without limitation the rights to use, copy, modify, merge, publish,
139
+ distribute, sublicense, and/or sell copies of the Software, and to
140
+ permit persons to whom the Software is furnished to do so, subject to
141
+ the following conditions:
142
+
143
+ The above copyright notice and this permission notice shall be
144
+ included in all copies or substantial portions of the Software.
145
+
146
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
147
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
148
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
149
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
150
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
151
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
152
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
2
+ #require File.dirname(__FILE__) + '/lib/strophe_ruby'
3
+
4
+ # Generate all the Rake tasks
5
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
6
+ $hoe = Hoe.new('strophe_ruby', '0.0.1') do |p|
7
+ p.developer('François Lamontagne', 'flamontagne@gmail.com')
8
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
9
+ p.rubyforge_name = p.name # TODO this is default value
10
+ # p.extra_dev_deps = [
11
+ # ['newgem', ">= #{::Newgem::VERSION}"]
12
+ # ]
13
+
14
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
15
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
16
+ p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
17
+ p.rsync_args = '-av --delete --ignore-errors'
18
+ end
19
+
20
+ require 'newgem/tasks' # load /tasks/*.rake
21
+ Dir['tasks/**/*.rake'].each { |t| load t }
22
+
23
+ task :default => :compile
@@ -0,0 +1,7 @@
1
+ require 'mkmf'
2
+ dir_config("expat")
3
+ have_library("expat")
4
+ dir_config("strophe")
5
+ have_library("strophe")
6
+ have_library("resolv")
7
+ create_makefile("strophe_ruby")
Binary file
Binary file
@@ -0,0 +1,363 @@
1
+ /* strophe.h
2
+ ** strophe XMPP client library C API
3
+ **
4
+ ** Copyright (C) 2005-2008 OGG, LLC.
5
+ **
6
+ ** This software is provided AS-IS with no warranty, either express or
7
+ ** implied.
8
+ **
9
+ ** This software is distributed under license and may not be copied,
10
+ ** modified or distributed except as expressly authorized under the
11
+ ** terms of the license contained in the file LICENSE.txt in this
12
+ ** distribution.
13
+ */
14
+
15
+ /** @file
16
+ * Strophe public C API definitions.
17
+ */
18
+
19
+ #ifndef __LIBSTROPHE_STROPHE_H__
20
+ #define __LIBSTROPHE_STROPHE_H__
21
+
22
+ #ifdef __cplusplus
23
+ extern "C" {
24
+ #endif
25
+
26
+ #include <stdio.h>
27
+
28
+ /* namespace defines */
29
+ /** @def XMPP_NS_CLIENT
30
+ * Namespace definition for 'jabber:client'.
31
+ */
32
+ #define XMPP_NS_CLIENT "jabber:client"
33
+ /** @def XMPP_NS_COMPONENT
34
+ * Namespace definition for 'jabber:component:accept'.
35
+ */
36
+ #define XMPP_NS_COMPONENT "jabber:component:accept"
37
+ /** @def XMPP_NS_STREAMS
38
+ * Namespace definition for 'http://etherx.jabber.org/streams'.
39
+ */
40
+ #define XMPP_NS_STREAMS "http://etherx.jabber.org/streams"
41
+ /** @def XMPP_NS_STREAMS_IETF
42
+ * Namespace definition for 'urn:ietf:params:xml:ns:xmpp-streams'.
43
+ */
44
+ #define XMPP_NS_STREAMS_IETF "urn:ietf:params:xml:ns:xmpp-streams"
45
+ /** @def XMPP_NS_TLS
46
+ * Namespace definition for 'url:ietf:params:xml:ns:xmpp-tls'.
47
+ */
48
+ #define XMPP_NS_TLS "urn:ietf:params:xml:ns:xmpp-tls"
49
+ /** @def XMPP_NS_SASL
50
+ * Namespace definition for 'urn:ietf:params:xml:ns:xmpp-sasl'.
51
+ */
52
+ #define XMPP_NS_SASL "urn:ietf:params:xml:ns:xmpp-sasl"
53
+ /** @def XMPP_NS_BIND
54
+ * Namespace definition for 'urn:ietf:params:xml:ns:xmpp-bind'.
55
+ */
56
+ #define XMPP_NS_BIND "urn:ietf:params:xml:ns:xmpp-bind"
57
+ /** @def XMPP_NS_SESSION
58
+ * Namespace definition for 'urn:ietf:params:xml:ns:xmpp-session'.
59
+ */
60
+ #define XMPP_NS_SESSION "urn:ietf:params:xml:ns:xmpp-session"
61
+ /** @def XMPP_NS_AUTH
62
+ * Namespace definition for 'jabber:iq:auth'.
63
+ */
64
+ #define XMPP_NS_AUTH "jabber:iq:auth"
65
+ /** @def XMPP_NS_DISCO_INFO
66
+ * Namespace definition for 'http://jabber.org/protocol/disco#info'.
67
+ */
68
+ #define XMPP_NS_DISCO_INFO "http://jabber.org/protocol/disco#info"
69
+ /** @def XMPP_NS_DISCO_ITEMS
70
+ * Namespace definition for 'http://jabber.org/protocol/disco#items'.
71
+ */
72
+ #define XMPP_NS_DISCO_ITEMS "http://jabber.org/protocol/disco#items"
73
+ /** @def XMPP_NS_ROSTER
74
+ * Namespace definition for 'jabber:iq:roster'.
75
+ */
76
+ #define XMPP_NS_ROSTER "jabber:iq:roster"
77
+
78
+ /* error defines */
79
+ /** @def XMPP_EOK
80
+ * Success error code.
81
+ */
82
+ #define XMPP_EOK 0
83
+ /** @def XMPP_EMEM
84
+ * Memory related failure error code.
85
+ *
86
+ * This is returned on allocation errors and signals that the host may
87
+ * be out of memory.
88
+ */
89
+ #define XMPP_EMEM -1
90
+ /** @def XMPP_EINVOP
91
+ * Invalid operation error code.
92
+ *
93
+ * This error code is returned when the operation was invalid and signals
94
+ * that the Strophe API is being used incorrectly.
95
+ */
96
+ #define XMPP_EINVOP -2
97
+ /** @def XMPP_EINT
98
+ * Internal failure error code.
99
+ */
100
+ #define XMPP_EINT -3
101
+
102
+ /* initialization and shutdown */
103
+ void xmpp_initialize(void);
104
+ void xmpp_shutdown(void);
105
+
106
+ /* version */
107
+ int xmpp_version_check(int major, int minor);
108
+
109
+ /* run-time contexts */
110
+
111
+ /* user-replaceable memory allocator */
112
+ typedef struct _xmpp_mem_t xmpp_mem_t;
113
+
114
+ /* user-replaceable log object */
115
+ typedef struct _xmpp_log_t xmpp_log_t;
116
+
117
+ /* opaque run time context containing the above hooks */
118
+ typedef struct _xmpp_ctx_t xmpp_ctx_t;
119
+
120
+ xmpp_ctx_t *xmpp_ctx_new(const xmpp_mem_t * const mem,
121
+ const xmpp_log_t * const log);
122
+ void xmpp_ctx_free(xmpp_ctx_t * const ctx);
123
+
124
+ struct _xmpp_mem_t {
125
+ void *(*alloc)(const size_t size, void * const userdata);
126
+ void (*free)(void *p, void * const userdata);
127
+ void *(*realloc)(void *p, const size_t size, void * const userdata);
128
+ void *userdata;
129
+ };
130
+
131
+ typedef enum {
132
+ XMPP_LEVEL_DEBUG,
133
+ XMPP_LEVEL_INFO,
134
+ XMPP_LEVEL_WARN,
135
+ XMPP_LEVEL_ERROR
136
+ } xmpp_log_level_t;
137
+
138
+ typedef enum {
139
+ XMPP_UNKNOWN,
140
+ XMPP_CLIENT,
141
+ XMPP_COMPONENT
142
+ } xmpp_conn_type_t;
143
+
144
+ typedef void (*xmpp_log_handler)(void * const userdata,
145
+ const xmpp_log_level_t level,
146
+ const char * const area,
147
+ const char * const msg);
148
+
149
+ struct _xmpp_log_t {
150
+ xmpp_log_handler handler;
151
+ void *userdata;
152
+ /* mutex_t lock; */
153
+ };
154
+
155
+ /* return a default logger filtering at a given level */
156
+ xmpp_log_t *xmpp_get_default_logger(xmpp_log_level_t level);
157
+
158
+ /* connection */
159
+
160
+ /* opaque connection object */
161
+ typedef struct _xmpp_conn_t xmpp_conn_t;
162
+ typedef struct _xmpp_stanza_t xmpp_stanza_t;
163
+
164
+ /* connect callback */
165
+ typedef enum {
166
+ XMPP_CONN_CONNECT,
167
+ XMPP_CONN_DISCONNECT,
168
+ XMPP_CONN_FAIL
169
+ } xmpp_conn_event_t;
170
+
171
+ typedef enum {
172
+ XMPP_SE_BAD_FORMAT,
173
+ XMPP_SE_BAD_NS_PREFIX,
174
+ XMPP_SE_CONFLICT,
175
+ XMPP_SE_CONN_TIMEOUT,
176
+ XMPP_SE_HOST_GONE,
177
+ XMPP_SE_HOST_UNKNOWN,
178
+ XMPP_SE_IMPROPER_ADDR,
179
+ XMPP_SE_INTERNAL_SERVER_ERROR,
180
+ XMPP_SE_INVALID_FROM,
181
+ XMPP_SE_INVALID_ID,
182
+ XMPP_SE_INVALID_NS,
183
+ XMPP_SE_INVALID_XML,
184
+ XMPP_SE_NOT_AUTHORIZED,
185
+ XMPP_SE_POLICY_VIOLATION,
186
+ XMPP_SE_REMOTE_CONN_FAILED,
187
+ XMPP_SE_RESOURCE_CONSTRAINT,
188
+ XMPP_SE_RESTRICTED_XML,
189
+ XMPP_SE_SEE_OTHER_HOST,
190
+ XMPP_SE_SYSTEM_SHUTDOWN,
191
+ XMPP_SE_UNDEFINED_CONDITION,
192
+ XMPP_SE_UNSUPPORTED_ENCODING,
193
+ XMPP_SE_UNSUPPORTED_STANZA_TYPE,
194
+ XMPP_SE_UNSUPPORTED_VERSION,
195
+ XMPP_SE_XML_NOT_WELL_FORMED
196
+ } xmpp_error_type_t;
197
+
198
+ typedef struct {
199
+ xmpp_error_type_t type;
200
+ char *text;
201
+ xmpp_stanza_t *stanza;
202
+ } xmpp_stream_error_t;
203
+
204
+ typedef void (*xmpp_conn_handler)(xmpp_conn_t * const conn,
205
+ const xmpp_conn_event_t event,
206
+ const int error,
207
+ xmpp_stream_error_t * const stream_error,
208
+ void * const userdata);
209
+
210
+ xmpp_conn_t *xmpp_conn_new(xmpp_ctx_t * const ctx);
211
+ xmpp_conn_t * xmpp_conn_clone(xmpp_conn_t * const conn);
212
+ int xmpp_conn_release(xmpp_conn_t * const conn);
213
+
214
+ const char *xmpp_conn_get_jid(const xmpp_conn_t * const conn);
215
+ void xmpp_conn_set_jid(xmpp_conn_t * const conn, const char * const jid);
216
+ const char *xmpp_conn_get_pass(const xmpp_conn_t * const conn);
217
+ void xmpp_conn_set_pass(xmpp_conn_t * const conn, const char * const pass);
218
+ xmpp_ctx_t* xmpp_conn_get_context(xmpp_conn_t * const conn);
219
+
220
+ int xmpp_connect_client(xmpp_conn_t * const conn,
221
+ const char * const altdomain,
222
+ unsigned short altport,
223
+ xmpp_conn_handler callback,
224
+ void * const userdata);
225
+
226
+ /*
227
+ int xmpp_connect_component(conn, name)
228
+ */
229
+ void xmpp_disconnect(xmpp_conn_t * const conn);
230
+
231
+ void xmpp_send(xmpp_conn_t * const conn,
232
+ xmpp_stanza_t * const stanza);
233
+
234
+
235
+ /* handlers */
236
+
237
+ /* if the handle returns false it is removed */
238
+ typedef int (*xmpp_timed_handler)(xmpp_conn_t * const conn,
239
+ void * const userdata);
240
+
241
+ void xmpp_timed_handler_add(xmpp_conn_t * const conn,
242
+ xmpp_timed_handler handler,
243
+ const unsigned long period,
244
+ void * const userdata);
245
+ void xmpp_timed_handler_delete(xmpp_conn_t * const conn,
246
+ xmpp_timed_handler handler);
247
+
248
+
249
+ /* if the handler returns false it is removed */
250
+ typedef int (*xmpp_handler)(xmpp_conn_t * const conn,
251
+ xmpp_stanza_t * const stanza,
252
+ void * const userdata);
253
+
254
+ void xmpp_handler_add(xmpp_conn_t * const conn,
255
+ xmpp_handler handler,
256
+ const char * const ns,
257
+ const char * const name,
258
+ const char * const type,
259
+ void * const userdata);
260
+ void xmpp_handler_delete(xmpp_conn_t * const conn,
261
+ xmpp_handler handler);
262
+
263
+ void xmpp_id_handler_add(xmpp_conn_t * const conn,
264
+ xmpp_handler handler,
265
+ const char * const id,
266
+ void * const userdata);
267
+ void xmpp_id_handler_delete(xmpp_conn_t * const conn,
268
+ xmpp_handler handler,
269
+ const char * const id);
270
+
271
+ /*
272
+ void xmpp_register_stanza_handler(conn, stanza, xmlns, type, handler)
273
+ */
274
+
275
+ /** stanzas **/
276
+
277
+ /** allocate an initialize a blank stanza */
278
+ xmpp_stanza_t *xmpp_stanza_new(xmpp_ctx_t *ctx);
279
+
280
+ /** clone a stanza */
281
+ xmpp_stanza_t *xmpp_stanza_clone(xmpp_stanza_t * const stanza);
282
+
283
+ /** copies a stanza and all children */
284
+ xmpp_stanza_t * xmpp_stanza_copy(const xmpp_stanza_t * const stanza);
285
+
286
+ /** free a stanza object and it's contents */
287
+ int xmpp_stanza_release(xmpp_stanza_t * const stanza);
288
+
289
+ int xmpp_stanza_is_text(xmpp_stanza_t * const stanza);
290
+ int xmpp_stanza_is_tag(xmpp_stanza_t * const stanza);
291
+
292
+ /** marshall a stanza into text for transmission or display **/
293
+ int xmpp_stanza_to_text(xmpp_stanza_t *stanza,
294
+ char ** const buf, size_t * const buflen);
295
+
296
+ xmpp_stanza_t *xmpp_stanza_get_children(xmpp_stanza_t * const stanza);
297
+ xmpp_stanza_t *xmpp_stanza_get_child_by_name(xmpp_stanza_t * const stanza,
298
+ const char * const name);
299
+ xmpp_stanza_t *xmpp_stanza_get_child_by_ns(xmpp_stanza_t * const stanza,
300
+ const char * const ns);
301
+ xmpp_stanza_t *xmpp_stanza_get_next(xmpp_stanza_t * const stanza);
302
+ char *xmpp_stanza_get_attribute(xmpp_stanza_t * const stanza,
303
+ const char * const name);
304
+ char * xmpp_stanza_get_ns(xmpp_stanza_t * const stanza);
305
+ /* concatenate all child text nodes. this function
306
+ * returns a string that must be freed by the caller */
307
+
308
+ char *xmpp_stanza_get_text(xmpp_stanza_t * const stanza);
309
+ char *xmpp_stanza_get_text_ptr(xmpp_stanza_t * const stanza);
310
+ char *xmpp_stanza_get_name(xmpp_stanza_t * const stanza);
311
+
312
+ int xmpp_stanza_add_child(xmpp_stanza_t *stanza, xmpp_stanza_t *child);
313
+ int xmpp_stanza_set_ns(xmpp_stanza_t * const stanza, const char * const ns);
314
+ /* set_attribute adds/replaces attributes */
315
+ int xmpp_stanza_set_attribute(xmpp_stanza_t * const stanza,
316
+ const char * const key,
317
+ const char * const value);
318
+ int xmpp_stanza_set_name(xmpp_stanza_t *stanza,
319
+ const char * const name);
320
+ int xmpp_stanza_set_text(xmpp_stanza_t *stanza,
321
+ const char * const text);
322
+ int xmpp_stanza_set_text_with_size(xmpp_stanza_t *stanza,
323
+ const char * const text,
324
+ const size_t size);
325
+
326
+ /* common stanza helpers */
327
+ char *xmpp_stanza_get_type(xmpp_stanza_t * const stanza);
328
+ char *xmpp_stanza_get_id(xmpp_stanza_t * const stanza);
329
+ int xmpp_stanza_set_id(xmpp_stanza_t * const stanza,
330
+ const char * const id);
331
+ int xmpp_stanza_set_type(xmpp_stanza_t * const stanza,
332
+ const char * const type);
333
+
334
+ /* unimplemented
335
+ int xmpp_stanza_set_to();
336
+ int xmpp_stanza_set_from();
337
+ */
338
+
339
+ /* allocate and initialize a stanza in reply to another */
340
+ /* unimplemented
341
+ xmpp_stanza_t *xmpp_stanza_reply(const xmpp_stanza_t *stanza);
342
+ */
343
+
344
+ /* stanza subclasses */
345
+ /* unimplemented
346
+ void xmpp_message_new();
347
+ void xmpp_message_get_body();
348
+ void xmpp_message_set_body();
349
+
350
+ void xmpp_iq_new();
351
+ void xmpp_presence_new();
352
+ */
353
+
354
+ /** event loop **/
355
+ void xmpp_run_once(xmpp_ctx_t *ctx, const unsigned long timeout);
356
+ void xmpp_run(xmpp_ctx_t *ctx);
357
+ void xmpp_stop(xmpp_ctx_t *ctx);
358
+
359
+ #ifdef __cplusplus
360
+ }
361
+ #endif
362
+
363
+ #endif /* __LIBSTROPHE_STROPHE_H__ */