Class: StropheRuby::EventLoop

Inherits:
Object
  • Object
show all
Defined in:
ext/strophe_ruby/strophe_ruby.c

Class Method Summary collapse

Class Method Details

.prepareObject

Initialize the strophe library



22
23
24
25
# File 'ext/strophe_ruby/strophe_ruby.c', line 22

VALUE t_xmpp_initialize(VALUE self) {
    xmpp_initialize();
    return Qnil;
}

.run(rb_ctx) ⇒ Object

parse the stream continuously (by calling xmpp_run_once in a while loop)



48
49
50
51
52
53
# File 'ext/strophe_ruby/strophe_ruby.c', line 48

VALUE t_xmpp_run(VALUE self, VALUE rb_ctx) {
    xmpp_ctx_t *ctx;
    Data_Get_Struct(rb_ctx,xmpp_ctx_t,ctx);	
    xmpp_run(ctx);
    return Qtrue;
}

.run_once(rb_ctx, timeout) ⇒ Object

parse the stream one time



40
41
42
43
44
45
# File 'ext/strophe_ruby/strophe_ruby.c', line 40

VALUE t_xmpp_run_once(VALUE self, VALUE rb_ctx, VALUE timeout) {
    xmpp_ctx_t *ctx;        
    Data_Get_Struct(rb_ctx,xmpp_ctx_t,ctx);
    xmpp_run_once(ctx, NUM2INT(timeout));
    return Qtrue;        
}

.shutdownObject

shutdown the library



28
29
30
31
# File 'ext/strophe_ruby/strophe_ruby.c', line 28

VALUE t_xmpp_shutdown(VALUE self) {
    xmpp_shutdown();
    return Qnil;
}

.stop(rb_ctx) ⇒ Object

Set a flag to indicate to our event loop that it must exit



56
57
58
59
60
61
# File 'ext/strophe_ruby/strophe_ruby.c', line 56

VALUE t_xmpp_stop(VALUE self, VALUE rb_ctx) {
    xmpp_ctx_t *ctx;
    Data_Get_Struct(rb_ctx, xmpp_ctx_t, ctx);
    xmpp_stop(ctx);
    return Qtrue;
}

.version(major, minor) ⇒ Object

check Strophe version



34
35
36
37
# File 'ext/strophe_ruby/strophe_ruby.c', line 34

VALUE t_xmpp_version_check(VALUE self, VALUE major, VALUE minor) {
    int res = xmpp_version_check(FIX2INT(major), FIX2INT(minor));
    return INT2FIX(res);
}