Replace Itoa with FormatInt

This commit is contained in:
bodqhrohro 2019-12-04 21:29:57 +02:00
parent 133d787d38
commit fa841bfa8b
2 changed files with 8 additions and 8 deletions

View file

@ -142,7 +142,7 @@ func (c *Client) updateNewChat(update *client.UpdateNewChat) {
gateway.SendPresence(
c.xmpp,
c.jid,
gateway.SPFrom(strconv.Itoa(int(update.Chat.Id))),
gateway.SPFrom(strconv.FormatInt(update.Chat.Id, 10)),
gateway.SPType("subscribe"),
gateway.SPNickname(update.Chat.Title),
)
@ -202,7 +202,7 @@ func (c *Client) updateNewMessage(update *client.UpdateNewMessage) {
ForceRead: true,
})
// 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

View file

@ -167,7 +167,7 @@ func (c *Client) processStatusUpdate(chatID int64, status string, show string, a
gateway.SendPresence(
c.xmpp,
c.jid,
gateway.SPFrom(strconv.Itoa(int(chatID))),
gateway.SPFrom(strconv.FormatInt(chatID, 10)),
gateway.SPShow(show),
gateway.SPStatus(status),
gateway.SPPhoto(photo),
@ -193,12 +193,12 @@ func (c *Client) formatContact(chatID int64) string {
} else if user != nil {
username := user.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)
} else {
str = strconv.Itoa(int(chatID))
str = strconv.FormatInt(chatID, 10)
}
str = spaceRegex.ReplaceAllString(str, " ")
@ -350,7 +350,7 @@ func (c *Client) contentToFilename(content client.MessageContent) (*client.File,
sizes := photo.Photo.Sizes
if len(sizes) > 1 {
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, ""
case client.TypeMessageAudio:
@ -376,7 +376,7 @@ func (c *Client) messageToPrefix(message *client.Message, fileString string) str
} else {
directionChar = "⬅ "
}
prefix = append(prefix, directionChar+strconv.Itoa(int(message.Id)))
prefix = append(prefix, directionChar+strconv.FormatInt(message.Id, 10))
// show sender in group chats
if message.ChatId < 0 && message.SenderUserId != 0 {
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
response, isCommand := c.ProcessChatCommand(text)
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
if isCommand {