purple_ruby 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/History.txt +4 -0
  2. data/ext/purple_ruby.c +21 -14
  3. metadata +4 -4
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.6.5
2
+
3
+ Compatible with 1.8 and 1.9
4
+
1
5
  == 0.6.4
2
6
 
3
7
  Add a noted problem on OSX.
data/ext/purple_ruby.c CHANGED
@@ -47,6 +47,13 @@
47
47
  #include <arpa/inet.h>
48
48
  #include <fcntl.h>
49
49
 
50
+ #ifndef RSTRING_PTR
51
+ #define RSTRING_PTR(s) (RSTRING(s)->ptr)
52
+ #endif
53
+ #ifndef RSTRING_LEN
54
+ #define RSTRING_LEN(s) (RSTRING(s)->len)
55
+ #endif
56
+
50
57
  #define PURPLE_GLIB_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR)
51
58
  #define PURPLE_GLIB_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL)
52
59
 
@@ -169,7 +176,7 @@ void set_callback(VALUE* handler, const char* handler_name)
169
176
 
170
177
  if (rb_obj_class(*handler) != rb_cProc) {
171
178
  rb_raise(rb_eTypeError, "%s got unexpected value: %s", handler_name,
172
- RSTRING(inspect_rb_obj(*handler))->ptr);
179
+ RSTRING_PTR(inspect_rb_obj(*handler)));
173
180
  }
174
181
  }
175
182
 
@@ -177,7 +184,7 @@ void check_callback(VALUE handler, const char* handler_name){
177
184
  if (rb_obj_class(handler) != rb_cProc) {
178
185
  rb_raise(rb_eTypeError, "%s has unexpected value: %s",
179
186
  handler_name,
180
- RSTRING(inspect_rb_obj(handler))->ptr);
187
+ RSTRING_PTR(inspect_rb_obj(handler)));
181
188
  }
182
189
  }
183
190
 
@@ -386,7 +393,7 @@ static VALUE init(int argc, VALUE* argv, VALUE self)
386
393
 
387
394
  if (!NIL_P(path)) {
388
395
  Check_Type(path, T_STRING);
389
- purple_util_set_user_dir(RSTRING(path)->ptr);
396
+ purple_util_set_user_dir(RSTRING_PTR(path));
390
397
  }
391
398
 
392
399
  purple_core_set_ui_ops(&core_uiops);
@@ -553,7 +560,7 @@ static VALUE watch_incoming_ipc(VALUE self, VALUE serverip, VALUE port)
553
560
 
554
561
  memset(&my_addr, 0, sizeof(struct sockaddr_in));
555
562
  my_addr.sin_family = AF_INET;
556
- my_addr.sin_addr.s_addr = inet_addr(RSTRING(serverip)->ptr);
563
+ my_addr.sin_addr.s_addr = inet_addr(RSTRING_PTR(serverip));
557
564
  my_addr.sin_port = htons(FIX2INT(port));
558
565
  if (bind(soc, (struct sockaddr*)&my_addr, sizeof(struct sockaddr)) != 0)
559
566
  {
@@ -596,11 +603,11 @@ static VALUE watch_timer(VALUE self, VALUE delay)
596
603
 
597
604
  static VALUE login(VALUE self, VALUE protocol, VALUE username, VALUE password)
598
605
  {
599
- PurpleAccount* account = purple_account_new(RSTRING(username)->ptr, RSTRING(protocol)->ptr);
606
+ PurpleAccount* account = purple_account_new(RSTRING_PTR(username), RSTRING_PTR(protocol));
600
607
  if (NULL == account || NULL == account->presence) {
601
- rb_raise(rb_eRuntimeError, "No able to create account: %s", RSTRING(protocol)->ptr);
608
+ rb_raise(rb_eRuntimeError, "No able to create account: %s", RSTRING_PTR(protocol));
602
609
  }
603
- purple_account_set_password(account, RSTRING(password)->ptr);
610
+ purple_account_set_password(account, RSTRING_PTR(password));
604
611
  purple_account_set_remember_password(account, TRUE);
605
612
  purple_account_set_enabled(account, UI_ID, TRUE);
606
613
  PurpleSavedStatus *status = purple_savedstatus_new(NULL, PURPLE_STATUS_AVAILABLE);
@@ -644,7 +651,7 @@ static VALUE send_im(VALUE self, VALUE name, VALUE message)
644
651
  Data_Get_Struct(self, PurpleAccount, account);
645
652
 
646
653
  if (purple_account_is_connected(account)) {
647
- int i = serv_send_im(purple_account_get_connection(account), RSTRING(name)->ptr, RSTRING(message)->ptr, 0);
654
+ int i = serv_send_im(purple_account_get_connection(account), RSTRING_PTR(name), RSTRING_PTR(message), 0);
648
655
  return INT2FIX(i);
649
656
  } else {
650
657
  return Qnil;
@@ -676,7 +683,7 @@ static VALUE get_bool_setting(VALUE self, VALUE name, VALUE default_value)
676
683
  {
677
684
  PurpleAccount *account;
678
685
  Data_Get_Struct(self, PurpleAccount, account);
679
- gboolean value = purple_account_get_bool(account, RSTRING(name)->ptr,
686
+ gboolean value = purple_account_get_bool(account, RSTRING_PTR(name),
680
687
  (default_value == Qfalse || default_value == Qnil) ? FALSE : TRUE);
681
688
  return (TRUE == value) ? Qtrue : Qfalse;
682
689
  }
@@ -685,7 +692,7 @@ static VALUE get_string_setting(VALUE self, VALUE name, VALUE default_value)
685
692
  {
686
693
  PurpleAccount *account;
687
694
  Data_Get_Struct(self, PurpleAccount, account);
688
- const char* value = purple_account_get_string(account, RSTRING(name)->ptr, RSTRING(default_value)->ptr);
695
+ const char* value = purple_account_get_string(account, RSTRING_PTR(name), RSTRING_PTR(default_value));
689
696
  return (NULL == value) ? Qnil : rb_str_new2(value);
690
697
  }
691
698
 
@@ -713,7 +720,7 @@ static VALUE add_buddy(VALUE self, VALUE buddy)
713
720
  PurpleAccount *account;
714
721
  Data_Get_Struct(self, PurpleAccount, account);
715
722
 
716
- PurpleBuddy* pb = purple_buddy_new(account, RSTRING(buddy)->ptr, NULL);
723
+ PurpleBuddy* pb = purple_buddy_new(account, RSTRING_PTR(buddy), NULL);
717
724
 
718
725
  char* group = _("Buddies");
719
726
  PurpleGroup* grp = purple_find_group(group);
@@ -733,9 +740,9 @@ static VALUE remove_buddy(VALUE self, VALUE buddy)
733
740
  PurpleAccount *account;
734
741
  Data_Get_Struct(self, PurpleAccount, account);
735
742
 
736
- PurpleBuddy* pb = purple_find_buddy(account, RSTRING(buddy)->ptr);
743
+ PurpleBuddy* pb = purple_find_buddy(account, RSTRING_PTR(buddy));
737
744
  if (NULL == pb) {
738
- rb_raise(rb_eRuntimeError, "Failed to remove buddy for %s : %s does not exist", purple_account_get_username(account), RSTRING(buddy)->ptr);
745
+ rb_raise(rb_eRuntimeError, "Failed to remove buddy for %s : %s does not exist", purple_account_get_username(account), RSTRING_PTR(buddy));
739
746
  }
740
747
 
741
748
  char* group = _("Buddies");
@@ -755,7 +762,7 @@ static VALUE has_buddy(VALUE self, VALUE buddy)
755
762
  {
756
763
  PurpleAccount *account;
757
764
  Data_Get_Struct(self, PurpleAccount, account);
758
- if (purple_find_buddy(account, RSTRING(buddy)->ptr) != NULL) {
765
+ if (purple_find_buddy(account, RSTRING_PTR(buddy)) != NULL) {
759
766
  return Qtrue;
760
767
  } else {
761
768
  return Qfalse;
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: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 4
10
- version: 0.6.4
9
+ - 5
10
+ version: 0.6.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - yong
@@ -35,7 +35,7 @@ dependencies:
35
35
  type: :development
36
36
  version_requirements: *id001
37
37
  description: A ruby gem to write server that sends and recives IM messages
38
- email: yong@intridea.com
38
+ email: yong@intridea.com dingding@intridea.com
39
39
  executables: []
40
40
 
41
41
  extensions: