summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircchannellist.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opieirc/ircchannellist.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieirc/ircchannellist.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/noncore/net/opieirc/ircchannellist.cpp b/noncore/net/opieirc/ircchannellist.cpp
new file mode 100644
index 0000000..e592d05
--- a/dev/null
+++ b/noncore/net/opieirc/ircchannellist.cpp
@@ -0,0 +1,37 @@
+#include <qpe/resource.h>
+#include <qpixmap.h>
+#include "ircchannellist.h"
+
+IRCChannelList::IRCChannelList(IRCChannel *channel, QWidget *parent, const char *name, WFlags f) : QListBox(parent, name, f) {
+ m_channel = channel;
+}
+
+void IRCChannelList::update() {
+ QPixmap op = Resource::loadPixmap("opieirc/op");
+ QPixmap hop = Resource::loadPixmap("opieirc/hop");
+ QPixmap voice = Resource::loadPixmap("opieirc/voice");
+ QListIterator<IRCChannelPerson> it = m_channel->people();
+ clear();
+ for (; it.current(); ++it) {
+ IRCChannelPerson *person = it.current();
+ if (person->flags & PERSON_FLAG_OP) {
+ insertItem(op, person->person->nick());
+ } else if (person->flags & PERSON_FLAG_HALFOP) {
+ insertItem(op, person->person->nick());
+ } else if (person->flags & PERSON_FLAG_VOICE) {
+ insertItem(voice, person->person->nick());
+ } else {
+ insertItem(person->person->nick());
+ }
+ }
+ sort();
+}
+
+
+bool IRCChannelList::hasPerson(QString nick) {
+ for (unsigned int i=0; i<count(); i++) {
+ if (text(i) == nick)
+ return TRUE;
+ }
+ return FALSE;
+}