[libgadu-commit] r637 - trunk/examples
Libgadu commit list
libgadu-commit at lists.ziew.org
Thu Oct 23 23:47:33 CEST 2008
Author: wojtekka
Date: 2008-10-23 23:47:32 +0200 (Thu, 23 Oct 2008)
New Revision: 637
Added:
trunk/examples/status.c
Modified:
trunk/examples/
trunk/examples/Makefile.am
Log:
Dodanie programu do testowej zmiany opisu.
Property changes on: trunk/examples
___________________________________________________________________
Name: svn:ignore
- Makefile
Makefile.in
conn-async
httphash
register-async
register-sync
remind-async
remind-sync
send
.deps
.libs
+ Makefile
Makefile.in
conn-async
httphash
register-async
register-sync
remind-async
remind-sync
send
status
.deps
.libs
Modified: trunk/examples/Makefile.am
===================================================================
--- trunk/examples/Makefile.am 2008-10-23 21:46:04 UTC (rev 636)
+++ trunk/examples/Makefile.am 2008-10-23 21:47:32 UTC (rev 637)
@@ -1,4 +1,4 @@
-noinst_PROGRAMS = send httphash conn-async register-sync register-async remind-sync remind-async
+noinst_PROGRAMS = send httphash conn-async register-sync register-async remind-sync remind-async status
LDADD = ../src/libgadu.la
register_sync_SOURCES = register.c
Added: trunk/examples/status.c
===================================================================
--- trunk/examples/status.c (rev 0)
+++ trunk/examples/status.c 2008-10-23 21:47:32 UTC (rev 637)
@@ -0,0 +1,51 @@
+/*
+ * przykład prostego programu łączącego się z serwerem i zmieniającego opis.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include "libgadu.h"
+
+int main(int argc, char **argv)
+{
+ struct gg_session *gs;
+ struct gg_login_params glp;
+
+ if (argc < 4) {
+ fprintf(stderr, "użycie: %s <mójnumerek> <mojehasło> <opis>\n", argv[0]);
+ return 1;
+ }
+
+ gg_debug_level = 255;
+
+ memset(&glp, 0, sizeof(glp));
+ glp.uin = atoi(argv[1]);
+ glp.password = argv[2];
+// glp.encoding = GG_ENCODING_UTF8;
+// glp.protocol_version = 0x2d;
+ glp.status = GG_STATUS_INVISIBLE_DESCR;
+ glp.status_descr = argv[3];
+
+ if (!(gs = gg_login(&glp))) {
+ printf("Nie udało się połączyć: %s\n", strerror(errno));
+ gg_free_session(gs);
+ return 1;
+ }
+
+ gg_notify(gs, NULL, 0);
+
+ printf("Połączono.\n");
+
+ if (gg_change_status_descr(gs, GG_STATUS_NOT_AVAIL_DESCR, argv[3]) == -1) {
+ printf("Połączenie przerwane: %s\n", strerror(errno));
+ gg_free_session(gs);
+ return 1;
+ }
+
+ gg_logoff(gs);
+ gg_free_session(gs);
+
+ return 0;
+}
More information about the libgadu-commit
mailing list