Skip to content

Commit c2ae559

Browse files
committed
formatting: just nicer getFile()
1 parent 822c2da commit c2ae559

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/UniversalTelegramBot.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ bool UniversalTelegramBot::processResult(JsonObject result, int messageIndex) {
522522
String file_id = message["document"]["file_id"].as<String>();
523523
messages[messageIndex].file_caption = message["caption"].as<String>();
524524
messages[messageIndex].file_name = message["document"]["file_name"].as<String>();
525-
if (getFile(&messages[messageIndex].file_path, &messages[messageIndex].file_size, file_id) == true)
525+
if (getFile(messages[messageIndex].file_path, messages[messageIndex].file_size, file_id) == true)
526526
messages[messageIndex].hasDocument = true;
527527
else
528528
messages[messageIndex].hasDocument = false;
@@ -818,7 +818,7 @@ void UniversalTelegramBot::closeClient() {
818818
}
819819
}
820820

821-
bool UniversalTelegramBot::getFile(String *file_path, long *file_size, String file_id)
821+
bool UniversalTelegramBot::getFile(String& file_path, long& file_size, const String& file_id)
822822
{
823823
String command = BOT_CMD("getFile?file_id=");
824824
command += file_id;
@@ -829,9 +829,9 @@ bool UniversalTelegramBot::getFile(String *file_path, long *file_size, String fi
829829

830830
if (!error) {
831831
if (doc.containsKey("result")) {
832-
*file_path = F("https://api.telegram.org/file/");
833-
*file_path += buildCommand(doc["result"]["file_path"]);
834-
*file_size = doc["result"]["file_size"].as<long>();
832+
file_path = F("https://api.telegram.org/file/");
833+
file_path += buildCommand(doc["result"]["file_path"]);
834+
file_size = doc["result"]["file_size"].as<long>();
835835
return true;
836836
}
837837
}

src/UniversalTelegramBot.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class UniversalTelegramBot {
122122
String _token;
123123
Client *client;
124124
void closeClient();
125-
bool getFile(String *, long *, String);
125+
bool getFile(String& file_path, long& file_size, const String& file_id);
126126
bool processResult(JsonObject result, int messageIndex);
127127
};
128128

0 commit comments

Comments
 (0)