purple_ruby 0.6.5 → 0.6.6

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.
Files changed (3) hide show
  1. data/History.txt +4 -0
  2. data/ext/purple_ruby.c +30 -0
  3. metadata +5 -5
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.6.6
2
+
3
+ Logout
4
+
1
5
  == 0.6.5
2
6
 
3
7
  Compatible with 1.8 and 1.9
data/ext/purple_ruby.c CHANGED
@@ -137,6 +137,7 @@ extern PurpleAccountUiOps account_ops;
137
137
 
138
138
  static VALUE im_handler = Qnil;
139
139
  static VALUE signed_on_handler = Qnil;
140
+ static VALUE signed_off_handler = Qnil;
140
141
  static VALUE connection_error_handler = Qnil;
141
142
  static VALUE notify_message_handler = Qnil;
142
143
  static VALUE request_handler = Qnil;
@@ -452,6 +453,14 @@ static void signed_on(PurpleConnection* connection)
452
453
  rb_funcall2(signed_on_handler, CALL, 1, args);
453
454
  }
454
455
 
456
+ static void signed_off(PurpleConnection* connection)
457
+ {
458
+ VALUE args[1];
459
+ args[0] = Data_Wrap_Struct(cAccount, NULL, NULL, purple_connection_get_account(connection));
460
+ check_callback(signed_off_handler, "signed_off_handler");
461
+ rb_funcall2(signed_off_handler, CALL, 1, args);
462
+ }
463
+
455
464
  static VALUE watch_signed_on_event(VALUE self)
456
465
  {
457
466
  set_callback(&signed_on_handler, "signed_on_handler");
@@ -461,6 +470,15 @@ static VALUE watch_signed_on_event(VALUE self)
461
470
  return signed_on_handler;
462
471
  }
463
472
 
473
+ static VALUE watch_signed_off_event(VALUE self)
474
+ {
475
+ set_callback(&signed_off_handler, "signed_off_handler");
476
+ int handle;
477
+ purple_signal_connect(purple_connections_get_handle(), "signed-off", &handle,
478
+ PURPLE_CALLBACK(signed_off), NULL);
479
+ return signed_off_handler;
480
+ }
481
+
464
482
  static VALUE watch_connection_error(VALUE self)
465
483
  {
466
484
  finch_connections_init();
@@ -616,6 +634,15 @@ static VALUE login(VALUE self, VALUE protocol, VALUE username, VALUE password)
616
634
  return Data_Wrap_Struct(cAccount, NULL, NULL, account);
617
635
  }
618
636
 
637
+ static VALUE logout(VALUE self)
638
+ {
639
+ PurpleAccount *account;
640
+ Data_Get_Struct(self, PurpleAccount, account);
641
+ purple_account_disconnect(account);
642
+
643
+ return Qnil;
644
+ }
645
+
619
646
  static VALUE main_loop_run(VALUE self)
620
647
  {
621
648
  main_loop = g_main_loop_new(NULL, FALSE);
@@ -626,6 +653,7 @@ static VALUE main_loop_run(VALUE self)
626
653
  purple_core_quit();
627
654
  if (im_handler == Qnil) rb_gc_unregister_address(&im_handler);
628
655
  if (signed_on_handler == Qnil) rb_gc_unregister_address(&signed_on_handler);
656
+ if (signed_off_handler == Qnil) rb_gc_unregister_address(&signed_off_handler);
629
657
  if (connection_error_handler == Qnil) rb_gc_unregister_address(&connection_error_handler);
630
658
  if (notify_message_handler == Qnil) rb_gc_unregister_address(&notify_message_handler);
631
659
  if (request_handler == Qnil) rb_gc_unregister_address(&request_handler);
@@ -785,6 +813,7 @@ void Init_purple_ruby()
785
813
  rb_define_singleton_method(cPurpleRuby, "init", init, -1);
786
814
  rb_define_singleton_method(cPurpleRuby, "list_protocols", list_protocols, 0);
787
815
  rb_define_singleton_method(cPurpleRuby, "watch_signed_on_event", watch_signed_on_event, 0);
816
+ rb_define_singleton_method(cPurpleRuby, "watch_signed_off_event", watch_signed_off_event, 0);
788
817
  rb_define_singleton_method(cPurpleRuby, "watch_connection_error", watch_connection_error, 0);
789
818
  rb_define_singleton_method(cPurpleRuby, "watch_incoming_im", watch_incoming_im, 0);
790
819
  rb_define_singleton_method(cPurpleRuby, "watch_notify_message", watch_notify_message, 0);
@@ -811,4 +840,5 @@ void Init_purple_ruby()
811
840
  rb_define_method(cAccount, "remove_buddy", remove_buddy, 1);
812
841
  rb_define_method(cAccount, "has_buddy?", has_buddy, 1);
813
842
  rb_define_method(cAccount, "delete", acc_delete, 0);
843
+ rb_define_method(cAccount, "logout", logout, 0);
814
844
  }
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: 13
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 5
10
- version: 0.6.5
9
+ - 6
10
+ version: 0.6.6
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: 2009-04-01 00:00:00 +08:00
18
+ date: 2010-10-15 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -55,7 +55,7 @@ files:
55
55
  - README.txt
56
56
  - Rakefile
57
57
  has_rdoc: true
58
- homepage: http://www.intridea.com
58
+ homepage: http://github.com/yong/purple_ruby
59
59
  licenses: []
60
60
 
61
61
  post_install_message: