aboutsummaryrefslogtreecommitdiff
path: root/src/Message.cpp
blob: 2740c1143407dd7a3b652648b780436c3ca52116 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "../include/Message.hpp"

using namespace std;

namespace dchat
{
    Message::Message(User *_user) : 
        user(_user)
    {
        
    }
    
    Message::~Message()
    {
        for(MessagePart *messagePart : messageParts)
        {
            delete messagePart;
        }
    }
    
    void Message::addText(const string &text)
    {
        messageParts.push_back(new MessagePartText(text));
    }
    
    void Message::addImage(const string &url)
    {
        messageParts.push_back(new MessagePartEmoji(url));
    }
    
    vector<MessagePart*>& Message::getParts()
    {
        return messageParts;
    }
}