diff --git a/src/pyoscar/proto/flap/skel.py b/src/pyoscar/proto/flap/skel.py new file mode 100644 index 0000000..b8c7d57 --- /dev/null +++ b/src/pyoscar/proto/flap/skel.py @@ -0,0 +1,32 @@ +# Copyright © 2024 Nicole O'Connor +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FLAP__MARKER = b"*" +FLAP__FRAME_SIGNON = 0x1 +FLAP__FRAME_DATA = 0x2 +FLAP__FRAME_ERROR = 0x3 +FLAP__FRAME_SIGNOFF = 0x4 +FLAP__FRAME_KEEP_ALIVE = 0x5 + +FLAP__SEQUENCE = -1 + +class FlapFrame: + payload: bytes = None + + # str() or bytes() should return the raw frame data + def __bytes__(self): + return self.payload + def __str__(self): + return self.payload.decode() + diff --git a/src/pyoscar/proto/flap/snacs.py b/src/pyoscar/proto/flap/snacs.py index 8331c59..d397428 100644 --- a/src/pyoscar/proto/flap/snacs.py +++ b/src/pyoscar/proto/flap/snacs.py @@ -147,4 +147,5 @@ BUDDY__REJECT_NOTIFICATION = 0xA # sent if a user has too many watchers BUDDY__ARRIVED = 0xB # your friend is online BUDDY__DEPARTED = 0xC # your friend is offline BUDDY__ADD_TEMP_BUDDIES = 0xF # temporary buddy list -BUDDY__DEL_TEMP_BUDDIES = 0x10 \ No newline at end of file +BUDDY__DEL_TEMP_BUDDIES = 0x10 +