Ver Mensaje Individual
  #39  
Antiguo 02-04-2010
Avatar de fide_uci
fide_uci fide_uci is offline
Miembro
 
Registrado: ene 2009
Ubicación: Cuba - La Habana
Posts: 226
Reputación: 18
fide_uci Va por buen camino
Asi es como me va quedando la DLL. Por favor que alguien me la revise a ver que error le encuentra.

Código Delphi [-]
library XMPPCore;

{********************************************************************************
*  XMPPCore.dll es la dll que contiene todas las funciones para la manipulacion *
*  de todos los stream XML que se envian y reciben con el cliente y el servidor.*
*********************************************************************************}

uses
  SysUtils, Classes, xmldom, XMLIntf, msxmldom, XMLDoc, XMPP_Res;

{$R *.res}

function xmpp_initialization(pTo: PChar): PChar; stdcall;
begin
    xmpp_res_Initialization;
    Result := PChar(Format(xmpp_res_initialization, [pTo]));
end;

function xmpp_login(pUserName, pPassword, pResource: PChar): PChar; stdcall;
var
  cXMLDoc: TXMLDocument;
begin

  cXMLDoc := TXMLDocument.Create(nil);
  try
    cXMLDoc.XML.Text := xmpp_res_login;
    cXMLDoc.Active := True;
    cXMLDoc.DocumentElement.ChildNodes['query'].ChildNodes['username'].Text := pUserName;
    cXMLDoc.DocumentElement.ChildNodes['query'].ChildNodes['password'].Text := pPassword;
    cXMLDoc.DocumentElement.ChildNodes['query'].ChildNodes['resource'].Text := pResource;
    Result := PChar(cXMLDoc.XML.Text);
  finally
    cXMLDoc.Free;
  end;

end;

function xmpp_presence(pType, pMsg, pShow: PChar): PChar; stdcall;
var
  cXMLDoc: TXMLDocument;
  vStrUtils: String;
begin

  cXMLDoc := TXMLDocument.Create(nil);
  try
    cXMLDoc.XML.Text := xmpp_res_presence;
    cXMLDoc.Active := True;
    vStrUtils := pType;
    if pMsg <> '' then
      cXMLDoc.DocumentElement.SetAttributeNS('type', '', vStrUtils)
    else
      cXMLDoc.DocumentElement.SetAttributeNS('type', '', 'avaliable');
    if pMsg <> '' then
      cXMLDoc.DocumentElement.ChildNodes['status'].Text := pMsg;
    if pShow <> '' then
      cXMLDoc.DocumentElement.ChildNodes['show'].Text := pShow;
    Result := PChar(cXMLDoc.XML.Text);
  finally
    cXMLDoc.Free;
  end;

end;

exports
   xmpp_initialization, xmpp_login, xmpp_presence;

begin
end.
Responder Con Cita