Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
in google Talk
Page: previous  1  2  3  next
Avatar
CameronKloot #16
Member since Mar 2008 · 19 posts
Group memberships: Members
Show profile · Link to this post
In reply to post ID 3062
Changing the Status and ShowType of the xmpp connection still works.  Is there a way to update an avatar without using a presence object?
Avatar
Alex #17
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you are working currently with vcard based avatars XEP-0153: vCard-Based Avatars
Updating the avatar needs no presence because you send only your new vcard to the server. You need the avatar info in your presence to notify your contacts of changes. Otherwise you contacts would have to poll your vcard on each login which is too much overhead and traffic. They get your presence anyway, so the avatar is included in the presence. This is how the protocol works.
There are new avatar protocols over pubsub, but this does not help you because all current client use the old extensions currently.

Alex
Alexander Gnauck
AG-Software
Avatar
CameronKloot #18
Member since Mar 2008 · 19 posts
Group memberships: Members
Show profile · Link to this post
So any idea why my Presence object is not working properly?  Whenever I send it I go offline.  Even when I send the XML string it doesn't work, just goes offline.  Any ideas?
This post was edited on 2008-04-01, 22:36 by CameronKloot.
Avatar
Jabberer #19
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
no,
please post your complete xml logs. There we can see the reason why you go offline.
Software Developer
AG-Software
Avatar
CameronKloot #20
Member since Mar 2008 · 19 posts
Group memberships: Members
Show profile · Link to this post
Um, how would I do that again =/
sorry
Avatar
Alex #21
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
subscribe to the OnReadXml and OnWriteXml events.
Alexander Gnauck
AG-Software
Avatar
CameronKloot #22
Member since Mar 2008 · 19 posts
Group memberships: Members
Show profile · Link to this post
OK, got it:
here is the code I used to show what happens:
            Presence p = new Presence();
            p.Show = agsXMPP.protocol.client.ShowType.away;
            xmpp.Send(p);
and here is the log:
<stream:error xmlns:stream="http://etherx.jabber.org/streams"><unsupported-stanza-type xmlns="urn:ietf:params:xml:ns:xmpp-streams" /><str:text xmlns:str="urn:ietf:params:xml:ns:xmpp-streams">XML namespace not declared correctly for stanza.</str:text></stream:error>
</stream:stream>

Thanks
Avatar
Alex #23
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
this is only a small part of the log. Please post the complete log.
Alexander Gnauck
AG-Software
Avatar
CameronKloot #24
Member since Mar 2008 · 19 posts
Group memberships: Members
Show profile · Link to this post
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="gmail.com" version="1.0" id="743379CDBD9C5B14" >
<stream:features xmlns:stream="http://etherx.jabber.org/streams"><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required /></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-GOOGLE-TOKEN</mechanism></mechanisms></stream:features>
<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="gmail.com" version="1.0" id="F221A7B2F1312CC5" >
<stream:features xmlns:stream="http://etherx.jabber.org/streams"><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>X-GOOGLE-TOKEN</mechanism></mechanisms></stream:features>
<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="gmail.com" version="1.0" id="D1C15E9688474DE5" >
<stream:features xmlns:stream="http://etherx.jabber.org/streams"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" /><session xmlns="urn:ietf:params:xml:ns:xmpp-session" /></stream:features>
<iq xmlns="jabber:client" from="gmail.com" type="result" id="agsXMPP_1"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><jid>cameronkloot@gmail.com/agsXMPP2EDBA0C7</jid></bind></iq>
<iq xmlns="jabber:client" from="gmail.com" type="result" id="agsXMPP_2" />
<iq xmlns="jabber:client" from="gmail.com" to="cameronkloot@gmail.com/agsXMPP2EDBA0C7" type="error" id="agsXMPP_3"><query xmlns="jabber:iq:agents" /><error code="501" type="cancel"><feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /></error></iq>
<iq xmlns="jabber:client" to="cameronkloot@gmail.com/agsXMPP2EDBA0C7" type="result" id="agsXMPP_4"><query xmlns="jabber:iq:roster"><item jid="anakinpiewalker@gmail.com" subscription="both" /></query></iq>
<presence xmlns="jabber:client" from="anakinpiewalker@gmail.com/Talk.v10429C3179A" to="cameronkloot@gmail.com/agsXMPP2EDBA0C7"><priority>24</priority><c xmlns="http://jabber.org/protocol/caps" ext="share-v1 voice-v1" ver="1.0.0.104" node="http://www.google.com/xmpp/client/caps" /><x xmlns="jabber:x:delay" stamp="20080402T18:32:11" /><status>available</status><x xmlns="vcard-temp:x:update"><photo>08975c3fdbee8de473ef9d22355c5e1b4f306899</photo></x></presence>
<stream:error xmlns:stream="http://etherx.jabber.org/streams"><unsupported-stanza-type xmlns="urn:ietf:params:xml:ns:xmpp-streams" /><str:text xmlns:str="urn:ietf:params:xml:ns:xmpp-streams">XML namespace not declared correctly for stanza.</str:text></stream:error>
</stream:stream>
Avatar
Alex #25
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
the outgoing presence which you send is missing in this log. I can see no errors there. The Google server sais unknown stanza and namespace error.
Are you using the correct Presence class for clients agsXMPP.protocol.client.Presence?

Alex
Alexander Gnauck
AG-Software
Avatar
CameronKloot #26
Member since Mar 2008 · 19 posts
Group memberships: Members
Show profile · Link to this post
ahha, I was using the Component.Presence.  Stupid me, bleh.  Thanks.


Well, that works now, but when I try to run this Avatar code:

            byte[] imagebytes;
            using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
            {
                Image i = Image.FromFile(textBox1.Text);
                i.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                imagebytes = ms.ToArray();
            }
            agsXMPP.protocol.iq.vcard.VcardIq v = new agsXMPP.protocol.iq.vcard.VcardIq();
            v.Vcard.Photo = new agsXMPP.protocol.iq.vcard.Photo(textBox1.Text);
            Presence p = new Presence(agsXMPP.protocol.client.ShowType.chat, "ASDF", 5);
            agsXMPP.protocol.x.Avatar a = new agsXMPP.protocol.x.Avatar();
            a.Hash = agsXMPP.util.Hash.HexToString(imagebytes);
            p.AddChild(a);
            xmpp.Send(v);
            xmpp.Send(p);

it doesn't work.  Here is the log, the xml error didn't make any sense to me.

<stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="gmail.com" version="1.0" id="0B55F558E26CDFAE" >
<stream:features xmlns:stream="http://etherx.jabber.org/streams"><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required /></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-GOOGLE-TOKEN</mechanism></mechanisms></stream:features>
<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="gmail.com" version="1.0" id="D9A1BE5E75A991D2" >
<stream:features xmlns:stream="http://etherx.jabber.org/streams"><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>X-GOOGLE-TOKEN</mechanism></mechanisms></stream:features>
<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="gmail.com" version="1.0" id="BB8133DA42414542" >
<stream:features xmlns:stream="http://etherx.jabber.org/streams"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" /><session xmlns="urn:ietf:params:xml:ns:xmpp-session" /></stream:features>
<iq xmlns="jabber:client" from="gmail.com" type="result" id="agsXMPP_1"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><jid>cameronkloot@gmail.com/agsXMPPAFBFF704</jid></bind></iq>
<iq xmlns="jabber:client" from="gmail.com" type="result" id="agsXMPP_2" />
<iq xmlns="jabber:client" from="gmail.com" to="cameronkloot@gmail.com/agsXMPPAFBFF704" type="error" id="agsXMPP_3"><query xmlns="jabber:iq:agents" /><error code="501" type="cancel"><feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /></error></iq>
<iq xmlns="jabber:client" to="cameronkloot@gmail.com/agsXMPPAFBFF704" type="result" id="agsXMPP_4"><query xmlns="jabber:iq:roster"><item jid="anakinpiewalker@gmail.com" subscription="both" /></query></iq>
<presence xmlns="jabber:client" from="anakinpiewalker@gmail.com/Talk.v10429C3179A" to="cameronkloot@gmail.com/agsXMPPAFBFF704"><priority>24</priority><c xmlns="http://jabber.org/protocol/caps" ext="share-v1 voice-v1" ver="1.0.0.104" node="http://www.google.com/xmpp/client/caps" /><x xmlns="jabber:x:delay" stamp="20080402T18:32:11" /><status>available</status><x xmlns="vcard-temp:x:update"><photo>08975c3fdbee8de473ef9d22355c5e1b4f306899</photo></x></presence>
<iq xmlns="jabber:client" type="error" id="agsXMPP_5"><vCard xmlns="vcard-temp"><PHOTO><EXTVAL>C:\Documents and Settings\CCK\My Documents\iPod Wallpaper\wallpaper55.png</EXTVAL></PHOTO></vCard><error code="400" type="modify"><bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">IQ types must be one of 'set', 'get', 'result' or 'error'.</text></error></iq>
Avatar
Alex #27
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
when you update your vcard the the iq type must be set.
add v.Type = IqType.set;

also the image is wrong. In the log I see teh following:
<PHOTO><EXTVAL>C:\Documents and Settings\CCK\My Documents\iPod Wallpaper\wallpaper55.png</EXTVAL></PHOTO>

When you use EXTVAL then this must be a URL which other clients can access. Its easier to include the image directly in the vcard without EXTVAL.

Alex
Alexander Gnauck
AG-Software
Avatar
CameronKloot #28
Member since Mar 2008 · 19 posts
Group memberships: Members
Show profile · Link to this post
OK, I set the Vcard option.  But I am unsure of what you mean in the second option.  How else would I set the VCard other then:
 v.Vcard.Photo = new agsXMPP.protocol.iq.vcard.Photo(textBox1.Text);
?
Also, the hash length is upward of 50,000.  Is this normal for a fairly complicated image?
Thanks
Avatar
Alex #29
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by CameronKloot:
OK, I set the Vcard option.  But I am unsure of what you mean in the second option.  How else would I set the VCard other then:
 v.Vcard.Photo = new agsXMPP.protocol.iq.vcard.Photo(textBox1.Text);

set it from a .NET image object like here:
  1.  
  2. Image img = Image.FromFile(filename);
  3.                
  4. string ext = Path.GetExtension(filename);
  5. switch (ext.ToLower())
  6. {
  7.     case ".png":
  8.         imageFormat = ImageFormat.Png;
  9.         break;
  10.     case ".jpg":
  11.     case ".jpeg":
  12.         imageFormat = ImageFormat.Jpeg;
  13.         break;                       
  14.     case ".gif":
  15.         imageFormat = ImageFormat.Gif;
  16.         break;
  17.  
  18. }
  19. vcard.Photo = new Photo(img, imageFormat);

Quote by CameronKloot:
Also, the hash length is upward of 50,000.  Is this normal for a fairly complicated image?
no the size of a SHA1 Hash is always 20 bytes. the size of the image does not matter.
Pictures in your vcard should be small. I suggest about <=10K.

Alex
Alexander Gnauck
AG-Software
Avatar
CameronKloot #30
Member since Mar 2008 · 19 posts
Group memberships: Members
Show profile · Link to this post
Thanks so much, I got it working once I resized the images to under 32 width and height.  Thanks again.
Cameron
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Page: previous  1  2  3  next
Forum: agsXMPP SDK Support RSS