mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-04-15 15:57:47 +02:00
Add protobuf message type Image and Friend_Avatar.
Also adds Friend_Avatar to the Common_Message list of possible messages.
This commit is contained in:
parent
75035de2f4
commit
f560fce352
4 changed files with 36 additions and 1 deletions
|
@ -125,6 +125,7 @@ inline void reset_LastError()
|
|||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
|
@ -220,4 +221,6 @@ inline std::string ascii_to_lowercase(std::string data) {
|
|||
|
||||
#define LOBBY_CONNECT_APPID ((uint32)-2)
|
||||
|
||||
#endif//__INCLUDED_COMMON_INCLUDES__
|
||||
#define FRIEND_AVATAR_MAX_IMAGE_LENGTH (5 * 1024 * 1024)
|
||||
|
||||
#endif//__INCLUDED_COMMON_INCLUDES__
|
|
@ -179,6 +179,31 @@ message Friend {
|
|||
uint64 lobby_id = 5;
|
||||
}
|
||||
|
||||
message Image {
|
||||
enum MessageTypes {
|
||||
REQUEST = 0;
|
||||
NOTIFY = 1;
|
||||
}
|
||||
|
||||
enum ImgTypes {
|
||||
RAW = 0;
|
||||
JPG = 1;
|
||||
PNG = 2;
|
||||
GIF = 3;
|
||||
}
|
||||
|
||||
MessageTypes type = 1;
|
||||
ImgTypes img_type = 2;
|
||||
uint32 img_width = 3;
|
||||
uint32 img_height = 4;
|
||||
uint32 img_components = 5;
|
||||
bytes img_data = 6;
|
||||
}
|
||||
|
||||
message Friend_Avatar {
|
||||
Image img = 1;
|
||||
}
|
||||
|
||||
message Auth_Ticket {
|
||||
uint32 number = 1;
|
||||
|
||||
|
@ -230,6 +255,7 @@ message Common_Message {
|
|||
Networking_Sockets networking_sockets = 13;
|
||||
Steam_Messages steam_messages = 14;
|
||||
Networking_Messages networking_messages = 15;
|
||||
Friend_Avatar friend_avatar = 16;
|
||||
}
|
||||
|
||||
uint32 source_ip = 128;
|
||||
|
|
|
@ -581,6 +581,11 @@ void Networking::do_callbacks_message(Common_Message *msg)
|
|||
PRINT_DEBUG("has_networking_messages\n");
|
||||
run_callbacks(CALLBACK_ID_NETWORKING_MESSAGES, msg);
|
||||
}
|
||||
|
||||
if (msg->has_friend_avatar()) {
|
||||
PRINT_DEBUG("has_friend_avatar\n");
|
||||
run_callbacks(CALLBACK_ID_FRIEND_AVATAR, msg);
|
||||
}
|
||||
}
|
||||
|
||||
bool Networking::handle_tcp(Common_Message *msg, struct TCP_Socket &socket)
|
||||
|
|
|
@ -61,6 +61,7 @@ enum Callback_Ids {
|
|||
CALLBACK_ID_NETWORKING_SOCKETS,
|
||||
CALLBACK_ID_STEAM_MESSAGES,
|
||||
CALLBACK_ID_NETWORKING_MESSAGES,
|
||||
CALLBACK_ID_FRIEND_AVATAR,
|
||||
|
||||
CALLBACK_IDS_MAX
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue