AutoCompleteFunction is back.

This commit is contained in:
Andrey Petrov committed 2014-12-25 00:37:50 -08:00
1 parent d3b0a56d78
commit 3bb4bbf991
2 files changed
+31 -15

No files matched your search

+11
View File
@@ -83,3 +83,14 @@ func (ch *Channel) Topic() string {
func (ch *Channel) SetTopic(s string) {
ch.topic = s
}
// NamesPrefix lists all members' names with a given prefix, used to query
// for autocompletion purposes.
func (ch *Channel) NamesPrefix(prefix string) []string {
users := ch.users.ListPrefix(prefix)
names := make([]string, len(users))
for i, u := range users {
names[i] = u.(*User).Name()
}
return names
}