Browse Source

Fix fullReload implementation and clarify numbers

master
Jason Chu 6 years ago
parent
commit
0ea0a1751a
  1. 2
      connect.go
  2. 2
      listen.go
  3. 4
      presence.go
  4. 6
      send.go

2
connect.go

@ -33,7 +33,7 @@ type accessibilityStruct struct {
}
func generateAccessibilityCookie() string {
now := time.Now().UnixNano() / 1000000
now := time.Now().UnixNano() / 1e6
access := accessibilityStruct{
Sr: 0,

2
listen.go

@ -303,7 +303,7 @@ func (s *Session) fullReload() {
form.Set("client", "mercury")
form.Set("folders[0]", "inbox")
form.Set("last_action_timestamp",
strconv.FormatInt(time.Now().Unix(), 10))
strconv.FormatInt((time.Now().UnixNano()/1e6)-60, 10))
form = s.addFormMeta(form)
req, _ := http.NewRequest(http.MethodPost, threadSyncURL,

4
presence.go

@ -81,10 +81,10 @@ func (s *Session) generatePresence() string {
Ut: 0,
T2: []int{},
Lm2: nil,
Uct2: now.UnixNano() / 1000000,
Uct2: now.UnixNano() / 1e6,
Tr: nil,
Tw: largeRandomNumber(),
At: now.UnixNano() / 1000000,
At: now.UnixNano() / 1e6,
},
Ch: map[string]int{
"p_" + s.userID: 0,

6
send.go

@ -52,7 +52,7 @@ func (s *Session) SendMessage(msg *Message) (string, error) {
"client": []string{"mercury"},
"message_batch[0][action_type]": []string{"ma-type:user-generated-message"},
"message_batch[0][author]": []string{"fbid:" + s.userID},
"message_batch[0][timestamp]": []string{strconv.FormatInt(time.Now().UnixNano()/1000000, 10)},
"message_batch[0][timestamp]": []string{strconv.FormatInt(time.Now().UnixNano()/1e6, 10)},
"message_batch[0][timestamp_absolute]": []string{"Today"},
"message_batch[0][timestamp_relative]": []string{time.Now().Format("15:04")},
"message_batch[0][timestamp_time_passed]": []string{"0"},
@ -134,7 +134,7 @@ func generateOfflineThreadID() string {
random = random[:22]
}
now := strconv.FormatInt(time.Now().UnixNano()/1000000, 2)
now := strconv.FormatInt(time.Now().UnixNano()/1e6, 2)
n, err := strconv.ParseInt(now+random, 2, 64)
if err != nil {
// If this happens, it's the end of the world.
@ -145,7 +145,7 @@ func generateOfflineThreadID() string {
}
func (s *Session) generateThreadID() string {
now := strconv.FormatInt(time.Now().UnixNano()/1000000, 10)
now := strconv.FormatInt(time.Now().UnixNano()/1e6, 10)
r := strconv.FormatInt(largeRandomNumber(), 10)
return "<" + now + ":" + r + "-" + s.clientID + "@mail.projektitan.com>"
}

Loading…
Cancel
Save