Replace Itoa with FormatInt
This commit is contained in:
parent
133d787d38
commit
fa841bfa8b
|
@ -142,7 +142,7 @@ func (c *Client) updateNewChat(update *client.UpdateNewChat) {
|
||||||
gateway.SendPresence(
|
gateway.SendPresence(
|
||||||
c.xmpp,
|
c.xmpp,
|
||||||
c.jid,
|
c.jid,
|
||||||
gateway.SPFrom(strconv.Itoa(int(update.Chat.Id))),
|
gateway.SPFrom(strconv.FormatInt(update.Chat.Id, 10)),
|
||||||
gateway.SPType("subscribe"),
|
gateway.SPType("subscribe"),
|
||||||
gateway.SPNickname(update.Chat.Title),
|
gateway.SPNickname(update.Chat.Title),
|
||||||
)
|
)
|
||||||
|
@ -202,7 +202,7 @@ func (c *Client) updateNewMessage(update *client.UpdateNewMessage) {
|
||||||
ForceRead: true,
|
ForceRead: true,
|
||||||
})
|
})
|
||||||
// forward message to XMPP
|
// forward message to XMPP
|
||||||
gateway.SendMessage(c.jid, strconv.Itoa(int(update.Message.ChatId)), text, c.xmpp)
|
gateway.SendMessage(c.jid, strconv.FormatInt(update.Message.ChatId, 10), text, c.xmpp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// message content updated
|
// message content updated
|
||||||
|
|
|
@ -167,7 +167,7 @@ func (c *Client) processStatusUpdate(chatID int64, status string, show string, a
|
||||||
gateway.SendPresence(
|
gateway.SendPresence(
|
||||||
c.xmpp,
|
c.xmpp,
|
||||||
c.jid,
|
c.jid,
|
||||||
gateway.SPFrom(strconv.Itoa(int(chatID))),
|
gateway.SPFrom(strconv.FormatInt(chatID, 10)),
|
||||||
gateway.SPShow(show),
|
gateway.SPShow(show),
|
||||||
gateway.SPStatus(status),
|
gateway.SPStatus(status),
|
||||||
gateway.SPPhoto(photo),
|
gateway.SPPhoto(photo),
|
||||||
|
@ -193,12 +193,12 @@ func (c *Client) formatContact(chatID int64) string {
|
||||||
} else if user != nil {
|
} else if user != nil {
|
||||||
username := user.Username
|
username := user.Username
|
||||||
if username == "" {
|
if username == "" {
|
||||||
username = strconv.Itoa(int(user.Id))
|
username = strconv.FormatInt(int64(user.Id), 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
str = fmt.Sprintf("%s %s (%v)", user.FirstName, user.LastName, username)
|
str = fmt.Sprintf("%s %s (%v)", user.FirstName, user.LastName, username)
|
||||||
} else {
|
} else {
|
||||||
str = strconv.Itoa(int(chatID))
|
str = strconv.FormatInt(chatID, 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
str = spaceRegex.ReplaceAllString(str, " ")
|
str = spaceRegex.ReplaceAllString(str, " ")
|
||||||
|
@ -350,7 +350,7 @@ func (c *Client) contentToFilename(content client.MessageContent) (*client.File,
|
||||||
sizes := photo.Photo.Sizes
|
sizes := photo.Photo.Sizes
|
||||||
if len(sizes) > 1 {
|
if len(sizes) > 1 {
|
||||||
file := sizes[len(sizes)-1].Photo
|
file := sizes[len(sizes)-1].Photo
|
||||||
return file, strconv.Itoa(int(file.Id)) + ".jpg"
|
return file, strconv.FormatInt(int64(file.Id), 10) + ".jpg"
|
||||||
}
|
}
|
||||||
return nil, ""
|
return nil, ""
|
||||||
case client.TypeMessageAudio:
|
case client.TypeMessageAudio:
|
||||||
|
@ -376,7 +376,7 @@ func (c *Client) messageToPrefix(message *client.Message, fileString string) str
|
||||||
} else {
|
} else {
|
||||||
directionChar = "⬅ "
|
directionChar = "⬅ "
|
||||||
}
|
}
|
||||||
prefix = append(prefix, directionChar+strconv.Itoa(int(message.Id)))
|
prefix = append(prefix, directionChar+strconv.FormatInt(message.Id, 10))
|
||||||
// show sender in group chats
|
// show sender in group chats
|
||||||
if message.ChatId < 0 && message.SenderUserId != 0 {
|
if message.ChatId < 0 && message.SenderUserId != 0 {
|
||||||
prefix = append(prefix, c.formatContact(int64(message.SenderUserId)))
|
prefix = append(prefix, c.formatContact(int64(message.SenderUserId)))
|
||||||
|
@ -415,7 +415,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, messageID int
|
||||||
// try to execute a command
|
// try to execute a command
|
||||||
response, isCommand := c.ProcessChatCommand(text)
|
response, isCommand := c.ProcessChatCommand(text)
|
||||||
if response != "" {
|
if response != "" {
|
||||||
gateway.SendMessage(returnJid, strconv.Itoa(int(chatID)), response, c.xmpp)
|
gateway.SendMessage(returnJid, strconv.FormatInt(chatID, 10), response, c.xmpp)
|
||||||
}
|
}
|
||||||
// do not send on success
|
// do not send on success
|
||||||
if isCommand {
|
if isCommand {
|
||||||
|
|
Loading…
Reference in a new issue