However, I do not think I have registered the extension properly because when my client recieves the xml, it dosent seem to find it as type 'weather'. it seems to just skip over it. im not sure what code to paste..
Do I need to have more references than just the agsXMPP.dll? Such as to the full agsXMPP2008 project? I am editing the URI.cs and element factory.cs files in an open instance of the agsxmp2008 project, but I am not referencing it in my gtalk example which i have opened separately.
If i cannot get it after some more struggling, i will zip files and make a more formal appeal for help.
Using the first example code, without the tagname changed to query, I get this error:
(added into elementfactory.cs)
AddElementType("weather", Uri.WEATHER, typeof(agsXMPP.protocol.extensions.Weather.Weather));
(added into Uri.cs)
//Weather Extension
public const string WEATHER = "agsoftware:weather";
Error 5 The type or namespace name 'Weather' does not exist in the namespace 'agsXMPP.protocol.extensions' (are you missing an assembly reference?) C:\Program Files\AG-Software\agsXMPP SDK\agsxmpp\Factory\ElementFactory.cs 305 85 agsXMPP2008
thanks you.
Robert
This post was edited on 2008-12-23, 06:16 by designbert.
If you put this lines in the agsXMPP code you of course have to recompile it and reference the new recompiled agsXMPP.dll in the Gtalk project.
You can put the weather classes directly in the Gtalk project and register it from there in the ElementFactory.
Hi,Alex,I run example i,and can't receive weather message.
private void XmppCon_OnMessage(object sender, Message msg)
{ if (msg.HasTag(typeof(Weather))) {
Weather weather = msg.SelectSingleElement(typeof(Weather)) as Weather;
Console.WriteLine(weather.Temperature.ToString());
Console.WriteLine(weather.Humidity.ToString());
}
}
I have register element with "agsXMPP.Factory.ElementFactory.AddElementType("weather",
"agsoftware:weather", typeof(Weather))" in form_load of my project.
In the onXMLRead event,I can receive the XML data,"<message xmlns="agsoftware:weather"><from="sun@10.52.81.225/agsXMPP" to="037896@10.52.81.225"><Weather><humidity>90</humidity><temperature>57</temperature></Weather></message>",
the red with red color can't run.
Thanks Alex.
I have found the reason about my previous question.But I found anther problem.I run example one(Weather),when another people is offline,I send messge to her,the table ofoffline doesn't save message.So when another people login,she can't receive my sent message,how can I do?
I am sorry,my English is poor,Thanks again!
If a user is oflfine and you send the message to a full Jid the server returns it with an error. The same applies to servers or user accounts which support no offline storage
When a user is offline then you must send the message to the bare jid.
check for response messages of type error to see if you sent a message to a resource which is not available anymore f id the server of the user supports no offline storage.