Coder Social home page Coder Social logo

axmpp's People

Contributors

reznikmm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

axmpp's Issues

Invalid message with characters like ('"&)

When AXMPP gets a message with apostrophe inside it drops all text starting with apostrophe. For instance, if I send "a'b" only "a" is received:

Recieved from GNUTLS.Record_Recv : 
<message from='[email protected]/pc' to='[email protected]/con_cli' id='purple23653fc9' type='chat'><active xmlns='http://jabber.org/protocol/chatstates'/><body>a&apos;b</body></message>
=================================
Message: 
From:[email protected]/pc
Body:a

Avoid deprecated funcs in agnutls

It seems GNUTLS functions used in libagnutls.so are deprecated and removed. Could you upgrade?

gprbuild -p -Pgnat/agnutls.gpr
gprbuild -p -Pgnat/axmpp.gpr
gprbuild -p -Pgnat/con_cli.gpr
Link
   [link]         main.adb
/tmp/axmpp/.libs//libagnutls.so: undefined reference to `gnutls_cipher_set_priority'
/tmp/axmpp/.libs//libagnutls.so: undefined reference to `gnutls_compression_set_priority'
/tmp/axmpp/.libs//libagnutls.so: undefined reference to `gnutls_kx_set_priority'
/tmp/axmpp/.libs//libagnutls.so: undefined reference to `gnutls_protocol_set_priority'
/tmp/axmpp/.libs//libagnutls.so: undefined reference to `gnutls_mac_set_priority'
collect2: error: ld returned 1 exit status
gprbuild: link of main.adb failed

See A Upgrading from previous versions

Unable to join MUC

Joining MUC raises program error in xmpp-mucs.adb Set_Content:

raise Program_Error with "Not yet implemented";

This procedure is called with arguments 'code', '110'. Corresponding message from the server:

<presence from='[email protected]/ada_ru' to='[email protected]/con_cli'>
 <x xmlns='vcard-temp:x:update'><photo/></x>
 <x xmlns='http://jabber.org/protocol/muc#user'>
  <item affiliation='member' role='participant'/>
  <status code='110'/>
 </x>
</presence>

Unable to send message

Sending a message raises an exception:

raised CONSTRAINT_ERROR : namespace is not mapped to any prefix

This could be fixed by commenting this lines in (xmpp-messages.adb Serialize):

      --  setting xml:lang attr
      Attrs.Set_Value
       (Namespace_URI => XML_URI,
        Local_Name    => Lang_Attribute,
        Value         => Self.Language);

gnutls_record_recv returns a strange size

Hi!
I tried the con_cli example but it closed the connection too soon. Thus, I activate the XMPP.logger and added some Put_Line to debug the GNUTLS.Record_Recv. After that, I found something strange on the agnutls library. I change the procedure like this:

   procedure Record_Recv (S      : Session;
                          Data   : GNAT.Sockets.Vector_Type;
                          Length : out Ada.Streams.Stream_Element_Count)
   is
      N_Read : Interfaces.C.size_t;

   begin
      Length := 0;
      
      for I in Data'Range loop
         N_Read := gnutls_record_recv (S, Data (I).Base, Data (I).Length);

         if N_Read = 0 then
            gnutls_perror (Interfaces.C.int (N_Read));
            raise GNUTLS_Error with "Data read = 0";
         end if;
         
         Put_Line (N_Read'Image); --  <- added 
         Put_Line (Ada.Streams.Stream_Element_Count'Last'Image); --  <- added
         Length := Length + Ada.Streams.Stream_Element_Count (N_Read);
     
         if N_Read < Data (I).Length then
            --  nothing to read
            return;
         end if;
      end loop;

   end Record_Recv;

It returned this output on the terminal:

$ examples/con_cli/main
Setting session object
Opening...
Connecting
On_Connect!
Starting idle
Waiting for data in select
Start_Stream called
Stream_Features called
Sending starttls
Sending XML : <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
Waiting for data in select
GNUTLS.Anon_Allocate_Client_Credentials
Init
GNUTLS.Transport_Set_Ptr
GNUTLS.Handshake
GnuTLS error: Resource temporarily unavailable, try again.
READ
Waiting for data in select
Handshake complete
On_Connect!
Sendinging data via TLS
Waiting for data in select
 18446744073709551588
 9223372036854775807
raised CONSTRAINT_ERROR : gnutls.adb:407 range check failed

I took a look at the manpage of the C gnutls_record_recv function and it says that it returns the number of bytes. I suppose that that amount of information in one record is a mistake. Maybe some casting problems?

For now, I just fixed it just ignoring the sum if the number is larger. I don't think it's the proper way but it worked:

if N_Read < Interfaces.C.size_t (Ada.Streams.Stream_Element_Count'Last) then
               Length := Length + Ada.Streams.Stream_Element_Count (N_Read);
end if;

Here is a patch if you want to try it.

Is there a way to fix this? Is it fine to do is?
Cheers!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.