
set serverout on size unlimited;
exec dbms_java.set_output(2000000);
set define off

select JDBMS_XMPP.ping_Xmpp_Server('localhost', 5222, 'sparck') as XMPP_PING from dual;

select JDBMS_XMPP.ping_Google_Server as GTALK_PING from dual;

select JDBMS_XMPP.test_Xmpp_Connection('localhost', 5222, 'sparck', 'scott', 'tiger')  as OPENFIRE_LOGIN from dual;


select JDBMS_XMPP.test_GTalk_Connection('Adrien.Sales', 'XXX') as GTALK_LOGIN from dual;


select jdbms_xmpp.send_single_text('localhost',
	5222,
	'spark',
	'scott',
	'tiger',
	'prslump@l20323',
	'Dummy subject',
	'Hi, this is scott talking ! Can you run stats on my schema please ?') xmpp_return_code
from dual;

select jdbms_xmpp.send_google_single_text('Adrien.Sales', 'XXX', 'Adrien.Sales@gmail.com', 'GTalk rocks !') from dual;
select jdbms_xmpp.send_google_single_text('Adrien.Sales', 'XXX', 'Adrien.Sales@gmail.com', 'Subject', 'GTalk rocks !', 122) from dual;


select jdbms_xmpp.send_single_text('scott', 'tiger', 'prslump@l20323', 'hello boy !') from dual;

set serverout on size unlimited;
exec dbms_java.set_output(2000000);
select * from table(XmppRosters('localhost', 5222, 'spark', 'scott', 'tiger'));

select * from table(XmppRosters('talk.google.com', 5222, 'gmail.com', 'Adrien.Sales', 'XXX'));

select roster_user, presence_type
from table(XmppRosters('talk.google.com', 5222, 'gmail.com', 'Adrien.Sales', 'XXX'))
order by presence_type


select JDBMS_XMPP.send_csv_batch_text ('localhost', -- the host where XMPP service is hosted
	5222,-- the XMPP service port
	'spark',-- the XMPP service
	'scott',-- the login of the account you will use to send messages
	'tiger',-- the password of the account that sends mesage
	'didi@l20323;prslump@l20323',
	'dummy subject', -- the Subject
	'hello !',
	1,
    0,
    0,
    0,
    NULL,
    NULL,
    0,
    NULL,
    1,
    1,
    0,
    0,
    1,
    NULL,
    NULL,
    NULL,
    0,
    0) as NB_UNTOUCHED_RECIPTS
from dual;

select JDBMS_XMPP.send_csv_batch_text ('localhost', -- the host where XMPP service is hosted
	5222,-- the XMPP service port
	'spark',-- the XMPP service
	'scott',-- the login of the account you will use to send messages
	'tiger',-- the password of the account that sends mesage
	'didi@l20323;prslump@l20323',
	'dummy subject', -- the Subject
	'hello !') as NB_UNTOUCHED_RECIPTS
from dual;





drop table XMPP_CONTACTS purge;
create table XMPP_CONTACTS (name NVARCHAR2(30));
insert into XMPP_CONTACTS  (name) values ('didi@l20323');
insert into XMPP_CONTACTS  (name) values ('prslump@l20323');
commit;
select JDBMS_XMPP.send_cursor_batch_text ('localhost', -- the host where XMPP service is hosted
	5222,-- the XMPP service port
	'spark',-- the XMPP service
	'scott',-- the login of the account you will use to send messages
	'tiger',-- the password of the account that sends mesage
	cursor(select name from XMPP_CONTACTS),
	'dummy subject', -- the Subject
	'hello !',
	1,
    0,
    0,
    0,
    NULL,
    NULL,
    0,
    NULL,
    1,
    1,
    0,
    0,
    1,
    NULL,
    NULL,
    NULL,
    0,
    0) as NB_UNTOUCHED_RECIPTS
from dual;


select JDBMS_XMPP.send_cursor_batch_text ('localhost', -- the host where XMPP service is hosted
	5222,-- the XMPP service port
	'spark',-- the XMPP service
	'scott',-- the login of the account you will use to send messages
	'tiger',-- the password of the account that sends mesage
	cursor(select name from XMPP_CONTACTS),
	'dummy subject', -- the Subject
	'hello !') as NB_UNTOUCHED_RECIPTS
from dual;