|
List Info
Thread: Noob question
|
|
| Noob question |

|
2007-08-24 02:27:25 |
|
Hey guys, New to loudmouth, the examples dont really help very much unless you're trying to so _very_ basic things 
Does anyone have a simple example of basically a console app that keeps the connection open and displays anything sent to it and can send strings from the console to the specified recipient.
I've just been having a lot of trouble with g_main_loop, I setup a g_timeout timer and it'll run a few things and then basically stop randomly.
eg:
static void gcallback(gpointer data) {
g_print("Callback calledn"); }
int main() { ... main_loop = g_main_loop_new (NULL, FALSE); g_timeout_add(1000, (GSourceFunc)gcallback, NULL); g_print ("Running mainloopn");
g_main_loop_run (main_loop); return 0; }
Any help would be appreciated.
|
| Re: Noob question |
  Sweden |
2007-08-24 02:37:00 |
24 aug 2007 kl. 09.27 skrev Sergei:
Hi,
> Hey guys,
> New to loudmouth, the examples dont really help very
much unless
> you're trying to
> so _very_ basic things
>
> Does anyone have a simple example of basically a
console app that
> keeps the connection open and displays anything sent to
it and can
> send strings from the console to the specified
recipient.
I currently don't but most of the hard bits would not be
related to
Loudmouth as your would do basically what is done in
lm-send-async.c
but without stopping the mainloop directly and closing the
connection.
> I've just been having a lot of trouble with
g_main_loop, I setup a
> g_timeout timer and it'll run a few things and then
basically stop
> randomly.
The problem is that you have the wrong signature for your
gcallback
function. It should return TRUE if you want it to continue,
FALSE to
remove it.
Best Regards,
Mikael Hallendal
>
> eg:
>
> static void gcallback(gpointer data)
> {
> g_print("Callback calledn");
> }
>
> int main()
> {
> ...
> main_loop = g_main_loop_new (NULL, FALSE);
> g_timeout_add(1000, (GSourceFunc)gcallback, NULL);
> g_print ("Running mainloopn");
> g_main_loop_run (main_loop);
> return 0;
> }
>
> Any help would be appreciated.
>
> _______________________________________________
> Loudmouth mailing list
> Loudmouth lists.imendio.com
> h
ttp://lists.imendio.com/mailman/listinfo/loudmouth
--
Imendio AB, http://www.imendio.com
_______________________________________________
Loudmouth mailing list
Loudmouth lists.imendio.com
h
ttp://lists.imendio.com/mailman/listinfo/loudmouth
|
|
| Re: Noob question |

|
2007-08-24 02:49:04 |
|
Yes, embarrassingly, I'd just realized that. But I copied it from the glib documentation, so not quite my fault.
btw, how can I get the timestamp of the message?
I'd assume it would be with lm_message_node_get_child(),
is there a list of the values that it takes? (eg: "body")
Ive looked thru the LM documentation and didnt see anything about it.
Thanks,
mm_202.
On 8/24/07,
Mikael Hallendal < micke imendio.com">micke imendio.com> wrote:
24 aug 2007 kl. 09.27 skrev Sergei:
Hi,
> Hey guys, > New to loudmouth, the examples dont really help very much unless > you're trying to > so _very_ basic things  > > Does anyone have a simple example of basically a console app that
> keeps the connection open and displays anything sent to it and can > send strings from the console to the specified recipient.
I currently don't but most of the hard bits would not be related to
Loudmouth as your would do basically what is done in lm-send-async.c but without stopping the mainloop directly and closing the connection.
> I've just been having a lot of trouble with g_main_loop, I setup a
> g_timeout timer and it'll run a few things and then basically stop > randomly.
The problem is that you have the wrong signature for your gcallback function. It should return TRUE if you want it to continue, FALSE to
remove it.
Best Regards, Mikael Hallendal
> > eg: > > static void gcallback(gpointer data) > { > g_print("Callback calledn"); > } > > int main()
> { > ... > main_loop = g_main_loop_new (NULL, FALSE); > g_timeout_add(1000, (GSourceFunc)gcallback, NULL); > g_print ("Running mainloopn"); > g_main_loop_run (main_loop);
> return 0; > } > > Any help would be appreciated. > > _______________________________________________ > Loudmouth mailing list > Loudmouth lists.imendio.com">
Loudmouth lists.imendio.com > http://lists.imendio.com/mailman/listinfo/loudmouth
-- Imendio AB, http://www.imendio.com
_______________________________________________ Loudmouth mailing list Loudmouth lists.imendio.com">Loudmouth lists.imendio.com
http://lists.imendio.com/mailman/listinfo/loudmouth
|
| Re: Noob question |
  Sweden |
2007-08-29 08:59:27 |
24 aug 2007 kl. 09.49 skrev Sergei:
Hi,
> Yes, embarrassingly, I'd just realized that.
> But I copied it from the glib documentation, so not
quite my fault.
Do you have a reference to where you found that in the glib
documentation so that it can be fixed?
> btw, how can I get the timestamp of the message?
>
> I'd assume it would be with
lm_message_node_get_child(),
> is there a list of the values that it takes? (eg:
"body")
Timestamp is not set as an attribute on the stanza in XMPP
but rather
on an x child with the namespace jabber :dela
y. You can look at the
function gossip_jabber_get_message_timestamp in
gossip-jabber-utils.c:
http://svn.gnome.org/viewcvs/gossip/trunk/libg
ossip/gossip-jabber-
utils.c?revision=2436&view=markup
The LM documentation only contains information on how to use
Loudmouth, you also need the protocol definition RFC 3920
and 3921.
Best Regards,
Mikael Hallendal
--
Imendio AB, http://www.imendio.com
_______________________________________________
Loudmouth mailing list
Loudmouth lists.imendio.com
h
ttp://lists.imendio.com/mailman/listinfo/loudmouth
|
|
[1-4]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|