Ejemplo n.º 1
0
    void user_service::add_contact_data(const user::user_info_ptr u)
    {
        u::mutex_scoped_lock l{_ping_mutex};
        REQUIRE(u);

        contact_data cd = {contact_data::OFFLINE, u, PING_THRESH, 0, 0, false};
        _contacts[u->id()] = cd; 

        REQUIRE(_contacts[u->id()].contact == u);
    }
Ejemplo n.º 2
0
        void conversation_service::add_contact_to_conversation( 
                const user::user_info_ptr c, 
                conversation_ptr s)
        {
            REQUIRE(c);
            REQUIRE(s);

            if(s->contacts().by_id(c->id())) return;

            if(s->contacts().empty() && s->pending().empty())
            {
                add_contact_to_conversation_p(c, s);
                return;
            }

            ask_about(c->id(), s);
        }
Ejemplo n.º 3
0
        void conversation_service::add_contact_to_conversation_p( 
                const user::user_info_ptr c, 
                conversation_ptr s)
        {
            REQUIRE(c);
            REQUIRE(s);
            INVARIANT(_sender);

            //if contact exists, we return
            if(s->contacts().by_id(c->id())) return;

            //add contact to conversation
            s->contacts().add(c);

            sync_existing_conversation(s);
            fire_conversation_synced_event(s->id());
            fire_contact_added(s->id(), c->id());
        }