Compare commits
No commits in common. "5d9d8ed72a3974208ec183cb1ab9beebf0d2018c" and "693e88bc015c8e22a51b9223d521f8a53bcef83a" have entirely different histories.
5d9d8ed72a
...
693e88bc01
@ -176,28 +176,41 @@ class AddressIdle implements ShouldQueue
|
||||
$age = Carbon::now()->subDays($days)->endOfDay();
|
||||
|
||||
return Address::select([
|
||||
'addresses.id',
|
||||
'system_id',
|
||||
'zone_id',
|
||||
'region_id',
|
||||
'host_id',
|
||||
'node_id',
|
||||
'point_id',
|
||||
'a.id',
|
||||
'a.system_id',
|
||||
'a.zone_id',
|
||||
'addresses.region_id',
|
||||
'a.host_id',
|
||||
'a.node_id',
|
||||
'a.point_id',
|
||||
'addresses.active',
|
||||
'hub_id',
|
||||
'role',
|
||||
'addresses.hub_id',
|
||||
'addresses.role',
|
||||
'addresses.updated_at',
|
||||
DB::raw('sum(a.uncollected_echomail) as uncollected_echomail'),
|
||||
DB::raw('sum(a.uncollected_netmail) as uncollected_netmail'),
|
||||
DB::raw('sum(a.uncollected_files) as uncollected_files')
|
||||
])
|
||||
->activeFTN()
|
||||
->from(
|
||||
Address::UncollectedEchomailTotal()
|
||||
->union(Address::UncollectedNetmailTotal())
|
||||
->union(Address::UncollectedFilesTotal()),'a')
|
||||
->where('systems.active',TRUE)
|
||||
->where(fn($query)=>$query->where('point_id',0)->orWhereNull('point_id'))
|
||||
->whereIn('addresses.id',our_nodes($do)->pluck('id'))
|
||||
->where('addresses.active',TRUE)
|
||||
->where('zones.active',TRUE)
|
||||
->where('domains.active',TRUE)
|
||||
->where(fn($query)=>$query->where('a.point_id',0)->orWhereNull('a.point_id'))
|
||||
->whereNotIn('a.id',our_address()->pluck('id'))
|
||||
->when($ao,fn($query)=>$query->where('addresses.id',$ao->id))
|
||||
->where(fn($q)=>$q->where('last_session','<',$age)->orWhereNull('last_session'))
|
||||
->whereRaw(sprintf('((role IS NULL) OR (role=0) OR ((role & %d) > 0))',$flags))
|
||||
->whereRaw(sprintf('((role & %d) = 0)',Address::NODE_KEEP))
|
||||
->join('systems',['systems.id'=>'addresses.system_id'])
|
||||
->where('last_session','<',$age)
|
||||
->where('domains.id',$do->id)
|
||||
->whereRaw(sprintf('((role IS NULL) OR ((role & %d) > 0))',$flags))
|
||||
->join('addresses',['addresses.id'=>'a.id'])
|
||||
->join('systems',['systems.id'=>'a.system_id'])
|
||||
->join('zones',['zones.id'=>'addresses.zone_id'])
|
||||
->join('domains',['domains.id'=>'zones.domain_id'])
|
||||
->ftnOrder()
|
||||
->groupBy('a.system_id','a.id','a.zone_id','addresses.region_id','a.host_id','a.node_id','a.point_id','addresses.hub_id','addresses.role','addresses.active','addresses.updated_at')
|
||||
->with(['system','zone.domain'])
|
||||
->dontCache()
|
||||
->get();
|
||||
|
@ -29,7 +29,7 @@ class EchomailListener implements ShouldQueue
|
||||
$ea = $event->eo->echoarea;
|
||||
|
||||
// Catch our messages that we've posted, so they dont go back
|
||||
if (preg_match('/^@.+:/',$event->eo->from))
|
||||
if (str_ends_with($event->eo->from,':'.config('matrix.server')))
|
||||
return;
|
||||
|
||||
if ($ea && collect(config('matrix.rooms'))->contains($ea->name)) {
|
||||
|
@ -52,10 +52,9 @@ class Address extends Model
|
||||
public const NODE_HC = 1<<3; // Hub
|
||||
public const NODE_NN = 1<<4; // Node
|
||||
public const NODE_PVT = 1<<5; // Pvt (we dont have address information) @todo
|
||||
public const NODE_HOLD = 1<<6; // Hold (user has requested hold, we havent heard from the node for 7 days
|
||||
public const NODE_DOWN = 1<<7; // Down we havent heard from the node for 30 days
|
||||
public const NODE_HOLD = 1<<6; // Hold (user has requested hold, we havent heard from the node for 7 days @todo
|
||||
public const NODE_DOWN = 1<<7; // Down we havent heard from the node for 30 days @todo
|
||||
public const NODE_POINT = 1<<8; // Point
|
||||
public const NODE_KEEP = 1<<9; // Dont mark an address hold/down or de-list automatically
|
||||
public const NODE_UNKNOWN = 1<<15; // Unknown
|
||||
public const NODE_ALL = 0x811f; // Mask to catch all nodes, excluding their status
|
||||
|
||||
|
@ -59,15 +59,13 @@ class Echomail extends Matrix
|
||||
Log::error(sprintf('%s:! Failed to set matrix room topic to [%s] in room [%s]',self::LOGKEY,$x,$room),['msg'=>$topic->body()]);
|
||||
}
|
||||
|
||||
$omsg = preg_replace("/\r---.*$/U",'',$this->o->msg);
|
||||
|
||||
$msg = Http::withToken(config('matrix.as_token'))
|
||||
->withQueryParameters(['user_id'=>$user])
|
||||
->post(sprintf('https://%s/_matrix/client/v3/rooms/%s/send/m.room.message',config('matrix.server'),$room),[
|
||||
'msgtype'=>'m.text',
|
||||
'format'=>'org.matrix.custom.html',
|
||||
'body'=>mb_convert_encoding(str_replace("\r","\n",$omsg),'UTF-8','IBM850'),
|
||||
'formatted_body'=>sprintf("<pre>\n%s\n</pre>",mb_convert_encoding(str_replace("\r","\n",$omsg),'UTF-8','IBM850')),
|
||||
'body'=>mb_convert_encoding(str_replace("\r","\n",$this->o->msg),'UTF-8','IBM850'),
|
||||
'formatted_body'=>sprintf("<pre>\n%s\n</pre>",mb_convert_encoding(str_replace("\r","\n",$this->o->msg),'UTF-8','IBM850')),
|
||||
]);
|
||||
|
||||
switch ($msg->status()) {
|
||||
|
Loading…
Reference in New Issue
Block a user