ruburple 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,105 @@
1
+ # Ruburple - a ruby wrapper for libpurple
2
+ # Copyright (C) 2007 Martin Kihlgren <zond at troja dot ath dot cx>
3
+ #
4
+ # This program is free software; you can redistribute it and/or
5
+ # modify it under the terms of the GNU General Public License
6
+ # as published by the Free Software Foundation; either version 2
7
+ # of the License, or (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
+
18
+ require 'monitor'
19
+
20
+ module Ruburple
21
+
22
+ @@events = {
23
+ :account_added => Ruburple::HANDLE_ACCOUNTS,
24
+ :account_connecting => Ruburple::HANDLE_ACCOUNTS,
25
+ :account_removed => Ruburple::HANDLE_ACCOUNTS,
26
+ :account_disabled => Ruburple::HANDLE_ACCOUNTS,
27
+ :account_enabled => Ruburple::HANDLE_ACCOUNTS,
28
+ :account_setting_info => Ruburple::HANDLE_ACCOUNTS,
29
+ :account_set_info => Ruburple::HANDLE_ACCOUNTS,
30
+ :account_status_changed => Ruburple::HANDLE_ACCOUNTS,
31
+ :account_alias_changed => Ruburple::HANDLE_ACCOUNTS,
32
+ :buddy_status_changed => Ruburple::HANDLE_BLIST,
33
+ :buddy_idle_changed => Ruburple::HANDLE_BLIST,
34
+ :buddy_signed_on => Ruburple::HANDLE_BLIST,
35
+ :buddy_signed_off => Ruburple::HANDLE_BLIST,
36
+ :update_idle => Ruburple::HANDLE_BLIST,
37
+ :blist_node_extended_menu => Ruburple::HANDLE_BLIST,
38
+ :buddy_added => Ruburple::HANDLE_BLIST,
39
+ :buddy_removed => Ruburple::HANDLE_BLIST,
40
+ :buddy_icon_changed => Ruburple::HANDLE_BLIST,
41
+ :blist_node_aliased => Ruburple::HANDLE_BLIST,
42
+ :cipher_added => Ruburple::HANDLE_CIPHERS,
43
+ :cipher_removed => Ruburple::HANDLE_CIPHERS,
44
+ :signing_on => Ruburple::HANDLE_CONNECTIONS,
45
+ :signed_on => Ruburple::HANDLE_CONNECTIONS,
46
+ :signing_off => Ruburple::HANDLE_CONNECTIONS,
47
+ :signed_off => Ruburple::HANDLE_CONNECTIONS,
48
+ :writing_im_msg => Ruburple::HANDLE_CONVERSATIONS,
49
+ :wrote_im_msg => Ruburple::HANDLE_CONVERSATIONS,
50
+ :sending_im_msg => Ruburple::HANDLE_CONVERSATIONS,
51
+ :sent_im_msg => Ruburple::HANDLE_CONVERSATIONS,
52
+ :receiving_im_msg => Ruburple::HANDLE_CONVERSATIONS,
53
+ :received_im_msg => Ruburple::HANDLE_CONVERSATIONS,
54
+ :writing_chat_msg => Ruburple::HANDLE_CONVERSATIONS,
55
+ :wrote_chat_msg => Ruburple::HANDLE_CONVERSATIONS,
56
+ :sending_chat_msg => Ruburple::HANDLE_CONVERSATIONS,
57
+ :sent_chat_msg => Ruburple::HANDLE_CONVERSATIONS,
58
+ :receiving_chat_msg => Ruburple::HANDLE_CONVERSATIONS,
59
+ :received_chat_msg => Ruburple::HANDLE_CONVERSATIONS,
60
+ :conversation_created => Ruburple::HANDLE_CONVERSATIONS,
61
+ :conversation_updated => Ruburple::HANDLE_CONVERSATIONS,
62
+ :deleting_conversation => Ruburple::HANDLE_CONVERSATIONS,
63
+ :buddy_typing => Ruburple::HANDLE_CONVERSATIONS,
64
+ :buddy_typing_stopped => Ruburple::HANDLE_CONVERSATIONS,
65
+ :chat_buddy_joining => Ruburple::HANDLE_CONVERSATIONS,
66
+ :chat_buddy_joined => Ruburple::HANDLE_CONVERSATIONS,
67
+ :chat_buddy_flags => Ruburple::HANDLE_CONVERSATIONS,
68
+ :chat_buddy_leaving => Ruburple::HANDLE_CONVERSATIONS,
69
+ :chat_buddy_left => Ruburple::HANDLE_CONVERSATIONS,
70
+ :chat_inviting_user => Ruburple::HANDLE_CONVERSATIONS,
71
+ :chat_invited_user => Ruburple::HANDLE_CONVERSATIONS,
72
+ :chat_invited => Ruburple::HANDLE_CONVERSATIONS,
73
+ :chat_joined => Ruburple::HANDLE_CONVERSATIONS,
74
+ :chat_left => Ruburple::HANDLE_CONVERSATIONS,
75
+ :chat_topic_changed => Ruburple::HANDLE_CONVERSATIONS,
76
+ :quitting => Ruburple::HANDLE_CORE,
77
+ :log_timestamp => Ruburple::HANDLE_LOG,
78
+ :plugin_load => Ruburple::HANDLE_PLUGINS,
79
+ :plugin_unload => Ruburple::HANDLE_PLUGINS,
80
+ :savedstatus_changed => Ruburple::HANDLE_SAVEDSTATUSES,
81
+ :file_recv_accept => Ruburple::HANDLE_XFERS,
82
+ :file_recv_start => Ruburple::HANDLE_XFERS,
83
+ :file_recv_cancel => Ruburple::HANDLE_XFERS,
84
+ :file_recv_complete => Ruburple::HANDLE_XFERS,
85
+ :file_recv_request => Ruburple::HANDLE_XFERS,
86
+ :file_send_accept => Ruburple::HANDLE_XFERS,
87
+ :file_send_start => Ruburple::HANDLE_XFERS,
88
+ :file_send_cancel => Ruburple::HANDLE_XFERS,
89
+ :file_send_complete => Ruburple::HANDLE_XFERS
90
+ }
91
+
92
+ def self.subscribe(event, callable)
93
+ raise "No such event: #{event}" unless subsystem_handle = @@events[event]
94
+ self._subscribe(subsystem_handle, event.to_s.gsub(/_/, "-"), callable)
95
+ end
96
+
97
+ @@event_fetcher.kill if defined?(@@event_fetcher) && @@event_fetcher
98
+ @@event_fetcher = Thread.new do
99
+ loop do
100
+ select([EVENT_INPUT], nil, nil)
101
+ _read_event
102
+ end
103
+ end
104
+
105
+ end
data/lib/ruburple.rb ADDED
@@ -0,0 +1,21 @@
1
+ # Ruburple - a ruby wrapper for libpurple
2
+ # Copyright (C) 2007 Martin Kihlgren <zond at troja dot ath dot cx>
3
+ #
4
+ # This program is free software; you can redistribute it and/or
5
+ # modify it under the terms of the GNU General Public License
6
+ # as published by the Free Software Foundation; either version 2
7
+ # of the License, or (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
+
18
+ $: << File.dirname(File.expand_path(__FILE__))
19
+
20
+ require 'ruburple_ext'
21
+ require 'ruburple/ruburple'
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.2
3
+ specification_version: 1
4
+ name: ruburple
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.0.2
7
+ date: 2007-05-05 00:00:00 +02:00
8
+ summary: An ruby extension to libpurple.
9
+ require_paths:
10
+ - lib
11
+ email: zond at troja dot ath dot cx
12
+ homepage:
13
+ rubyforge_project:
14
+ description:
15
+ autorequire: ruburple
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Martin Kihlgren
31
+ files:
32
+ - lib/ruburple.rb
33
+ - lib/ruburple/ruburple.rb
34
+ - ext/extconf.rb
35
+ - ext/ruburple_ext.c
36
+ - GPL-2
37
+ - README
38
+ test_files: []
39
+
40
+ rdoc_options:
41
+ - --line-numbers
42
+ - --inline-source
43
+ extra_rdoc_files:
44
+ - README
45
+ executables: []
46
+
47
+ extensions:
48
+ - ext/extconf.rb
49
+ requirements: []
50
+
51
+ dependencies: []
52
+