diff options
| -rw-r--r-- | skype/Makefile | 2 | ||||
| -rw-r--r-- | skype/client.c | 43 | 
2 files changed, 45 insertions, 0 deletions
| diff --git a/skype/Makefile b/skype/Makefile index 1f682f7c..00cc533f 100644 --- a/skype/Makefile +++ b/skype/Makefile @@ -4,6 +4,8 @@ LDFLAGS += $(shell pkg-config --libs bitlbee)  skype.so: skype.c  	gcc -o skype.so -shared skype.c $(CFLAGS) +client: client.c +  clean:  	rm -f skype.so diff --git a/skype/client.c b/skype/client.c new file mode 100644 index 00000000..66a3f770 --- /dev/null +++ b/skype/client.c @@ -0,0 +1,43 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <arpa/inet.h> +#include <sys/types.h> +#include <netinet/in.h> +#include <sys/socket.h> + +#define MESSAGE_LEN 1023 +#define PORTNUM 2727 + +char *invoke(int sock, char *cmd) +{ +	char buf[MESSAGE_LEN+1]; +	int len; + +	write(sock, cmd, strlen(cmd)); +	len = recv(sock, buf, MESSAGE_LEN, 0); +	buf[len] = '\0'; +	return strdup(buf); +} + +int main(int argc, char *argv[]) +{ +	int sock; +	struct sockaddr_in dest; +	char *ptr; + +	sock = socket(AF_INET, SOCK_STREAM, 0); + +	memset(&dest, 0, sizeof(dest)); +	dest.sin_family = AF_INET; +	dest.sin_addr.s_addr = inet_addr("127.0.0.1"); +	dest.sin_port = htons(PORTNUM); + +	connect(sock, (struct sockaddr *)&dest, sizeof(struct sockaddr)); + +	ptr = invoke(sock, "SET USER foo ISAUTHORIZED FALSE"); +	printf("ptr: '%s'\n", ptr); +	close(sock); +	return(0); +} | 
