diff --git a/lib/messages/search_entry.js b/lib/messages/search_entry.js index 3daa52c..3a8a1a2 100644 --- a/lib/messages/search_entry.js +++ b/lib/messages/search_entry.js @@ -59,6 +59,30 @@ function SearchEntry(options) { }); return obj; }); + + this.__defineGetter__('raw', function () { + var obj = { + dn: self.dn.toString(), + controls: [] + }; + + self.attributes.forEach(function (a) { + if (a.buffers && a.buffers.length) { + if (a.buffers.length > 1) { + obj[a.type] = a.buffers.slice(); + } else { + obj[a.type] = a.buffers[0]; + } + } else { + obj[a.type] = []; + } + }); + self.controls.forEach(function (element, index, array) { + obj.controls.push(element.json); + }); + return obj; + }); + this.__defineGetter__('_dn', function () { return self.objectName; });