purple_ruby 0.6.6 → 0.6.7
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/History.txt +5 -0
- data/ext/purple_ruby.c +44 -0
- metadata +4 -4
data/History.txt
CHANGED
data/ext/purple_ruby.c
CHANGED
@@ -127,6 +127,7 @@ static PurpleEventLoopUiOps glib_eventloops =
|
|
127
127
|
};
|
128
128
|
|
129
129
|
static VALUE cPurpleRuby;
|
130
|
+
static VALUE cConnectionError;
|
130
131
|
VALUE cAccount;
|
131
132
|
const char* UI_ID = "purplegw";
|
132
133
|
static GMainLoop *main_loop = NULL;
|
@@ -686,6 +687,29 @@ static VALUE send_im(VALUE self, VALUE name, VALUE message)
|
|
686
687
|
}
|
687
688
|
}
|
688
689
|
|
690
|
+
static VALUE common_send(VALUE self, VALUE name, VALUE message)
|
691
|
+
{
|
692
|
+
PurpleAccount *account;
|
693
|
+
Data_Get_Struct(self, PurpleAccount, account);
|
694
|
+
|
695
|
+
if (purple_account_is_connected(account)) {
|
696
|
+
PurpleBuddy* buddy = purple_find_buddy(account, RSTRING_PTR(name));
|
697
|
+
if (buddy != NULL) {
|
698
|
+
PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, RSTRING_PTR(name), account);
|
699
|
+
if (conv == NULL) {
|
700
|
+
conv = purple_conversation_new(PURPLE_CONV_TYPE_IM,
|
701
|
+
buddy->account, buddy->name);
|
702
|
+
}
|
703
|
+
purple_conv_im_send(PURPLE_CONV_IM(conv), RSTRING_PTR(message));
|
704
|
+
return INT2FIX(0);
|
705
|
+
} else {
|
706
|
+
return Qnil;
|
707
|
+
}
|
708
|
+
} else {
|
709
|
+
return Qnil;
|
710
|
+
}
|
711
|
+
}
|
712
|
+
|
689
713
|
static VALUE username(VALUE self)
|
690
714
|
{
|
691
715
|
PurpleAccount *account;
|
@@ -829,8 +853,28 @@ void Init_purple_ruby()
|
|
829
853
|
rb_define_const(cPurpleRuby, "NOTIFY_MSG_WARNING", INT2NUM(PURPLE_NOTIFY_MSG_WARNING));
|
830
854
|
rb_define_const(cPurpleRuby, "NOTIFY_MSG_INFO", INT2NUM(PURPLE_NOTIFY_MSG_INFO));
|
831
855
|
|
856
|
+
cConnectionError = rb_define_class_under(cPurpleRuby, "ConnectionError", rb_cObject);
|
857
|
+
rb_define_const(cConnectionError, "NETWORK_ERROR", INT2NUM(PURPLE_CONNECTION_ERROR_NETWORK_ERROR));
|
858
|
+
rb_define_const(cConnectionError, "INVALID_USERNAME", INT2NUM(PURPLE_CONNECTION_ERROR_INVALID_USERNAME));
|
859
|
+
rb_define_const(cConnectionError, "AUTHENTICATION_FAILED", INT2NUM(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED));
|
860
|
+
rb_define_const(cConnectionError, "AUTHENTICATION_IMPOSSIBLE", INT2NUM(PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE));
|
861
|
+
rb_define_const(cConnectionError, "NO_SSL_SUPPORT", INT2NUM(PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT));
|
862
|
+
rb_define_const(cConnectionError, "ENCRYPTION_ERROR", INT2NUM(PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR));
|
863
|
+
rb_define_const(cConnectionError, "NAME_IN_USE", INT2NUM(PURPLE_CONNECTION_ERROR_NAME_IN_USE));
|
864
|
+
rb_define_const(cConnectionError, "INVALID_SETTINGS", INT2NUM(PURPLE_CONNECTION_ERROR_INVALID_SETTINGS));
|
865
|
+
rb_define_const(cConnectionError, "CERT_NOT_PROVIDED", INT2NUM(PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED));
|
866
|
+
rb_define_const(cConnectionError, "CERT_UNTRUSTED", INT2NUM(PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED));
|
867
|
+
rb_define_const(cConnectionError, "CERT_EXPIRED", INT2NUM(PURPLE_CONNECTION_ERROR_CERT_EXPIRED));
|
868
|
+
rb_define_const(cConnectionError, "CERT_NOT_ACTIVATED", INT2NUM(PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED));
|
869
|
+
rb_define_const(cConnectionError, "CERT_HOSTNAME_MISMATCH", INT2NUM(PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH));
|
870
|
+
rb_define_const(cConnectionError, "CERT_FINGERPRINT_MISMATCH", INT2NUM(PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH));
|
871
|
+
rb_define_const(cConnectionError, "CERT_SELF_SIGNED", INT2NUM(PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED));
|
872
|
+
rb_define_const(cConnectionError, "CERT_OTHER_ERROR", INT2NUM(PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR));
|
873
|
+
rb_define_const(cConnectionError, "OTHER_ERROR", INT2NUM(PURPLE_CONNECTION_ERROR_OTHER_ERROR));
|
874
|
+
|
832
875
|
cAccount = rb_define_class_under(cPurpleRuby, "Account", rb_cObject);
|
833
876
|
rb_define_method(cAccount, "send_im", send_im, 2);
|
877
|
+
rb_define_method(cAccount, "common_send", common_send, 2);
|
834
878
|
rb_define_method(cAccount, "username", username, 0);
|
835
879
|
rb_define_method(cAccount, "protocol_id", protocol_id, 0);
|
836
880
|
rb_define_method(cAccount, "protocol_name", protocol_name, 0);
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: purple_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 7
|
10
|
+
version: 0.6.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- yong
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-17 00:00:00 +08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|