Mercurial > pidgin
annotate libpurple/example/nullclient.c @ 25122:9525fb966efb
theme loader cleanup, and remove a few warnings
author | Justin Rodriguez <ffdragon@soc.pidgin.im> |
---|---|
date | Tue, 26 Aug 2008 08:28:25 +0000 |
parents | 68f8adb67470 |
children | aaaff38e144f 3015b7c2bec3 |
rev | line source |
---|---|
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 /* |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 * pidgin |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 * |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 * Pidgin is the legal property of its developers, whose names are too numerous |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 * source distribution. |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 * |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 * (at your option) any later version. |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 * |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 * |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19567
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 * |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 */ |
18210
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
18013
diff
changeset
|
23 |
22151
68f8adb67470
'make -f Makefile.oot' will successfully compile the nullclient out-of-tree.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22067
diff
changeset
|
24 #include "purple.h" |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 #include <glib.h> |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 |
22151
68f8adb67470
'make -f Makefile.oot' will successfully compile the nullclient out-of-tree.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22067
diff
changeset
|
28 #include <signal.h> |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 #include <string.h> |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 #include <unistd.h> |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 #include "defines.h" |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 /** |
15822 | 35 * The following eventloop functions are used in both pidgin and purple-text. If your |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 * application uses glib mainloop, you can safely use this verbatim. |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 */ |
15822 | 38 #define PURPLE_GLIB_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) |
39 #define PURPLE_GLIB_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) | |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 |
15822 | 41 typedef struct _PurpleGLibIOClosure { |
42 PurpleInputFunction function; | |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 guint result; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 gpointer data; |
15822 | 45 } PurpleGLibIOClosure; |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 |
15822 | 47 static void purple_glib_io_destroy(gpointer data) |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 { |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 g_free(data); |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 } |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 |
15822 | 52 static gboolean purple_glib_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 { |
15822 | 54 PurpleGLibIOClosure *closure = data; |
55 PurpleInputCondition purple_cond = 0; | |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 |
15822 | 57 if (condition & PURPLE_GLIB_READ_COND) |
58 purple_cond |= PURPLE_INPUT_READ; | |
59 if (condition & PURPLE_GLIB_WRITE_COND) | |
60 purple_cond |= PURPLE_INPUT_WRITE; | |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 closure->function(closure->data, g_io_channel_unix_get_fd(source), |
15822 | 63 purple_cond); |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 return TRUE; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 } |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 |
15822 | 68 static guint glib_input_add(gint fd, PurpleInputCondition condition, PurpleInputFunction function, |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 gpointer data) |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 { |
15822 | 71 PurpleGLibIOClosure *closure = g_new0(PurpleGLibIOClosure, 1); |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 GIOChannel *channel; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 GIOCondition cond = 0; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 closure->function = function; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 closure->data = data; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 |
15822 | 78 if (condition & PURPLE_INPUT_READ) |
79 cond |= PURPLE_GLIB_READ_COND; | |
80 if (condition & PURPLE_INPUT_WRITE) | |
81 cond |= PURPLE_GLIB_WRITE_COND; | |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
82 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 channel = g_io_channel_unix_new(fd); |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, |
15822 | 85 purple_glib_io_invoke, closure, purple_glib_io_destroy); |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 g_io_channel_unref(channel); |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 return closure->result; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 } |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 |
15822 | 91 static PurpleEventLoopUiOps glib_eventloops = |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 { |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 g_timeout_add, |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 g_source_remove, |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
95 glib_input_add, |
15693
cd02b303b81f
Fix the following compiler warning:
Mark Doliner <mark@kingant.net>
parents:
15617
diff
changeset
|
96 g_source_remove, |
16668
07cf49a0f404
I _think_ this is it for libpurple's padding...
Gary Kramlich <grim@reaperworld.com>
parents:
16098
diff
changeset
|
97 NULL, |
18013
58e82c3b697e
It's GLIB_CHECK_VERSION, not GLIB_VERSION_CHECK.
Richard Laager <rlaager@wiktel.com>
parents:
18009
diff
changeset
|
98 #if GLIB_CHECK_VERSION(2,14,0) |
18009
9ffa9af32854
Wire in g_timeout_add_seconds for Finch and nullclient as well.
Richard Laager <rlaager@wiktel.com>
parents:
17080
diff
changeset
|
99 g_timeout_add_seconds, |
9ffa9af32854
Wire in g_timeout_add_seconds for Finch and nullclient as well.
Richard Laager <rlaager@wiktel.com>
parents:
17080
diff
changeset
|
100 #else |
9ffa9af32854
Wire in g_timeout_add_seconds for Finch and nullclient as well.
Richard Laager <rlaager@wiktel.com>
parents:
17080
diff
changeset
|
101 NULL, |
9ffa9af32854
Wire in g_timeout_add_seconds for Finch and nullclient as well.
Richard Laager <rlaager@wiktel.com>
parents:
17080
diff
changeset
|
102 #endif |
16668
07cf49a0f404
I _think_ this is it for libpurple's padding...
Gary Kramlich <grim@reaperworld.com>
parents:
16098
diff
changeset
|
103 |
07cf49a0f404
I _think_ this is it for libpurple's padding...
Gary Kramlich <grim@reaperworld.com>
parents:
16098
diff
changeset
|
104 /* padding */ |
07cf49a0f404
I _think_ this is it for libpurple's padding...
Gary Kramlich <grim@reaperworld.com>
parents:
16098
diff
changeset
|
105 NULL, |
07cf49a0f404
I _think_ this is it for libpurple's padding...
Gary Kramlich <grim@reaperworld.com>
parents:
16098
diff
changeset
|
106 NULL, |
15693
cd02b303b81f
Fix the following compiler warning:
Mark Doliner <mark@kingant.net>
parents:
15617
diff
changeset
|
107 NULL |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
108 }; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
109 /*** End of the eventloop functions. ***/ |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
110 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
111 /*** Conversation uiops ***/ |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
112 static void |
15822 | 113 null_write_conv(PurpleConversation *conv, const char *who, const char *alias, |
114 const char *message, PurpleMessageFlags flags, time_t mtime) | |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
115 { |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
116 const char *name; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
117 if (alias && *alias) |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
118 name = alias; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
119 else if (who && *who) |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
120 name = who; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
121 else |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
122 name = NULL; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
123 |
15822 | 124 printf("(%s) %s %s: %s\n", purple_conversation_get_name(conv), |
125 purple_utf8_strftime("(%H:%M:%S)", localtime(&mtime)), | |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
126 name, message); |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
127 } |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
128 |
15822 | 129 static PurpleConversationUiOps null_conv_uiops = |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
130 { |
17080
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
131 NULL, /* create_conversation */ |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
132 NULL, /* destroy_conversation */ |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
133 NULL, /* write_chat */ |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
134 NULL, /* write_im */ |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
135 null_write_conv, /* write_conv */ |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
136 NULL, /* chat_add_users */ |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
137 NULL, /* chat_rename_user */ |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
138 NULL, /* chat_remove_users */ |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
139 NULL, /* chat_update_user */ |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
140 NULL, /* present */ |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
141 NULL, /* has_focus */ |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
142 NULL, /* custom_smiley_add */ |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
143 NULL, /* custom_smiley_write */ |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
144 NULL, /* custom_smiley_close */ |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
145 NULL, /* send_confirm */ |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
146 NULL, |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
147 NULL, |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
148 NULL, |
4b65a67d23b8
Replace some C99 struct syntax.
Richard Laager <rlaager@wiktel.com>
parents:
16668
diff
changeset
|
149 NULL |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
150 }; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
151 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
152 static void |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21060
diff
changeset
|
153 null_ui_init(void) |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
154 { |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
155 /** |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
156 * This should initialize the UI components for all the modules. Here we |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
157 * just initialize the UI for conversations. |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
158 */ |
15822 | 159 purple_conversations_set_ui_ops(&null_conv_uiops); |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
160 } |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
161 |
15822 | 162 static PurpleCoreUiOps null_core_uiops = |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
163 { |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
164 NULL, |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
165 NULL, |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
166 null_ui_init, |
16668
07cf49a0f404
I _think_ this is it for libpurple's padding...
Gary Kramlich <grim@reaperworld.com>
parents:
16098
diff
changeset
|
167 NULL, |
07cf49a0f404
I _think_ this is it for libpurple's padding...
Gary Kramlich <grim@reaperworld.com>
parents:
16098
diff
changeset
|
168 |
07cf49a0f404
I _think_ this is it for libpurple's padding...
Gary Kramlich <grim@reaperworld.com>
parents:
16098
diff
changeset
|
169 /* padding */ |
07cf49a0f404
I _think_ this is it for libpurple's padding...
Gary Kramlich <grim@reaperworld.com>
parents:
16098
diff
changeset
|
170 NULL, |
07cf49a0f404
I _think_ this is it for libpurple's padding...
Gary Kramlich <grim@reaperworld.com>
parents:
16098
diff
changeset
|
171 NULL, |
07cf49a0f404
I _think_ this is it for libpurple's padding...
Gary Kramlich <grim@reaperworld.com>
parents:
16098
diff
changeset
|
172 NULL, |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
173 NULL |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
174 }; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
175 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
176 static void |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21060
diff
changeset
|
177 init_libpurple(void) |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
178 { |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
179 /* Set a custom user directory (optional) */ |
15822 | 180 purple_util_set_user_dir(CUSTOM_USER_DIRECTORY); |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
181 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
182 /* We do not want any debugging for now to keep the noise to a minimum. */ |
19547
6c726af063c9
Revert jeff2's changes from 2007-08-12. Specifically revision
Mark Doliner <mark@kingant.net>
parents:
18910
diff
changeset
|
183 purple_debug_set_enabled(FALSE); |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
184 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 /* Set the core-uiops, which is used to |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
186 * - initialize the ui specific preferences. |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
187 * - initialize the debug ui. |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
188 * - initialize the ui components for all the modules. |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
189 * - uninitialize the ui components for all the modules when the core terminates. |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
190 */ |
15822 | 191 purple_core_set_ui_ops(&null_core_uiops); |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
192 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
193 /* Set the uiops for the eventloop. If your client is glib-based, you can safely |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
194 * copy this verbatim. */ |
15822 | 195 purple_eventloop_set_ui_ops(&glib_eventloops); |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
196 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
197 /* Set path to search for plugins. The core (libpurple) takes care of loading the |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
198 * core-plugins, which includes the protocol-plugins. So it is not essential to add |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
199 * any path here, but it might be desired, especially for ui-specific plugins. */ |
15822 | 200 purple_plugins_add_search_path(CUSTOM_PLUGIN_PATH); |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
201 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 /* Now that all the essential stuff has been set, let's try to init the core. It's |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
203 * necessary to provide a non-NULL name for the current ui to the core. This name |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
204 * is used by stuff that depends on this ui, for example the ui-specific plugins. */ |
15822 | 205 if (!purple_core_init(UI_ID)) { |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
206 /* Initializing the core failed. Terminate. */ |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
207 fprintf(stderr, |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
208 "libpurple initialization failed. Dumping core.\n" |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
209 "Please report this!\n"); |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
210 abort(); |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
211 } |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
212 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
213 /* Create and load the buddylist. */ |
15822 | 214 purple_set_blist(purple_blist_new()); |
215 purple_blist_load(); | |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
216 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
217 /* Load the preferences. */ |
15822 | 218 purple_prefs_load(); |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
219 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
220 /* Load the desired plugins. The client should save the list of loaded plugins in |
15822 | 221 * the preferences using purple_plugins_save_loaded(PLUGIN_SAVE_PREF) */ |
222 purple_plugins_load_saved(PLUGIN_SAVE_PREF); | |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
223 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
224 /* Load the pounces. */ |
15822 | 225 purple_pounces_load(); |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
226 } |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
227 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
228 static void |
15822 | 229 signed_on(PurpleConnection *gc, gpointer null) |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
230 { |
15822 | 231 PurpleAccount *account = purple_connection_get_account(gc); |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
232 printf("Account connected: %s %s\n", account->username, account->protocol_id); |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
233 } |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
234 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
235 static void |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21060
diff
changeset
|
236 connect_to_signals_for_demonstration_purposes_only(void) |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
237 { |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
238 static int handle; |
15822 | 239 purple_signal_connect(purple_connections_get_handle(), "signed-on", &handle, |
240 PURPLE_CALLBACK(signed_on), NULL); | |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
241 } |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
242 |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21060
diff
changeset
|
243 int main(int argc, char *argv[]) |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
244 { |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
245 GList *iter; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
246 int i, num; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
247 GList *names = NULL; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
248 const char *prpl; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
249 char name[128]; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
250 char *password; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
251 GMainLoop *loop = g_main_loop_new(NULL, FALSE); |
15822 | 252 PurpleAccount *account; |
253 PurpleSavedStatus *status; | |
22067
3684c9d16f6f
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents:
22007
diff
changeset
|
254 char *res; |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
255 |
21060
9838af97586b
A pidgin fans in Great Britain.U.K thinks that nullclient should explicitly
Will Thompson <will.thompson@collabora.co.uk>
parents:
19681
diff
changeset
|
256 /* libpurple's built-in DNS resolution forks processes to perform |
9838af97586b
A pidgin fans in Great Britain.U.K thinks that nullclient should explicitly
Will Thompson <will.thompson@collabora.co.uk>
parents:
19681
diff
changeset
|
257 * blocking lookups without blocking the main process. It does not |
9838af97586b
A pidgin fans in Great Britain.U.K thinks that nullclient should explicitly
Will Thompson <will.thompson@collabora.co.uk>
parents:
19681
diff
changeset
|
258 * handle SIGCHLD itself, so if the UI does not you quickly get an army |
9838af97586b
A pidgin fans in Great Britain.U.K thinks that nullclient should explicitly
Will Thompson <will.thompson@collabora.co.uk>
parents:
19681
diff
changeset
|
259 * of zombie subprocesses marching around. |
9838af97586b
A pidgin fans in Great Britain.U.K thinks that nullclient should explicitly
Will Thompson <will.thompson@collabora.co.uk>
parents:
19681
diff
changeset
|
260 */ |
9838af97586b
A pidgin fans in Great Britain.U.K thinks that nullclient should explicitly
Will Thompson <will.thompson@collabora.co.uk>
parents:
19681
diff
changeset
|
261 signal(SIGCHLD, SIG_IGN); |
9838af97586b
A pidgin fans in Great Britain.U.K thinks that nullclient should explicitly
Will Thompson <will.thompson@collabora.co.uk>
parents:
19681
diff
changeset
|
262 |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
263 init_libpurple(); |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
264 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
265 printf("libpurple initialized.\n"); |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
266 |
15822 | 267 iter = purple_plugins_get_protocols(); |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
268 for (i = 0; iter; iter = iter->next) { |
15822 | 269 PurplePlugin *plugin = iter->data; |
270 PurplePluginInfo *info = plugin->info; | |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
271 if (info && info->name) { |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
272 printf("\t%d: %s\n", i++, info->name); |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
273 names = g_list_append(names, info->id); |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
274 } |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
275 } |
19547
6c726af063c9
Revert jeff2's changes from 2007-08-12. Specifically revision
Mark Doliner <mark@kingant.net>
parents:
18910
diff
changeset
|
276 printf("Select the protocol [0-%d]: ", i-1); |
22067
3684c9d16f6f
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents:
22007
diff
changeset
|
277 res = fgets(name, sizeof(name), stdin); |
3684c9d16f6f
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents:
22007
diff
changeset
|
278 if (!res) { |
3684c9d16f6f
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents:
22007
diff
changeset
|
279 fprintf(stderr, "Failed to gets protocol selection."); |
3684c9d16f6f
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents:
22007
diff
changeset
|
280 abort(); |
3684c9d16f6f
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents:
22007
diff
changeset
|
281 } |
19547
6c726af063c9
Revert jeff2's changes from 2007-08-12. Specifically revision
Mark Doliner <mark@kingant.net>
parents:
18910
diff
changeset
|
282 sscanf(name, "%d", &num); |
6c726af063c9
Revert jeff2's changes from 2007-08-12. Specifically revision
Mark Doliner <mark@kingant.net>
parents:
18910
diff
changeset
|
283 prpl = g_list_nth_data(names, num); |
6c726af063c9
Revert jeff2's changes from 2007-08-12. Specifically revision
Mark Doliner <mark@kingant.net>
parents:
18910
diff
changeset
|
284 |
6c726af063c9
Revert jeff2's changes from 2007-08-12. Specifically revision
Mark Doliner <mark@kingant.net>
parents:
18910
diff
changeset
|
285 printf("Username: "); |
22067
3684c9d16f6f
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents:
22007
diff
changeset
|
286 res = fgets(name, sizeof(name), stdin); |
3684c9d16f6f
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents:
22007
diff
changeset
|
287 if (!res) { |
3684c9d16f6f
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents:
22007
diff
changeset
|
288 fprintf(stderr, "Failed to read user name."); |
3684c9d16f6f
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents:
22007
diff
changeset
|
289 abort(); |
3684c9d16f6f
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents:
22007
diff
changeset
|
290 } |
19547
6c726af063c9
Revert jeff2's changes from 2007-08-12. Specifically revision
Mark Doliner <mark@kingant.net>
parents:
18910
diff
changeset
|
291 name[strlen(name) - 1] = 0; /* strip the \n at the end */ |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
292 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
293 /* Create the account */ |
19547
6c726af063c9
Revert jeff2's changes from 2007-08-12. Specifically revision
Mark Doliner <mark@kingant.net>
parents:
18910
diff
changeset
|
294 account = purple_account_new(name, prpl); |
6c726af063c9
Revert jeff2's changes from 2007-08-12. Specifically revision
Mark Doliner <mark@kingant.net>
parents:
18910
diff
changeset
|
295 |
6c726af063c9
Revert jeff2's changes from 2007-08-12. Specifically revision
Mark Doliner <mark@kingant.net>
parents:
18910
diff
changeset
|
296 /* Get the password for the account */ |
6c726af063c9
Revert jeff2's changes from 2007-08-12. Specifically revision
Mark Doliner <mark@kingant.net>
parents:
18910
diff
changeset
|
297 password = getpass("Password: "); |
6c726af063c9
Revert jeff2's changes from 2007-08-12. Specifically revision
Mark Doliner <mark@kingant.net>
parents:
18910
diff
changeset
|
298 purple_account_set_password(account, password); |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
299 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
300 /* It's necessary to enable the account first. */ |
15822 | 301 purple_account_set_enabled(account, UI_ID, TRUE); |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
302 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
303 /* Now, to connect the account(s), create a status and activate it. */ |
19547
6c726af063c9
Revert jeff2's changes from 2007-08-12. Specifically revision
Mark Doliner <mark@kingant.net>
parents:
18910
diff
changeset
|
304 status = purple_savedstatus_new(NULL, PURPLE_STATUS_AVAILABLE); |
6c726af063c9
Revert jeff2's changes from 2007-08-12. Specifically revision
Mark Doliner <mark@kingant.net>
parents:
18910
diff
changeset
|
305 purple_savedstatus_activate(status); |
15617
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
306 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
307 connect_to_signals_for_demonstration_purposes_only(); |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
308 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
309 g_main_loop_run(loop); |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
310 |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
311 return 0; |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
312 } |
7e0c0062c428
Add the example nullclient here.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
313 |