void Social_send(int to, string msg);
+string Social_invite_accept;
+
void Social_parse(entity fh, entity pass, int status)
{
switch (status) {
print(input, "\n");
}
break;
+ case "invite": {
+ string s = url_fgets(fh);
+ printf("Player %d has invited you to %s; `menu_cmd saccept` to join\n", id, s);
+ Social_invite_accept = sprintf("\nconnect %s\n", s);
+ break;
+ }
default:
printf("Social_parse(): '%s'\n", cmd);
break;
Social_send(to, msg);
return true;
}
+ if (cmd_name == "sinvite" && cmd_argc == 2) {
+ int to = stoi(argv(1));
+ Social_send(to, sprintf("%s\n%s", "invite", g_server));
+ return true;
+ }
+ if (cmd_name == "saccept") {
+ ServerList_Connect(Social_invite_accept);
+ return true;
+ }
if (cmd_name == "srecv") {
Social_recv();
return true;
ENDCLASS(XonoticServerList)
entity makeXonoticServerList();
+string g_server;
+
#ifndef IMPLEMENTATION
float autocvar_menu_slist_categories;
float autocvar_menu_slist_categories_onlyifmultiple;
me.setSortOrder(me, f, me.currentSortOrder); // force resetting the sort order
}
}
+void ServerList_Connect(string s)
+{
+ g_server = s;
+ localcmd(sprintf("connect %s\n", g_server));
+}
void ServerList_Connect_Click(entity btn, entity me)
{
- localcmd(sprintf("connect %s\n",
- ((me.ipAddressBox.text != "") ?
- me.ipAddressBox.text : me.selectedServer
- )
- ));
+ ServerList_Connect((me.ipAddressBox.text != "")
+ ? me.ipAddressBox.text
+ : me.selectedServer);
}
void ServerList_Favorite_Click(entity btn, entity me)
{