mirror of
https://github.com/openvk/openvk
synced 2024-11-11 01:19:53 +03:00
VKAPI: Add force online activity reporting on Newsfeed.get and Messages.send functions (can be disabled trough forGodSakePleaseDoNotReportAboutMyOnlineActivity parameter)
This commit is contained in:
parent
05a423b30b
commit
2ffa4fd916
3 changed files with 14 additions and 6 deletions
|
@ -45,9 +45,7 @@ final class Account extends VKAPIRequestHandler
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
$this->getUser()->setOnline(time());
|
$this->getUser()->updOnline($this->getPlatform());
|
||||||
$this->getUser()->setClient_name($this->getPlatform());
|
|
||||||
$this->getUser()->save();
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,11 +65,16 @@ final class Messages extends VKAPIRequestHandler
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function send(int $user_id = -1, int $peer_id = -1, string $domain = "", int $chat_id = -1, string $user_ids = "", string $message = "", int $sticker_id = -1)
|
function send(int $user_id = -1, int $peer_id = -1, string $domain = "", int $chat_id = -1, string $user_ids = "", string $message = "", int $sticker_id = -1, int $forGodSakePleaseDoNotReportAboutMyOnlineActivity = 0)
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
$this->willExecuteWriteAction();
|
$this->willExecuteWriteAction();
|
||||||
|
|
||||||
|
if($forGodSakePleaseDoNotReportAboutMyOnlineActivity == 0)
|
||||||
|
{
|
||||||
|
$this->getUser()->updOnline($this->getPlatform());
|
||||||
|
}
|
||||||
|
|
||||||
if($chat_id !== -1)
|
if($chat_id !== -1)
|
||||||
$this->fail(946, "Chats are not implemented");
|
$this->fail(946, "Chats are not implemented");
|
||||||
else if($sticker_id !== -1)
|
else if($sticker_id !== -1)
|
||||||
|
|
|
@ -7,10 +7,15 @@ use openvk\VKAPI\Handlers\Wall;
|
||||||
|
|
||||||
final class Newsfeed extends VKAPIRequestHandler
|
final class Newsfeed extends VKAPIRequestHandler
|
||||||
{
|
{
|
||||||
function get(string $fields = "", int $start_from = 0, int $offset = 0, int $count = 30, int $extended = 0)
|
function get(string $fields = "", int $start_from = 0, int $offset = 0, int $count = 30, int $extended = 0, int $forGodSakePleaseDoNotReportAboutMyOnlineActivity = 0)
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
|
if($forGodSakePleaseDoNotReportAboutMyOnlineActivity == 0)
|
||||||
|
{
|
||||||
|
$this->getUser()->updOnline($this->getPlatform());
|
||||||
|
}
|
||||||
|
|
||||||
$id = $this->getUser()->getId();
|
$id = $this->getUser()->getId();
|
||||||
$subs = DatabaseConnection::i()
|
$subs = DatabaseConnection::i()
|
||||||
->getContext()
|
->getContext()
|
||||||
|
|
Loading…
Reference in a new issue