# HG changeset patch # User Mikael Hallendal # Date 1207775599 -7200 # Node ID 4e9e64a468f35472a5ddcfd132c61e718fd7abe8 # Parent 64b1c1c32d56898487c7969076fecad714ad35f3 Added rblm-constants for enums diff -r 64b1c1c32d56 -r 4e9e64a468f3 bindings/ruby/rblm-constants.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bindings/ruby/rblm-constants.c Wed Apr 09 23:13:19 2008 +0200 @@ -0,0 +1,50 @@ +#include "rblm.h" + +VALUE lm_mMessageType; +VALUE lm_mMessageSubType; + +void +Init_lm_constants (VALUE lm_mLM) +{ + lm_mMessageType = rb_define_module_under (lm_mLM, "MessageType"); + + rb_define_const (lm_mMessageType, "MESSAGE", + INT2FIX (LM_MESSAGE_TYPE_MESSAGE)); + rb_define_const (lm_mMessageType, "PRESENCE", + INT2FIX (LM_MESSAGE_TYPE_PRESENCE)); + rb_define_const (lm_mMessageType, "IQ", + INT2FIX (LM_MESSAGE_TYPE_IQ)); + + lm_mMessageSubType = rb_define_module_under (lm_mLM, "MessageSubType"); + + rb_define_const (lm_mMessageSubType, "AVAILABLE", + INT2FIX (LM_MESSAGE_SUB_TYPE_AVAILABLE)); + rb_define_const (lm_mMessageSubType, "NORMAL", + INT2FIX (LM_MESSAGE_SUB_TYPE_NORMAL)); + rb_define_const (lm_mMessageSubType, "CHAT", + INT2FIX (LM_MESSAGE_SUB_TYPE_CHAT)); + rb_define_const (lm_mMessageSubType, "GROUPCHAT", + INT2FIX (LM_MESSAGE_SUB_TYPE_GROUPCHAT)); + rb_define_const (lm_mMessageSubType, "HEADLINE", + INT2FIX (LM_MESSAGE_SUB_TYPE_HEADLINE)); + rb_define_const (lm_mMessageSubType, "UNAVAILABLE", + INT2FIX (LM_MESSAGE_SUB_TYPE_UNAVAILABLE)); + rb_define_const (lm_mMessageSubType, "PROBE", + INT2FIX (LM_MESSAGE_SUB_TYPE_PROBE)); + rb_define_const (lm_mMessageSubType, "SUBSCRIBE", + INT2FIX (LM_MESSAGE_SUB_TYPE_SUBSCRIBE)); + rb_define_const (lm_mMessageSubType, "UNSUBSCRIBE", + INT2FIX (LM_MESSAGE_SUB_TYPE_UNSUBSCRIBE)); + rb_define_const (lm_mMessageSubType, "SUBSCRIBED", + INT2FIX (LM_MESSAGE_SUB_TYPE_SUBSCRIBED)); + rb_define_const (lm_mMessageSubType, "UNSUBSCRIBED", + INT2FIX (LM_MESSAGE_SUB_TYPE_UNSUBSCRIBED)); + rb_define_const (lm_mMessageSubType, "GET", + INT2FIX (LM_MESSAGE_SUB_TYPE_GET)); + rb_define_const (lm_mMessageSubType, "SET", + INT2FIX (LM_MESSAGE_SUB_TYPE_SET)); + rb_define_const (lm_mMessageSubType, "RESULT", + INT2FIX (LM_MESSAGE_SUB_TYPE_RESULT)); + rb_define_const (lm_mMessageSubType, "ERROR", + INT2FIX (LM_MESSAGE_SUB_TYPE_ERROR)); +} diff -r 64b1c1c32d56 -r 4e9e64a468f3 bindings/ruby/rblm.c --- a/bindings/ruby/rblm.c Wed Apr 09 22:24:37 2008 +0200 +++ b/bindings/ruby/rblm.c Wed Apr 09 23:13:19 2008 +0200 @@ -9,5 +9,6 @@ Init_lm_connection (lm_mLM); Init_lm_message (lm_mLM); + Init_lm_constants (lm_mLM); } diff -r 64b1c1c32d56 -r 4e9e64a468f3 bindings/ruby/rblm.h --- a/bindings/ruby/rblm.h Wed Apr 09 22:24:37 2008 +0200 +++ b/bindings/ruby/rblm.h Wed Apr 09 23:13:19 2008 +0200 @@ -8,6 +8,7 @@ extern void Init_loudmouth (void); extern void Init_lm_connection (VALUE lm_mLM); extern void Init_lm_message (VALUE lm_mLM); +extern void Init_lm_constants (VALUE lm_mLM); #endif /* __RLM_H__ */