~ubuntu-branches/ubuntu/vivid/gloox/vivid-proposed

« back to all changes in this revision

Viewing changes to src/prep.cpp

  • Committer: Package Import Robot
  • Author(s): Vincent Cheng
  • Date: 2014-03-16 17:34:43 UTC
  • mfrom: (12.1.2 experimental)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: package-import@ubuntu.com-20140316173443-4s177dovzaz5dm8o
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
  Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
 
2
  Copyright (c) 2004-2013 by Jakob Schroeter <js@camaya.net>
3
3
  This file is part of the gloox library. http://camaya.net/gloox
4
4
 
5
5
  This software is distributed under a license. The full license
92
92
#endif
93
93
    }
94
94
 
 
95
    bool saslprep( const std::string& input, std::string& out )
 
96
    {
 
97
      #ifdef HAVE_LIBIDN
 
98
      return prepare( input, out, stringprep_saslprep );
 
99
      #else
 
100
      if( input.length() > JID_PORTION_SIZE )
 
101
        return false;
 
102
      out = input;
 
103
      return true;
 
104
      #endif
 
105
    }
 
106
 
95
107
    bool idna( const std::string& domain, std::string& out )
96
108
    {
97
109
#ifdef HAVE_LIBIDN
103
115
      if( rc == IDNA_SUCCESS )
104
116
      {
105
117
        out = prepped;
 
118
        free( prepped );
106
119
        return true;
107
120
      }
108
121
      if( rc != IDNA_MALLOC_ERROR )