23 #include "irc/ircuserinfo.h" 24 #include "ircuserlist.h" 26 IRCUserList::~IRCUserList()
28 qDeleteAll(usersArray);
36 *usersArray[index] = userInfo;
42 usersArray.append(pUserInfo);
49 const IRCUserInfo *pExistingInfo = user(oldNickname);
50 if (pExistingInfo ==
nullptr)
54 user.setPrefixedNickname(newNickname);
60 bool IRCUserList::hasUser(
const QString &nickname)
const 62 return indexOfName(nickname) != -1;
65 int IRCUserList::indexOfName(
const QString &nickname)
const 67 for (
int i = 0; i < usersArray.size(); ++i)
79 int index = indexOfName(nickname);
83 delete usersArray[index];
84 usersArray.remove(index);
88 void IRCUserList::setUserModes(
const QString &nickname,
const QList<char> &modes)
90 int index = this->indexOfName(nickname);
94 userInfo.setModes(modes);
100 QStringList nicksList;
101 for (
auto *i : usersArray)
102 nicksList << i->prefixedName();
107 const IRCUserInfo *IRCUserList::user(
const QString &nickname)
const 109 int index = this->indexOfName(nickname);
113 return usersArray[index];
119 if (pUserInfo ==
nullptr)
QString cleanNickname() const
Returns nickname with no prefixes, contrary to the prefixedName() .
bool appendNameToCachedList(const IRCUserInfo &userInfo)
Appends a single name to the users array.
bool isSameNickname(const IRCUserInfo &otherUser) const
Check if this user and user specified as parameter are the same user.
bool changeNick(const QString &oldNickname, const QString &newNickname)
Changes a nickname while preserving user flags.
IRCUserInfo userCopy(const QString &nickname) const
Gets a copy of the IRCUserInfo for user with given name.
bool removeNameFromCachedList(const QString &nickname)
Removes a name from the sortecd cachedNames list.
Holds information flags about given nickname.
QStringList toStringList() const
Returns all prefixed nicknames in a string list.