angular.element('.im_history_col_wrap').data().$scope.peerHistories
.find(function(el) {
return el.peerID == angular.element('.im_history_col_wrap').data().$scope.selectedPeerID
}).messages
.filter(function(message) {
return typeof message.message == 'string' && message.message.length
})
.map(function(message) {
return {id: message.id, user: message.from_id, text: message.message}
})
.reverse()