MCPcopy Create free account
hub / github.com/asternic/wuzapi / SetPollOptions

Method SetPollOptions

clients.go:95–104  ·  view source on GitHub ↗

SetPollOptions remembers the plaintext options of a poll we just sent so that incoming votes (which arrive as SHA-256 hashes of the option text) can be resolved back to readable strings.

(userID, msgID string, options []string)

Source from the content-addressed store, hash-verified

93// that incoming votes (which arrive as SHA-256 hashes of the option text)
94// can be resolved back to readable strings.
95func (cm *ClientManager) SetPollOptions(userID, msgID string, options []string) {
96 cm.Lock()
97 defer cm.Unlock()
98 if cm.pollOptions[userID] == nil {
99 cm.pollOptions[userID] = make(map[string][]string)
100 }
101 stored := make([]string, len(options))
102 copy(stored, options)
103 cm.pollOptions[userID][msgID] = stored
104}
105
106// GetPollOptions returns the plaintext options associated with a poll
107// message, or nil if none were recorded (e.g. wuzapi restarted after the

Callers 1

SendPollMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected