-
Notifications
You must be signed in to change notification settings - Fork 6
/
store.go
39 lines (34 loc) · 760 Bytes
/
store.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package skype
type Store struct {
Contacts map[string]Contact
Chats map[string]Conversation
}
func newStore() *Store {
return &Store{
make(map[string]Contact),
make(map[string]Conversation),
}
}
func (c *Conn) updateContacts(contacts []Contact) {
for _, contact := range contacts {
contact.PersonId = contact.PersonId + "@s.skype.net"
c.Store.Contacts[contact.PersonId] = contact
}
}
// chats includes group conversation and private conversation
func (c *Conn) updateChats(chats []Conversation) {
//ch, ok := chats.([]interface{})
//if !ok {
// return
//}
for _, chat := range chats {
//chatNode, ok := chat.(Conversation)
//if !ok {
// continue
//}
id, ok := chat.Id.(string)
if ok {
c.Store.Chats[id] = chat
}
}
}