X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=examples%2Fchatpp.cc;h=26ffde596cc864eddfa94740173d335c5fecf2b1;hb=92bae04187d9ecd7900b5a28154a2c046001a7f3;hp=294ca866f602fb692eb6e37c39b8c817a07fd950;hpb=9d23fe58052b3ef971305699a00ea6dbd1111744;p=meshlink-tiny diff --git a/examples/chatpp.cc b/examples/chatpp.cc index 294ca86..26ffde5 100644 --- a/examples/chatpp.cc +++ b/examples/chatpp.cc @@ -2,7 +2,7 @@ #include #include #include -#include "../src/meshlink++.h" +#include "../src/meshlink-tiny++.h" class ChatMesh : public meshlink::mesh { public: @@ -41,24 +41,7 @@ static void parse_command(meshlink::mesh *mesh, char *buf) { *arg++ = 0; } - if(!strcasecmp(buf, "invite")) { - char *invitation; - - if(!arg) { - fprintf(stderr, "/invite requires an argument!\n"); - return; - } - - invitation = mesh->invite(NULL, arg); - - if(!invitation) { - fprintf(stderr, "Could not invite '%s': %s\n", arg, meshlink::strerror()); - return; - } - - printf("Invitation for %s: %s\n", arg, invitation); - free(invitation); - } else if(!strcasecmp(buf, "join")) { + if(!strcasecmp(buf, "join")) { if(!arg) { fprintf(stderr, "/join requires an argument!\n"); return; @@ -76,22 +59,6 @@ static void parse_command(meshlink::mesh *mesh, char *buf) { fprintf(stderr, "Could not restart MeshLink: %s\n", meshlink::strerror()); exit(1); } - } else if(!strcasecmp(buf, "kick")) { - if(!arg) { - fprintf(stderr, "/kick requires an argument!\n"); - return; - } - - meshlink::node *node = mesh->get_node(arg); - - if(!node) { - fprintf(stderr, "Error looking up '%s': %s\n", arg, meshlink::strerror()); - return; - } - - mesh->blacklist(node); - - printf("Node '%s' blacklisted.\n", arg); } else if(!strcasecmp(buf, "who")) { if(!arg) { nodes = mesh->get_all_nodes(nodes, &nnodes); @@ -123,7 +90,6 @@ static void parse_command(meshlink::mesh *mesh, char *buf) { printf( ": Send a message to the given node.\n" " Subsequent messages don't need the : prefix.\n" - "/invite Create an invitation for a new node.\n" "/join Join an existing mesh using an invitation.\n" "/kick Blacklist the given node.\n" "/who [] List all nodes or show information about the given node.\n"