ruburple 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README +4 -2
- data/ext/ruburple_ext.c +106 -51
- data/lib/ruburple/ruburple.rb +12 -9
- data/tests/ruburple_test.rb +19 -8
- metadata +2 -2
data/README
CHANGED
@@ -18,7 +18,9 @@ Then, to build, I did:
|
|
18
18
|
|
19
19
|
This is mainly because I dont need any of the disabled features to get ruburple running, and the configure script had big trouble finding the gnutls headers and libs on its own.
|
20
20
|
|
21
|
-
== Usage example
|
21
|
+
== Usage example:
|
22
|
+
|
23
|
+
This example uses almost all methods defined in the ruburple gem. For a few other methods look at the test/ruburple_test.rb.
|
22
24
|
|
23
25
|
require 'ruburple'
|
24
26
|
Ruburple::init
|
@@ -35,4 +37,4 @@ This is mainly because I dont need any of the disabled features to get ruburple
|
|
35
37
|
|
36
38
|
Do
|
37
39
|
Ruburple::debug = true
|
38
|
-
and mail me a description of the problem, and Ill see what I can do.
|
40
|
+
and mail me a description of the problem, and Ill see what I can do. Warning: ruburple will be extremely chatty (pun intended) when you do this.
|
data/ext/ruburple_ext.c
CHANGED
@@ -55,7 +55,6 @@ static VALUE rb_ruburple_protocol_account_chat;
|
|
55
55
|
static VALUE rb_ruburple_protocol_account_savedstatus;
|
56
56
|
static VALUE rb_ruburple_protocol_connection;
|
57
57
|
static VALUE rb_ruburple_blist_status;
|
58
|
-
static VALUE rb_ruburple_blist_presence;
|
59
58
|
static VALUE rb_ruburple_blist;
|
60
59
|
static VALUE rb_ruburple_blist_buddy_icon;
|
61
60
|
static VALUE rb_ruburple_blist_buddy;
|
@@ -115,7 +114,6 @@ static VALUE delete_method_id;
|
|
115
114
|
#define RB_RUBURPLE_PLUGIN(purple_plugin_pointer) Data_Wrap_Struct(rb_ruburple_plugin, NULL, NULL, purple_plugin_pointer)
|
116
115
|
#define RB_RUBURPLE_PROTOCOL_INFO(purple_plugin_info_pointer) Data_Wrap_Struct(rb_ruburple_protocol_info, NULL, NULL, purple_plugin_info_pointer)
|
117
116
|
#define RB_RUBURPLE_BLIST_STATUS(purple_status_pointer) Data_Wrap_Struct(rb_ruburple_blist_status, NULL, NULL, purple_status_pointer)
|
118
|
-
#define RB_RUBURPLE_BLIST_PRESENCE(purple_presence_pointer) Data_Wrap_Struct(rb_ruburple_blist_presence, NULL, NULL, purple_presence_pointer)
|
119
117
|
#define RB_RUBURPLE_BLIST(purple_blist_pointer) Data_Wrap_Struct(rb_ruburple_blist, NULL, NULL, purple_blist_pointer)
|
120
118
|
#define RB_RUBURPLE_BLIST_BUDDY(purple_buddy_pointer) Data_Wrap_Struct(rb_ruburple_blist_buddy, NULL, NULL, purple_buddy_pointer)
|
121
119
|
#define RB_RUBURPLE_BLIST_NODE(purple_blist_node_pointer) Data_Wrap_Struct(rb_ruburple_blist_node, NULL, NULL, purple_blist_node_pointer)
|
@@ -141,7 +139,6 @@ static VALUE delete_method_id;
|
|
141
139
|
#define RUBURPLE_SIGNAL_HANDLER(rb_ruburple_subscription,ruburple_signal_handler_pointer) Data_Get_Struct(rb_ruburple_subscription, RuburpleSignalHandler, ruburple_signal_handler_pointer)
|
142
140
|
#define PURPLE_CONNECTION(rb_ruburple_protocol_connection,purple_connection_pointer) Data_Get_Struct(rb_ruburple_protocol_connection, PurpleConnection, purple_connection_pointer)
|
143
141
|
#define PURPLE_BUDDY(rb_ruburple_blist_buddy,purple_buddy_pointer) Data_Get_Struct(rb_ruburple_blist_buddy, PurpleBuddy, purple_buddy_pointer)
|
144
|
-
#define PURPLE_PRESENCE(rb_ruburple_blist_presence,purple_presence_pointer) Data_Get_Struct(rb_ruburple_blist_presence, PurplePresence, purple_presence_pointer)
|
145
142
|
#define PURPLE_STATUS(rb_ruburple_blist_status,purple_status_pointer) Data_Get_Struct(rb_ruburple_blist_status, PurpleStatus, purple_status_pointer)
|
146
143
|
#define GPOINTER(rb_ruburple_pointer,gpointer) Data_Get_Struct(rb_ruburple_pointer, void, gpointer)
|
147
144
|
|
@@ -504,6 +501,12 @@ ruburple_get_protocols(gpointer data)
|
|
504
501
|
return (gpointer) purple_plugins_get_protocols();
|
505
502
|
}
|
506
503
|
|
504
|
+
static gpointer
|
505
|
+
ruburple_get_protocol(gpointer data)
|
506
|
+
{
|
507
|
+
return (gpointer) purple_plugins_find_with_name((char *) data);
|
508
|
+
}
|
509
|
+
|
507
510
|
static VALUE
|
508
511
|
rb_ruburple_get_protocols(VALUE self)
|
509
512
|
{
|
@@ -519,16 +522,23 @@ rb_ruburple_get_protocols(VALUE self)
|
|
519
522
|
|
520
523
|
static VALUE
|
521
524
|
rb_ruburple_get_protocol(VALUE self, VALUE name)
|
525
|
+
{
|
526
|
+
PurplePlugin *protocol = (PurplePlugin *) call_and_get_result(ruburple_get_protocol, (gpointer) RSTRING(name)->ptr);
|
527
|
+
RETURN_QNIL_IF_NULL(protocol);
|
528
|
+
return RB_RUBURPLE_PROTOCOL(protocol);
|
529
|
+
}
|
530
|
+
|
531
|
+
static VALUE
|
532
|
+
rb_ruburple_has_protocol(VALUE self, VALUE name)
|
522
533
|
{
|
523
534
|
GList *iter;
|
524
|
-
VALUE return_value;
|
525
535
|
|
526
536
|
for (iter = (GList *) call_and_get_result(ruburple_get_protocols, NULL); iter; iter = iter->next) {
|
527
537
|
if (strcmp(purple_plugin_get_name((PurplePlugin *) iter->data), RSTRING(name)->ptr) == 0)
|
528
|
-
return
|
538
|
+
return Qtrue;
|
529
539
|
}
|
530
540
|
|
531
|
-
return
|
541
|
+
return Qfalse;
|
532
542
|
}
|
533
543
|
|
534
544
|
static gpointer
|
@@ -619,24 +629,35 @@ rb_ruburple_protocol_account_set_password(VALUE self, VALUE password)
|
|
619
629
|
}
|
620
630
|
|
621
631
|
static gpointer
|
622
|
-
|
632
|
+
ruburple_protocol_account_set_enabled(gpointer data)
|
623
633
|
{
|
624
|
-
|
625
|
-
purple_account_set_enabled(
|
634
|
+
gpointer *args = (gpointer *) data;
|
635
|
+
purple_account_set_enabled((PurpleAccount *) args[0], UI_ID, * (gboolean *) args[1]);
|
626
636
|
return NULL;
|
627
637
|
}
|
628
638
|
|
629
639
|
static VALUE
|
630
|
-
|
640
|
+
rb_ruburple_protocol_account_set_enabled(VALUE self, VALUE enabled_value)
|
631
641
|
{
|
632
642
|
PurpleAccount *account;
|
643
|
+
gboolean enabled = GBOOL(enabled_value);
|
644
|
+
gpointer args[2];
|
645
|
+
|
633
646
|
PURPLE_ACCOUNT(self, account);
|
647
|
+
args[0] = (gpointer) account;
|
648
|
+
args[1] = (gpointer) &enabled;
|
634
649
|
|
635
|
-
call_and_get_result(
|
650
|
+
call_and_get_result(ruburple_protocol_account_set_enabled, args);
|
636
651
|
|
637
652
|
return Qnil;
|
638
653
|
}
|
639
654
|
|
655
|
+
static VALUE
|
656
|
+
rb_ruburple_protocol_account_connect(VALUE self)
|
657
|
+
{
|
658
|
+
return rb_ruburple_protocol_account_set_enabled(self, Qtrue);
|
659
|
+
}
|
660
|
+
|
640
661
|
static gpointer
|
641
662
|
ruburple_protocol_account_get_username(gpointer data)
|
642
663
|
{
|
@@ -691,6 +712,23 @@ rb_ruburple_protocol_account_get_alias(VALUE self)
|
|
691
712
|
return rb_str_new2(rval);
|
692
713
|
}
|
693
714
|
|
715
|
+
static gpointer
|
716
|
+
ruburple_protocol_account_get_status(gpointer data)
|
717
|
+
{
|
718
|
+
return (gpointer) purple_account_get_active_status((PurpleAccount *) data);
|
719
|
+
}
|
720
|
+
|
721
|
+
static VALUE
|
722
|
+
rb_ruburple_protocol_account_get_status(VALUE self)
|
723
|
+
{
|
724
|
+
PurpleAccount *account;
|
725
|
+
PurpleStatus *status;
|
726
|
+
PURPLE_ACCOUNT(self, account);
|
727
|
+
status = (PurpleStatus *) call_and_get_result(ruburple_protocol_account_get_status, (gpointer) account);
|
728
|
+
RETURN_QNIL_IF_NULL(status);
|
729
|
+
return RB_RUBURPLE_BLIST_STATUS(status);
|
730
|
+
}
|
731
|
+
|
694
732
|
static gpointer
|
695
733
|
ruburple_protocol_account_set_savedstatus(gpointer data)
|
696
734
|
{
|
@@ -1163,34 +1201,38 @@ rb_ruburple_protocol_connection_send_im(int argc, VALUE *argv, VALUE self)
|
|
1163
1201
|
}
|
1164
1202
|
|
1165
1203
|
static gpointer
|
1166
|
-
|
1204
|
+
ruburple_protocol_account_is_connected(gpointer data)
|
1167
1205
|
{
|
1168
|
-
|
1169
|
-
|
1170
|
-
if (!purple_account_is_disconnected(account) && !account->disconnecting)
|
1171
|
-
purple_account_disconnect(account);
|
1206
|
+
gpointer *args = (gpointer *) data;
|
1207
|
+
* (gboolean *) args[1] = purple_account_is_connected((PurpleAccount *) args[0]);
|
1172
1208
|
return NULL;
|
1173
1209
|
}
|
1174
1210
|
|
1175
1211
|
static VALUE
|
1176
|
-
|
1212
|
+
rb_ruburple_protocol_account_is_connected(VALUE self)
|
1177
1213
|
{
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1214
|
+
gpointer args[2];
|
1215
|
+
PurpleAccount *account;
|
1216
|
+
gboolean tmp;
|
1217
|
+
VALUE rval;
|
1218
|
+
PURPLE_ACCOUNT(self, account);
|
1219
|
+
args[0] = (gpointer) account;
|
1220
|
+
args[1] = (gpointer) &tmp;
|
1221
|
+
call_and_get_result(ruburple_protocol_account_is_connected, args);
|
1222
|
+
rval = BOOL(tmp);
|
1223
|
+
return rval;
|
1182
1224
|
}
|
1183
1225
|
|
1184
1226
|
static gpointer
|
1185
|
-
|
1227
|
+
ruburple_protocol_account_is_connecting(gpointer data)
|
1186
1228
|
{
|
1187
1229
|
gpointer *args = (gpointer *) data;
|
1188
|
-
* (gboolean *) args[1] =
|
1230
|
+
* (gboolean *) args[1] = purple_account_is_connecting((PurpleAccount *) args[0]);
|
1189
1231
|
return NULL;
|
1190
1232
|
}
|
1191
1233
|
|
1192
1234
|
static VALUE
|
1193
|
-
|
1235
|
+
rb_ruburple_protocol_account_is_connecting(VALUE self)
|
1194
1236
|
{
|
1195
1237
|
gpointer args[2];
|
1196
1238
|
PurpleAccount *account;
|
@@ -1199,7 +1241,7 @@ rb_ruburple_protocol_account_is_connected(VALUE self)
|
|
1199
1241
|
PURPLE_ACCOUNT(self, account);
|
1200
1242
|
args[0] = (gpointer) account;
|
1201
1243
|
args[1] = (gpointer) &tmp;
|
1202
|
-
call_and_get_result(
|
1244
|
+
call_and_get_result(ruburple_protocol_account_is_connecting, args);
|
1203
1245
|
rval = BOOL(tmp);
|
1204
1246
|
return rval;
|
1205
1247
|
}
|
@@ -1218,6 +1260,14 @@ rb_ruburple_protocol_connection_get_account(VALUE self)
|
|
1218
1260
|
return RB_RUBURPLE_PROTOCOL_ACCOUNT((PurpleAccount *) call_and_get_result(ruburple_protocol_connection_get_account, (gpointer) plugin));
|
1219
1261
|
}
|
1220
1262
|
|
1263
|
+
static VALUE
|
1264
|
+
rb_ruburple_protocol_connection_close(VALUE self)
|
1265
|
+
{
|
1266
|
+
VALUE account = rb_ruburple_protocol_connection_get_account(self);
|
1267
|
+
rb_ruburple_protocol_account_set_enabled(account, Qfalse);
|
1268
|
+
return Qnil;
|
1269
|
+
}
|
1270
|
+
|
1221
1271
|
static gpointer
|
1222
1272
|
ruburple_protocol_account_get_buddy(gpointer data)
|
1223
1273
|
{
|
@@ -1312,47 +1362,49 @@ rb_ruburple_blist_buddy_get_name(VALUE self)
|
|
1312
1362
|
}
|
1313
1363
|
|
1314
1364
|
static gpointer
|
1315
|
-
|
1365
|
+
ruburple_blist_status_get_name(gpointer data)
|
1316
1366
|
{
|
1317
|
-
|
1367
|
+
PurpleStatus *status = (PurpleStatus *) data;
|
1368
|
+
return (gpointer) purple_status_get_name(status);
|
1318
1369
|
}
|
1319
1370
|
|
1320
1371
|
static VALUE
|
1321
|
-
|
1372
|
+
rb_ruburple_blist_status_get_name(VALUE self)
|
1322
1373
|
{
|
1323
|
-
|
1324
|
-
|
1325
|
-
return
|
1374
|
+
PurpleStatus *status;
|
1375
|
+
PURPLE_STATUS(self, status);
|
1376
|
+
return rb_str_new2((char *) call_and_get_result(ruburple_blist_status_get_name, (gpointer) status));
|
1326
1377
|
}
|
1327
1378
|
|
1328
|
-
static
|
1329
|
-
|
1379
|
+
static VALUE
|
1380
|
+
rb_ruburple_protocol_account_get_uid(VALUE self)
|
1330
1381
|
{
|
1331
|
-
|
1332
|
-
|
1382
|
+
PurpleAccount *account;
|
1383
|
+
PURPLE_ACCOUNT(self, account);
|
1384
|
+
return INT2NUM((int) account);
|
1333
1385
|
}
|
1334
1386
|
|
1335
1387
|
static VALUE
|
1336
|
-
|
1388
|
+
rb_ruburple_protocol_connection_get_protocol(VALUE self)
|
1337
1389
|
{
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1390
|
+
PurpleConnection *connection;
|
1391
|
+
PURPLE_CONNECTION(self, connection);
|
1392
|
+
RETURN_QNIL_IF_NULL(connection->prpl);
|
1393
|
+
return RB_RUBURPLE_PROTOCOL(connection->prpl);
|
1341
1394
|
}
|
1342
1395
|
|
1343
1396
|
static gpointer
|
1344
|
-
|
1397
|
+
ruburple_blist_buddy_get_status(gpointer data)
|
1345
1398
|
{
|
1346
|
-
|
1347
|
-
return (gpointer) purple_status_get_name(status);
|
1399
|
+
return (gpointer) purple_presence_get_active_status(purple_buddy_get_presence((PurpleBuddy *) data));
|
1348
1400
|
}
|
1349
1401
|
|
1350
1402
|
static VALUE
|
1351
|
-
|
1403
|
+
rb_ruburple_blist_buddy_get_status(VALUE self)
|
1352
1404
|
{
|
1353
|
-
|
1354
|
-
|
1355
|
-
return
|
1405
|
+
PurpleBuddy *buddy;
|
1406
|
+
PURPLE_BUDDY(self, buddy);
|
1407
|
+
return RB_RUBURPLE_BLIST_STATUS((PurpleStatus *) call_and_get_result(ruburple_blist_buddy_get_status, (gpointer) buddy));
|
1356
1408
|
}
|
1357
1409
|
|
1358
1410
|
#ifdef __cplusplus
|
@@ -1387,7 +1439,8 @@ extern "C" {
|
|
1387
1439
|
rb_define_singleton_method(rb_ruburple, "debug=", rb_ruburple_set_debug, 1);
|
1388
1440
|
rb_define_singleton_method(rb_ruburple, "protocols", rb_ruburple_get_protocols, 0);
|
1389
1441
|
rb_define_singleton_method(rb_ruburple, "get_protocol", rb_ruburple_get_protocol, 1);
|
1390
|
-
rb_define_singleton_method(rb_ruburple, "
|
1442
|
+
rb_define_singleton_method(rb_ruburple, "has_protocol?", rb_ruburple_has_protocol, 1);
|
1443
|
+
rb_define_singleton_method(rb_ruburple, "_init", rb_ruburple_init, 0);
|
1391
1444
|
rb_define_singleton_method(rb_ruburple, "_subscribe", rb_ruburple_subscribe, 3);
|
1392
1445
|
rb_define_singleton_method(rb_ruburple, "_read_event", rb_ruburple_read_event, 0);
|
1393
1446
|
rb_define_const(rb_ruburple, "MESSAGE_SEND", INT2NUM(PURPLE_MESSAGE_SEND)); /**< Outgoing message. */
|
@@ -1441,15 +1494,19 @@ extern "C" {
|
|
1441
1494
|
rb_ruburple_protocol_account = rb_define_class_under(rb_ruburple, "Account", rb_cObject);
|
1442
1495
|
rb_define_method(rb_ruburple_protocol_account, "password=", rb_ruburple_protocol_account_set_password, 1);
|
1443
1496
|
rb_define_method(rb_ruburple_protocol_account, "connect", rb_ruburple_protocol_account_connect, 0);
|
1497
|
+
rb_define_method(rb_ruburple_protocol_account, "enabled=", rb_ruburple_protocol_account_set_enabled, 1);
|
1444
1498
|
rb_define_method(rb_ruburple_protocol_account, "savedstatus=", rb_ruburple_protocol_account_set_savedstatus, 1);
|
1445
1499
|
rb_define_method(rb_ruburple_protocol_account, "connection", rb_ruburple_protocol_account_get_connection, 0);
|
1446
1500
|
rb_define_method(rb_ruburple_protocol_account, "connected?", rb_ruburple_protocol_account_is_connected, 0);
|
1501
|
+
rb_define_method(rb_ruburple_protocol_account, "connecting?", rb_ruburple_protocol_account_is_connecting, 0);
|
1447
1502
|
rb_define_method(rb_ruburple_protocol_account, "username", rb_ruburple_protocol_account_get_username, 0);
|
1448
1503
|
rb_define_method(rb_ruburple_protocol_account, "password", rb_ruburple_protocol_account_get_password, 0);
|
1449
1504
|
rb_define_method(rb_ruburple_protocol_account, "alias", rb_ruburple_protocol_account_get_alias, 0);
|
1450
1505
|
rb_define_method(rb_ruburple_protocol_account, "has_buddy?", rb_ruburple_protocol_account_has_buddy, 1);
|
1451
1506
|
rb_define_method(rb_ruburple_protocol_account, "get_buddy", rb_ruburple_protocol_account_get_buddy, 1);
|
1452
1507
|
rb_define_method(rb_ruburple_protocol_account, "buddies", rb_ruburple_protocol_account_get_buddies, -1);
|
1508
|
+
rb_define_method(rb_ruburple_protocol_account, "uid", rb_ruburple_protocol_account_get_uid, 0);
|
1509
|
+
rb_define_method(rb_ruburple_protocol_account, "status", rb_ruburple_protocol_account_get_status, 0);
|
1453
1510
|
|
1454
1511
|
rb_ruburple_protocol_account_conversation = rb_define_class_under(rb_ruburple_protocol_account, "Conversation", rb_cObject);
|
1455
1512
|
|
@@ -1472,6 +1529,7 @@ extern "C" {
|
|
1472
1529
|
|
1473
1530
|
rb_ruburple_protocol_connection = rb_define_class_under(rb_ruburple_protocol, "Connection", rb_cObject);
|
1474
1531
|
rb_define_method(rb_ruburple_protocol_connection, "send_im", rb_ruburple_protocol_connection_send_im, -1);
|
1532
|
+
rb_define_method(rb_ruburple_protocol_connection, "protocol", rb_ruburple_protocol_connection_get_protocol, 0);
|
1475
1533
|
rb_define_method(rb_ruburple_protocol_connection, "close", rb_ruburple_protocol_connection_close, 0);
|
1476
1534
|
rb_define_method(rb_ruburple_protocol_connection, "account", rb_ruburple_protocol_connection_get_account, 0);
|
1477
1535
|
|
@@ -1482,10 +1540,7 @@ extern "C" {
|
|
1482
1540
|
rb_ruburple_blist_buddy = rb_define_class_under(rb_ruburple_blist, "Buddy", rb_ruburple_blist_node);
|
1483
1541
|
rb_define_method(rb_ruburple_blist_buddy, "account", rb_ruburple_blist_buddy_get_account, 0);
|
1484
1542
|
rb_define_method(rb_ruburple_blist_buddy, "name", rb_ruburple_blist_buddy_get_name, 0);
|
1485
|
-
rb_define_method(rb_ruburple_blist_buddy, "
|
1486
|
-
|
1487
|
-
rb_ruburple_blist_presence = rb_define_class_under(rb_ruburple_blist, "Presence", rb_cObject);
|
1488
|
-
rb_define_method(rb_ruburple_blist_presence, "active_status", rb_ruburple_blist_presence_get_active_status, 0);
|
1543
|
+
rb_define_method(rb_ruburple_blist_buddy, "status", rb_ruburple_blist_buddy_get_status, 0);
|
1489
1544
|
|
1490
1545
|
rb_ruburple_blist_group = rb_define_class_under(rb_ruburple_blist, "Group", rb_ruburple_blist_node);
|
1491
1546
|
|
data/lib/ruburple/ruburple.rb
CHANGED
@@ -95,17 +95,20 @@ module Ruburple
|
|
95
95
|
self._subscribe(subsystem_handle, event.to_s.gsub(/_/, "-"), callable)
|
96
96
|
end
|
97
97
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
98
|
+
def self.init
|
99
|
+
@@event_fetcher.kill if defined?(@@event_fetcher) && @@event_fetcher
|
100
|
+
@@event_fetcher = Thread.new do
|
101
|
+
loop do
|
102
|
+
begin
|
103
|
+
select([EVENT_INPUT], nil, nil)
|
104
|
+
_read_event
|
105
|
+
rescue Exception => e
|
106
|
+
puts "#{e.class}: #{e}"
|
107
|
+
pp e.backtrace
|
108
|
+
end
|
107
109
|
end
|
108
110
|
end
|
111
|
+
self._init
|
109
112
|
end
|
110
113
|
|
111
114
|
end
|
data/tests/ruburple_test.rb
CHANGED
@@ -39,25 +39,36 @@ class RuburpleTest < Test::Unit::TestCase
|
|
39
39
|
|
40
40
|
def test_operations(protocol)
|
41
41
|
puts "testing #{protocol}..."
|
42
|
+
assert(Ruburple::has_protocol?(protocol))
|
42
43
|
test_accounts = $TEST_ACCOUNTS[protocol]
|
43
44
|
p = Ruburple::get_protocol(protocol)
|
44
|
-
puts "testing
|
45
|
+
puts "testing get account..."
|
45
46
|
a1 = p.get_account(test_accounts.first.username, test_accounts.first.password)
|
46
47
|
a2 = p.get_account(test_accounts.last.username, test_accounts.last.password)
|
48
|
+
puts "testing connecting..."
|
49
|
+
assert(!a1.connecting?)
|
47
50
|
a1.connect
|
51
|
+
assert(a1.connecting?)
|
52
|
+
puts "testing sign on..."
|
48
53
|
assert_within(30) do
|
49
54
|
@@events[:signed_on].find do |e|
|
50
55
|
e.account.username == a1.username
|
51
56
|
end
|
52
57
|
end
|
58
|
+
assert(!a1.connecting?)
|
59
|
+
assert(a1.connected?)
|
60
|
+
puts "testing uid..."
|
61
|
+
assert(a1.uid != a2.uid)
|
62
|
+
assert_equal(a1.uid, a1.connection.account.uid)
|
53
63
|
puts "testing buddies..."
|
54
64
|
assert(a1.has_buddy?(a2.username))
|
55
65
|
assert(buddy2 = a1.buddies.find do |b|
|
56
66
|
b.name == a2.username
|
57
67
|
end)
|
58
68
|
puts "testing presence..."
|
59
|
-
assert_equal("Offline", buddy2.
|
60
|
-
|
69
|
+
assert_equal("Offline", buddy2.status.name)
|
70
|
+
puts "testing set enabled..."
|
71
|
+
a2.enabled = true
|
61
72
|
assert_within(30) do
|
62
73
|
@@events[:signed_on].find do |e|
|
63
74
|
e.account.username == a2.username
|
@@ -70,10 +81,10 @@ class RuburpleTest < Test::Unit::TestCase
|
|
70
81
|
end)
|
71
82
|
puts "testing presence..."
|
72
83
|
assert_within(30) do
|
73
|
-
buddy1.
|
84
|
+
buddy1.status.name == "Available"
|
74
85
|
end
|
75
86
|
assert_within(30) do
|
76
|
-
buddy2.
|
87
|
+
buddy2.status.name == "Available"
|
77
88
|
end
|
78
89
|
puts "testing send im..."
|
79
90
|
a1.connection.send_im(a2.username, "hello a2")
|
@@ -87,11 +98,11 @@ class RuburpleTest < Test::Unit::TestCase
|
|
87
98
|
end
|
88
99
|
a1_got_message && a2_got_message
|
89
100
|
end
|
90
|
-
puts "testing
|
91
|
-
a1.
|
101
|
+
puts "testing set enabled..."
|
102
|
+
a1.enabled = false
|
92
103
|
puts "testing presence..."
|
93
104
|
assert_within(30) do
|
94
|
-
buddy1.
|
105
|
+
buddy1.status.name == "Offline"
|
95
106
|
end
|
96
107
|
puts "testing close..."
|
97
108
|
a2.connection.close
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ruburple
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-05-
|
6
|
+
version: 0.0.6
|
7
|
+
date: 2007-05-08 00:00:00 +02:00
|
8
8
|
summary: An ruby extension to libpurple.
|
9
9
|
require_paths:
|
10
10
|
- lib
|