Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <loudmouth/loudmouth.h>
- int connect() {
- LmConnection *connection = NULL;
- GError *error = NULL;
- char* server = "server";
- char* username = "moi";
- char* password = "coincoin";
- char* ressource = "test";
- connection = lm_connection_new(server);
- if (!lm_connection_open_and_block (connection, &error)) {
- g_print ("Couldn't open connection to '%s'\n%s\n",
- server, error->message);
- return -1;
- }
- if (!lm_connection_authenticate_and_block (connection, username, password,
- ressource, &error)) {
- g_print ("Couldn't authenticate with '%s' '%s':\n%s\n",
- username, password, error->message);
- return -1;
- }
- printf("Account %s@%s is connected\n", username, server);
- lm_connection_close (connection, NULL);
- lm_connection_unref (connection);
- return 0;
- }
- int main()
- {
- return connect();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement