23 #include "ircuserlist.h" 24 #include "irc/ircuserinfo.h" 26 IRCUserList::~IRCUserList()
28 for (
int i = 0; i < usersArray.size(); ++i)
39 *usersArray[index] = userInfo;
45 usersArray.append(pUserInfo);
52 const IRCUserInfo* pExistingInfo = user(oldNickname);
53 if (pExistingInfo == NULL)
59 user.setPrefixedNickname(newNickname);
65 bool IRCUserList::hasUser(
const QString& nickname)
const 67 return (indexOfName(nickname) != -1);
70 int IRCUserList::indexOfName(
const QString& nickname)
const 72 for (
int i = 0; i < usersArray.size(); ++i)
86 int index = indexOfName(nickname);
92 delete usersArray[index];
93 usersArray.remove(index);
97 void IRCUserList::setUserModes(
const QString& nickname,
const QList<char> &modes)
99 int index = this->indexOfName(nickname);
103 userInfo.setModes(modes);
109 QStringList nicksList;
110 for (
int i = 0; i < usersArray.size(); ++i)
112 nicksList << usersArray[i]->prefixedName();
118 const IRCUserInfo* IRCUserList::user(
const QString& nickname)
const 120 int index = this->indexOfName(nickname);
126 return usersArray[index];
132 if (pUserInfo == NULL)
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.