mirror of
				https://gitlab.com/comunic/comunicmessages
				synced 2025-11-04 04:04:10 +00:00 
			
		
		
		
	Get information about the members of the conversations.
This commit is contained in:
		
							
								
								
									
										17
									
								
								data/conversationslist.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								data/conversationslist.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
#include "conversationslist.h"
 | 
			
		||||
 | 
			
		||||
ConversationsList::ConversationsList()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QList<int> ConversationsList::getAllMembersId() const
 | 
			
		||||
{
 | 
			
		||||
    QList<int> members;
 | 
			
		||||
    for(Conversation conv : *this){
 | 
			
		||||
        for(int memberID : conv.members())
 | 
			
		||||
            if(!members.contains(memberID))
 | 
			
		||||
                members.append(memberID);
 | 
			
		||||
    }
 | 
			
		||||
    return members;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										28
									
								
								data/conversationslist.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								data/conversationslist.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Conversations list
 | 
			
		||||
 *
 | 
			
		||||
 * @author Pierre HUBERT
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef CONVERSATIONSLIST_H
 | 
			
		||||
#define CONVERSATIONSLIST_H
 | 
			
		||||
 | 
			
		||||
#include <QList>
 | 
			
		||||
 | 
			
		||||
#include "conversation.h"
 | 
			
		||||
 | 
			
		||||
class ConversationsList : public QList<Conversation>
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    ConversationsList();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get and return the ID of all the members of
 | 
			
		||||
     * the conversations
 | 
			
		||||
     *
 | 
			
		||||
     * @return The IDs of the conversations
 | 
			
		||||
     */
 | 
			
		||||
    QList<int> getAllMembersId() const;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // CONVERSATIONSLIST_H
 | 
			
		||||
							
								
								
									
										46
									
								
								data/user.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								data/user.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,46 @@
 | 
			
		||||
#include "user.h"
 | 
			
		||||
 | 
			
		||||
User::User()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int User::iD() const
 | 
			
		||||
{
 | 
			
		||||
    return mID;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void User::setID(int iD)
 | 
			
		||||
{
 | 
			
		||||
    mID = iD;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString User::firstName() const
 | 
			
		||||
{
 | 
			
		||||
    return mFirstName;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void User::setFirstName(const QString &firstName)
 | 
			
		||||
{
 | 
			
		||||
    mFirstName = firstName;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString User::lastName() const
 | 
			
		||||
{
 | 
			
		||||
    return mLastName;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void User::setLastName(const QString &lastName)
 | 
			
		||||
{
 | 
			
		||||
    mLastName = lastName;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString User::accountImage() const
 | 
			
		||||
{
 | 
			
		||||
    return mAccountImage;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void User::setAccountImage(const QString &accountImage)
 | 
			
		||||
{
 | 
			
		||||
    mAccountImage = accountImage;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										36
									
								
								data/user.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								data/user.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
/**
 | 
			
		||||
 * This object contains information about a single user
 | 
			
		||||
 *
 | 
			
		||||
 * @author Pierre HUBERT
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef USER_H
 | 
			
		||||
#define USER_H
 | 
			
		||||
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
class User
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    User();
 | 
			
		||||
 | 
			
		||||
    int iD() const;
 | 
			
		||||
    void setID(int iD);
 | 
			
		||||
 | 
			
		||||
    QString firstName() const;
 | 
			
		||||
    void setFirstName(const QString &firstName);
 | 
			
		||||
 | 
			
		||||
    QString lastName() const;
 | 
			
		||||
    void setLastName(const QString &lastName);
 | 
			
		||||
 | 
			
		||||
    QString accountImage() const;
 | 
			
		||||
    void setAccountImage(const QString &accountImage);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    int mID;
 | 
			
		||||
    QString mFirstName;
 | 
			
		||||
    QString mLastName;
 | 
			
		||||
    QString mAccountImage;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // USER_H
 | 
			
		||||
		Reference in New Issue
	
	Block a user