about summary refs log tree commit diff stats
path: root/091socket.cc
Commit message (Expand)AuthorAgeFilesLines
* 3602Kartik K. Agaram2016-10-271-15/+13
* 3600 - allow reading a single byte from a socketKartik K. Agaram2016-10-271-3/+3
* 3595Kartik K. Agaram2016-10-251-1/+1
* 3586Kartik K. Agaram2016-10-241-0/+10
* 3585Kartik K. Agaram2016-10-241-11/+0
* 3584Kartik K. Agaram2016-10-241-2/+1
* 3583Kartik K. Agaram2016-10-241-5/+5
* 3582Kartik K. Agaram2016-10-241-3/+3
* 3581Kartik K. Agaram2016-10-241-2/+21
* 3579Kartik K. Agaram2016-10-241-1/+1
* 3571 - make 'read-from-socket' non-blockingKartik K. Agaram2016-10-231-11/+32
* 3563Kartik K. Agaram2016-10-231-1/+1
* 3562Kartik K. Agaram2016-10-221-6/+2
* 3561Kartik K. Agaram2016-10-221-2/+6
* 3523 - http client now workingKartik K. Agaram2016-10-201-7/+92
* 3522Kartik K. Agaram2016-10-191-1/+1
* 3519 - reading lots of data from a socketKartik K. Agaram2016-10-181-2/+11
* 3508Kartik K. Agaram2016-10-161-2/+2
* 3499Kartik K. Agaram2016-10-151-2/+1
* 3486Kartik K. Agaram2016-10-081-3/+3
* 3485Kartik K. Agaram2016-10-081-2/+2
* 3484Kartik K. Agaram2016-10-081-5/+5
* 3482Kartik K. Agaram2016-10-081-1/+1
* 3477Kartik K. Agaram2016-10-081-0/+5
* 3476Kartik K. Agaram2016-10-071-8/+8
* 3473Kartik K. Agaram2016-10-071-2/+2
* 3472Kartik K. Agaram2016-10-071-2/+2
* 3471Kartik K. Agaram2016-10-071-10/+17
* 3470Kartik K. Agaram2016-10-071-3/+4
* 3469Kartik K. Agaram2016-10-071-5/+5
* 3467Kartik K. Agaram2016-10-071-19/+18
* 3466Kartik K. Agaram2016-10-071-13/+14
* 3427Kartik K. Agaram2016-09-271-2/+5
* 3412Kartik K. Agaram2016-09-241-6/+8
* 3403Stephen Malina2016-09-211-28/+19
* 3399 - Update network primitives.Stephen Malina2016-09-181-16/+56
* 3349Kartik K. Agaram2016-09-141-2/+6
* 3323 - Add simple network primitivesStephen Malina2016-09-111-0/+166
a> 60 61 62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87













                     
                                                      







                                                       
                                                                  
                                   












                                                                                                   
                                                                                                                                     









                                                                                     
                                                                                                                                                 











                                                                   
                                                  


                    








                                     
                                                                                                                   
                                          
                                                  



                               

                                                                 


                    
#include <glib.h>
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <stdlib.h>
#include <string.h>

#include <stabber.h>
#include <expect.h>

#include "proftest.h"

void
does_not_send_receipt_request_to_barejid(void **state)
{
    prof_input("/receipts request on");

    prof_connect();

    prof_input("/msg somejid@someserver.com Hi there");

    assert_true(stbbr_received(
        "<message id='*' type='chat' to='somejid@someserver.com'>"
            "<body>Hi there</body>"
        "</message>"
    ));
}

void
send_receipt_request(void **state)
{
    prof_input("/receipts request on");

    prof_connect();

    stbbr_for_id("prof_caps_4",
        "<iq from='buddy1@localhost/laptop' to='stabber@localhost' id='prof_caps_4' type='result'>"
            "<query xmlns='http://jabber.org/protocol/disco#info' node='http://profanity-im.github.io#hAkb1xZdJV9BQpgGNw8zG5Xsals='>"
                "<identity category='client' name='Profanity 0.5.0' type='console'/>"
                "<feature var='urn:xmpp:receipts'/>"
            "</query>"
        "</iq>"
    );

    stbbr_send(
        "<presence to='stabber@localhost' from='buddy1@localhost/laptop'>"
            "<priority>15</priority>"
            "<status>My status</status>"
            "<c hash='sha-256' xmlns='http://jabber.org/protocol/caps' node='http://profanity-im.github.io' ver='hAkb1xZdJV9BQpgGNw8zG5Xsals='/>"
        "</presence>"
    );

    prof_output_exact("Buddy1 is online, \"My status\"");

    prof_input("/msg Buddy1");
    prof_input("/resource set laptop");
    prof_input("Hi there, where is my receipt?");

    assert_true(stbbr_received(
        "<message id='*' type='chat' to='buddy1@localhost/laptop'>"
            "<body>Hi there, where is my receipt?</body>"
            "<request xmlns='urn:xmpp:receipts'/>"
        "</message>"
    ));
}

void
send_receipt_on_request(void **state)
{
    prof_input("/receipts send on");

    prof_connect();

    stbbr_send(
        "<message id='msg12213' type='chat' to='stabber@localhost/profanity' from='someuser@server.org/profanity'>"
            "<body>Wants a receipt</body>"
            "<request xmlns='urn:xmpp:receipts'/>"
        "</message>"
    );

    assert_true(stbbr_received(
        "<message id='*' to='someuser@server.org/profanity'>"
            "<received id='msg12213' xmlns='urn:xmpp:receipts'/>"
        "</message>"
    ));
}