diff --git a/css/glowingbear.css b/css/glowingbear.css
index 22fccc9..05ecc80 100644
--- a/css/glowingbear.css
+++ b/css/glowingbear.css
@@ -169,6 +169,16 @@ input[type=text], input[type=password], .badge {
border-radius: 0;
margin-right: -15px;
}
+#nicklist {
+ position: fixed;
+ width: 100px;
+ min-height: 100%;
+ height: 100%;
+ overflow-y: auto;
+ right: 0;
+ top: 0;
+ padding-top: 35px; /* topbar */
+ }
.nav-pills > li > a {
border-radius: 0;
color: #ddd;
@@ -186,7 +196,8 @@ input[type=text], input[type=password], .badge {
position: relative;
height: 99%;
overflow-y: auto;
- margin-left: 14%;
+ margin-left: 14%; /* sidebar */
+ margin-right: 100px; /* nicklist */
width: auto;
top: 25px; /* topbar */
padding-bottom: 10px;
@@ -202,7 +213,7 @@ input[type=text], input[type=password], .badge {
background-color: #181818;
}
@media (max-width: 968px) {
- #sidebar, #bufferlines {
+ #sidebar, #bufferlines, #nicklist {
position: relative;
min-height: 0;
margin-left: 0;
@@ -210,7 +221,7 @@ input[type=text], input[type=password], .badge {
max-width: 100%;
border: 0;
}
- #sidebar {
+ #sidebar, #nicklist {
width: 100%;
text-align: center;
}
diff --git a/index.html b/index.html
index bed3b9f..b94c537 100644
--- a/index.html
+++ b/index.html
@@ -213,7 +213,14 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel
-
+
+
diff --git a/js/models.js b/js/models.js
index dc722f4..c44823c 100644
--- a/js/models.js
+++ b/js/models.js
@@ -18,6 +18,7 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
var local_variables = message['local_vars'];
var notify = 3 // Default 3 == message
var lines = []
+ var nicklist = {}
var active = false
var notification = 0
var unread = 0
@@ -38,6 +39,12 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
lines.push(line);
}
+ /*
+ * Adds a nick to nicklist
+ */
+ var addNick = function(nick) {
+ }
+
return {
id: pointer,
fullName: fullName,
@@ -51,6 +58,7 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
notification: notification,
localvars: local_variables,
notify: notify,
+ nicklist: nicklist
}
}
@@ -129,7 +137,39 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
}
}
+ /*
+ * Nick class
+ */
+ this.Nick = function(message) {
+ var prefix = message['prefix'];
+ var visible = message['visible'];
+ var name = message['name'];
+ var prefix_color = message['prefix_color'];
+ var color = message['color'];
+
+ return {
+ prefix: prefix,
+ visible: visible,
+ name: name,
+ prefix_color: prefix_color,
+ color: color
+ }
+ }
+ /*
+ * Nicklist Group class
+ */
+ this.NickGroup = function(message) {
+ var name = message['name'];
+ var visible = message['visible'];
+ var nicks = [];
+ return {
+ name: name,
+ visible: visible,
+ nicks: nicks
+ }
+ }
+
var BufferList = []
activeBuffer = null;
diff --git a/js/websockets.js b/js/websockets.js
index 5a515bd..573f180 100644
--- a/js/websockets.js
+++ b/js/websockets.js
@@ -114,6 +114,47 @@ weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootSc
});
}
+ /*
+ * Handle nicklist event
+ */
+ var handleNicklist = function(message) {
+ var nicklist = message['objects'][0]['content'];
+ var group = 'root';
+ nicklist.forEach(function(n) {
+ var buffer = models.getBuffer(n.pointers[0]);
+ if(n.group == 1) {
+ var g = new models.NickGroup(n);
+ group = g.name;
+ buffer.nicklist[group] = g;
+ }else{
+ var nick = new models.Nick(n);
+ buffer.nicklist[group].nicks.push(nick);
+ }
+ });
+ }
+ /*
+ * Handle nicklist diff event
+ */
+ var handleNicklistDiff = function(message) {
+ var nicklist = message['objects'][0]['content'];
+ var group;
+ nicklist.forEach(function(n) {
+ var buffer = models.getBuffer(n.pointers[0]);
+ var d = n['_diff'];
+ if(n.group == 1) {
+ group = buffer.nicklist[n.name];
+ }
+ if(d == 43) { // +
+ var nick = new models.Nick(n);
+ buffer.nicklist[group].nicks.push(nick);
+ }else if (d == 45) { // -
+ var nick = new models.Nick(n);
+ }else if (d == 42) { // *
+ var nick = new models.Nick(n);
+ }
+ });
+ }
+
var handleEvent = function(event) {
if (_.has(eventHandlers, event['id'])) {
@@ -127,13 +168,16 @@ weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootSc
_buffer_line_added: handleBufferLineAdded,
_buffer_opened: handleBufferOpened,
_buffer_title_changed: handleBufferTitleChanged,
- _buffer_renamed: handleBufferRenamed
+ _buffer_renamed: handleBufferRenamed,
+ _nicklist: handleNicklist,
+ _nicklist_diff: handleNicklistDiff
}
return {
handleEvent: handleEvent,
handleLineInfo: handleLineInfo,
- handleHotlistInfo: handleHotlistInfo
+ handleHotlistInfo: handleHotlistInfo,
+ handleNicklist: handleNicklist
}
}]);
@@ -237,6 +281,12 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers',
})).then(function(hdata) {
handlers.handleHotlistInfo(hdata)
});
+ }).then(function() {
+ $log.info("Requesting nicklist");
+ doSendWithCallback(weeChat.Protocol.formatNicklist({
+ })).then(function(nicklistdata) {
+ handlers.handleNicklist(nicklistdata)
+ });
}).then(function() {
doSend(weeChat.Protocol.formatSync({}));
$log.info("Synced");