Compare commits

...

3 Commits
main ... main

Author SHA1 Message Date
Boris c80f7171d1 Oups, oubli. 2022-12-02 15:04:00 +01:00
Boris bfa50d3574 Messenger : ajout gestion des correspondants qui ont supprimé leur profil Gchange 2022-12-02 12:50:48 +01:00
Boris 291f23f514 test 2022-11-27 20:00:27 +01:00
5 changed files with 27 additions and 3 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ cache/
tests/
minelife.html
vendors/keygen/__pycache__
erreurs/

View File

@ -44,6 +44,13 @@ class GchangeUser {
}
}
static public function constructVoidUser ($pubkey) {
$this->userGchangeId = $pubkey;
$this->userName = substr($this->userGchangeId, 0, 8);
}
public function getUserGchangeId () {
return $this->userGchangeId;

View File

@ -62,7 +62,7 @@ class Jaklis {
$cmd .= ' read';
$cmd .= ' --number ' . $this->msgLimit;
$cmd .= ' --json';
$output=null;
$result_code=null;
exec($cmd, $output, $result_code);

View File

@ -81,7 +81,16 @@ class Messenger {
if (!isset($users[$penpalPubkey])) {
$this->users[$penpalPubkey] = $this->gchange->getUser($penpalPubkey);
try {
$user = $this->gchange->getUser($penpalPubkey);
$this->users[$penpalPubkey] = $user;
} catch (Exception $e) {
$this->users[$penpalPubkey] = GchangeUser::constructVoidUser($penpalPubkey);
}
}
}
public function getConversation ($penpalGchangeId) {

View File

@ -42,7 +42,14 @@ try {
// echo '<pre>'; var_dump($msgOut); echo '</pre>';
// die();
$messenger->addMessages($msgIn, $msgOut);
try {
$messenger->addMessages($msgIn, $msgOut);
} catch (Exception $e) {
// L'utilisateur {...} n'a été trouvé nulle part.
}
// echo '<pre>'; var_dump($messenger->getConversations()); echo '</pre>';