Jump to content

HeartWare

Members
  • Content Count

    15
  • Joined

  • Last visited

Posts posted by HeartWare


  1. This is the communication log (>> is me sending, << is receiveing)

    Quote

     

    
    << * OK The Microsoft Exchange IMAP4 service is ready. [TQBNADAAUAAyADgAMABDAEEAMAAwADgAMAAuAFMAVwBFAFAAMgA4ADAALgBQAFIATwBEAC4ATwBVAFQATABPAE8ASwAuAEMATwBNAA==]
    >> C1 CAPABILITY
    << * CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
    << C1 OK CAPABILITY completed.
    >> C2 AUTHENTICATE XOAUTH2 dXNlcj1ib3VuY2VAYWRtaW5kLmRrAWF1d******DQyLWM4YzEtNGJhYy1iN2Y1LTQxN2Y4ZmZlOTc0ZAEB
    << C2 NO AUTHENTICATE failed.
    >> C3 LOGOUT
    << * BYE Microsoft Exchange Server IMAP4 server signing off.
    << C3 OK LOGOUT completed.

     

     


  2. Thank you very much, Remy. I have now come a bit longer, but it still fails (maybe I'm feeding it the wrong "secret key"). I have this code now:

    Quote

     

    PROCEDURE TForm141.ConnectBtnClick(Sender: TObject);
      VAR
        IMAP        : TIdIMAP4;
        SSL         : TIdSSLIOHandlerSocketOpenSSL;
        PASS        : TIdUserPassProvider;
        SASL        : TIdSASLXOAuth2;

      BEGIN
        IMAP:=TIdIMAP4.Create(NIL);
        TRY
          IMAP.Host:=Host.Text;
          IMAP.AuthType:=TIdIMAP4AuthenticationType.iatSASL;
          SSL:=TIdSSLIOHandlerSocketOpenSSL.Create(IMAP);
          IMAP.IOHandler:=SSL;
          IMAP.UseTLS:=TIdUseTLS.utUseImplicitTLS;
          PASS:=TIdUserPassProvider.Create(IMAP);
          PASS.Username:=UserName.Text;
          PASS.Password:=SecretKey;
          SASL:=TIdSASLXOAuth2.Create(IMAP);
          SASL.UserPassProvider:=PASS;
          IMAP.SASLMechanisms.Add.SASL:=SASL;
          SSL.SSLOptions.SSLVersions:=[TIdSSLVersion.sslvTLSv1_2];
          IMAP.Port:=993;
          IMAP.Connect;
          TRY
            Information('Messages: '+IntToStr(IMAP.MailBox.TotalMsgs))
          FINALLY
            IMAP.Disconnect
          END
        FINALLY
          FreeAndNIL(IMAP)
        END
      END;

     

     

    but it fails in IdIMAP4.PAS at this line:

    Quote

     

    function PerformSASLLogin_IMAP(ASASL: TIdSASL; AEncoder: TIdEncoder;
      ADecoder: TIdDecoder; AClient : TIdIMAP4): Boolean;
    const
      AOkReplies: array[0..0] of string = (IMAP_OK);
      AContinueReplies: array[0..0] of string = (IMAP_CONT);
    var
      S: String;
      AuthStarted: Boolean;
    begin
      Result := False;
      AuthStarted := False;

      // TODO: use UTF-8 when base64-encoding strings...

      if AClient.IsCapabilityListed('SASL-IR') then begin {Do not localize}
        if ASASL.TryStartAuthenticate(AClient.Host, AClient.Port, IdGSKSSN_imap, S) then begin
          AClient.SendCmd(AClient.NewCmdCounter, 'AUTHENTICATE ' + String(ASASL.ServiceName) + ' ' + AEncoder.Encode(S), [], True); {Do not Localize}
          if CheckStrFail(AClient.LastCmdResult.Code, AOkReplies, AContinueReplies) then begin
            ASASL.FinishAuthenticate;
            Exit; // this mechanism is not supported // <--- Exits here
          end;
          AuthStarted := True;
        end;
      end;

     

     

    And ASASL.Service = 'XOAUTH2' and S = 'user=<MailBox@domain>'#1'auth=Bearer <Secret Key>'#1#1 and AClient.LastCmdResult.Code = 'NO'

     

    When I generated my tokens/keys according to Outlook documentation, I got two values. I have tried with both of them, and they both fail at this spot.

     

    Is there a way where I can generate the token needed in code somehow, or do I need to use the value I was given via the online web system?

     


  3. Thank you, Remy.

     

    I have downloaded the files, explicitly added the necessary .PAS files to my project (to force the use of these instead of the Indy10 in my RAD Studio installation), and added the following lines:

    Quote

          SASL:=TIdSASLXOAuth2.Create(IMAP);
          // What do I need to initialize in SASL ?
          IMAP.SASLMechanisms.Add.SASL:=SASL;

    after the "UseTLS" line.

     

    I assume I need to assign something to SASL.UserPassProvider and/or call some of the Autheticate functions. But what should I put into the parameters of the Authenticate calls? Host/Protocol I assume will be outlook.office365.com and 993 (?) but what about "ProtocolName" and what do I send/receive in VirtualResponse? Where do I put the base64 encoded string with user and bearer token? In OnGetAccessToken, I assume?

     

    What final value from SASL should I assign to IMAP.Password after authentication? Or does that happen internally, due to my adding SASL to the IMAP's SASLMechanisms?

     

    Can you help me out, please? 🙂


  4. I currently have the following code:

    Quote

     

    procedure TForm141.ConnectBtnClick(Sender: TObject);
      VAR
        IMAP        : TIdIMAP4;
        SSL         : TIdSSLIOHandlerSocketOpenSSL;

      BEGIN
        IMAP:=TIdIMAP4.Create(NIL);
        TRY
          SSL:=TIdSSLIOHandlerSocketOpenSSL.Create(IMAP);
          IMAP.Host:=Host.Text;
          IMAP.Username:=UserName.Text;
          IMAP.Password:=Password.Text;
          IMAP.IOHandler:=SSL;
          IMAP.AuthType:=TIdIMAP4AuthenticationType.iatUserPass;
          IMAP.UseTLS:=TIdUseTLS.utUseImplicitTLS;
          SSL.SSLOptions.SSLVersions:=[TIdSSLVersion.sslvTLSv1_2];
          IMAP.Port:=993;
          IMAP.Connect;
          TRY
            Information('Messages: '+IntToStr(IMAP.MailBox.TotalMsgs))
          FINALLY
            IMAP.Disconnect
          END
        FINALLY
          FreeAndNIL(IMAP)
        END
      END;

     

     

    but when I try to connect to Microsoft Office365 (at outlook.office365.com) I can't get it to work (get "LOGIN failed" exception). Is there some other property of the TIdIMAP that I need to set? And what exactly should I put into the UserName/Password fields?

     

    Anyone have some working code that connects to outlook.office365.com using TIdIMAP4 ?

     

    Keld R. Hansen


  5. How do you make a sub-folder to an already existing folder in Favorite branch? Ie. I have a Favorite folder "Utils" under which I want to sub-divide my projects in "GUI" and "CLI", f.ex. When I click the "+" button, it always creates the new folder directly under Favorites. And when I try to Drag'n'Drop it into the correct folder, it just drags it to another position within the Favorites branch.

     

    Also, when I use Drag'n'Drop (after enabling it) from one favorite folder to another, it doesn't operate on the project I'm dragging, but always takes the top one from the source folder.

     

    Also, when Drag'n'Dropping, it should MOVE the project instead of COPYing it (unless you hold down Ctrl when you drag - then it is a COPY operation, as per the standard Windows Drag'n'Drop).

     

    I'm really getting to like this extension, but it still has a few rough edges 🙂


  6. 7 minutes ago, HeartWare said:

    When I try to "Close All Files", I get an exception:

     

    [Crash Dump]

     

    and I am unable to continue other than hard-killing BDS.

    A possible explanation:

     

    If I have the "Close Welcome screen when opening a new project" enabled, the error occurs. If the Welcome screen is open when I select "Close All Files", it doesn't.


  7. When I try to "Close All Files", I get an exception:

     

    [308BDA88]{WP.gksoftPlugin280.bpl} WP.gksoftPlugIn.View.Gksoftplugin.View.TWPFileNotifier.FileNotification (Line 1659, "WP.gksoftPlugIn.View.pas" + 12) + $3
    [2F233D50]{EurekaLogCore280.bpl} Especificdelphi.IsCppExceptionCode + $20
    [2F3C18DA]{EurekaLogCore280.bpl} Eexceptioninfocpp.ECppException + $35A
    [2F3C63E8]{EurekaLogCore280.bpl} Eexceptioninfobcb.EBCPPStdException.GetStdException + $278
    [2F3C7BE4]{EurekaLogCore280.bpl} Eexceptioninfollvm.EBCPPStdException.GetStdException + $214
    [2F3CA492]{EurekaLogCore280.bpl} Eexceptioninfomsvc.EMSCppStdException.GetStdException + $222
    [79A21033]{rtl280.bpl  } System.@HandleAnyException (Line 20992, "System.pas" + 13) + $0
    [79A29D87]{rtl280.bpl  } System.TInterfacedObject.QueryInterface (Line 39725, "System.pas" + 1) + $8
    [79A1FF56]{rtl280.bpl  } System.TObject.GetInterface (Line 18385, "System.pas" + 7) + $9
    [79A29D87]{rtl280.bpl  } System.TInterfacedObject.QueryInterface (Line 39725, "System.pas" + 1) + $8
    [308BDA19]{WP.gksoftPlugin280.bpl} WP.gksoftPlugIn.View.Gksoftplugin.View.TWPFileNotifier.FileNotification (Line 1650, "WP.gksoftPlugIn.View.pas" + 3) + $7
    [79A29D87]{rtl280.bpl  } System.TInterfacedObject.QueryInterface (Line 39725, "System.pas" + 1) + $8
    [78C52FC5]{coreide280.bpl} IDEServices.TIDEServices.SendFileNotification (Line 5331, "IDEServices.pas" + 😎 + $10
    [78C536FA]{coreide280.bpl} IDEServices.FileNotification (Line 5592, "IDEServices.pas" + 1) + $9
    [78951B9F]{coreide280.bpl} ProjectGroup.TProjectGroup.BeforeDestruction (Line 920, "ProjectGroup.pas" + 4) + $10
    [79A20529]{rtl280.bpl  } System.@BeforeDestruction (Line 19336, "System.pas" + 10) + $0
    [78951B26]{coreide280.bpl} ProjectGroup.TProjectGroup.Destroy (Line 901, "ProjectGroup.pas" + 0) + $2
    [79A1FDF4]{rtl280.bpl  } System.TObject.Free (Line 17991, "System.pas" + 1) + $4
    [789584F6]{coreide280.bpl} ProjectGroup.TProjectGroupWrapper.Close (Line 2848, "ProjectGroup.pas" + 2) + $5
    [00EE7B0F]{bds.exe     } AppMain.TAppBuilder.DestroyProjectGroup (Line 2841, "AppMain.pas" + 21) + $9
    [00EE7C68]{bds.exe     } AppMain.TAppBuilder.CloseProjectGroup (Line 2863, "AppMain.pas" + 4) + $2
    [00EE8B49]{bds.exe     } AppMain.TAppBuilder.FileCloseAll (Line 3156, "AppMain.pas" + 😎 + $2
    [79B349D3]{rtl280.bpl  } System.Classes.TBasicAction.Execute (Line 17981, "System.Classes.pas" + 3) + $7
    [795CFAC2]{vcl280.bpl  } Vcl.ActnList.TCustomAction.Execute (Line 284, "Vcl.ActnList.pas" + 19) + $35
    [79B34827]{rtl280.bpl  } System.Classes.TBasicActionLink.Execute (Line 17892, "System.Classes.pas" + 2) + $7
    [7743664D]{vclactnband280.bpl} Vcl.ActnMenus.TCustomActionMenuBar.ExecAction (Line 1099, "Vcl.ActnMenus.pas" + 6) + $D
    [77437F08]{vclactnband280.bpl} Vcl.ActnMenus.TCustomActionMenuBar.TrackMenu (Line 1869, "Vcl.ActnMenus.pas" + 19) + $15
    [7743BA5E]{vclactnband280.bpl} Vcl.ActnMenus.TCustomActionMainMenuBar.TrackMenu (Line 3739, "Vcl.ActnMenus.pas" + 5) + $3
    [774361CC]{vclactnband280.bpl} Vcl.ActnMenus.TCustomActionMenuBar.CMItemClicked (Line 969, "Vcl.ActnMenus.pas" + 2) + $11
    [774361D5]{vclactnband280.bpl} Vcl.ActnMenus.TCustomActionMenuBar.CMItemClicked (Line 970, "Vcl.ActnMenus.pas" + 3) + $4
    [795E7F46]{vcl280.bpl  } Vcl.Controls.TControl.WndProc (Line 7584, "Vcl.Controls.pas" + 91) + $6
    [795ED0F1]{vcl280.bpl  } Vcl.Controls.TWinControl.WndProc (Line 10631, "Vcl.Controls.pas" + 170) + $6
    [795E7B7C]{vcl280.bpl  } Vcl.Controls.TControl.Perform (Line 7362, "Vcl.Controls.pas" + 10) + $8
    [795EC6F9]{vcl280.bpl  } Vcl.Controls.GetControlAtPos (Line 10332, "Vcl.Controls.pas" + 2) + $78
    [795ECF7D]{vcl280.bpl  } Vcl.Controls.TWinControl.WndProc (Line 10579, "Vcl.Controls.pas" + 118) + $1D
    [795ED0F1]{vcl280.bpl  } Vcl.Controls.TWinControl.WndProc (Line 10631, "Vcl.Controls.pas" + 170) + $6
    [7743803B]{vclactnband280.bpl} Vcl.ActnMenus.TCustomActionMenuBar.WndProc (Line 1913, "Vcl.ActnMenus.pas" + 25) + $4
    [795EC5FC]{vcl280.bpl  } Vcl.Controls.TWinControl.MainWndProc (Line 10308, "Vcl.Controls.pas" + 3) + $6
    [79B3580C]{rtl280.bpl  } System.Classes.StdWndProc (Line 18490, "System.Classes.pas" + 😎 + $0
    [7973417F]{vcl280.bpl  } Vcl.Forms.TApplication.ProcessMessage (Line 11460, "Vcl.Forms.pas" + 23) + $1
    [797341C2]{vcl280.bpl  } Vcl.Forms.TApplication.HandleMessage (Line 11490, "Vcl.Forms.pas" + 1) + $4
    [79734501]{vcl280.bpl  } Vcl.Forms.TApplication.Run (Line 11629, "Vcl.Forms.pas" + 27) + $3
    [00F38082]{bds.exe     } bds.bds (Line 227, "" + 16) + $2

     

    and I am unable to continue other than hard-killing BDS.


  8. 1 minute ago, HeartWare said:

    Okay - installed in my v11.2 and it installed okay.

     

    But I can't populate the various branches. I have clicked the "Enable Drag'n'Drop" and can start a drag operation from the plug-in's "Recently Used->Projects" but I can't drop it on the "Favourites" branch (get a "forbidden" stop sign).

     

    How am I supposed to populate the branches if not by D'n'D?

     

    Also, the "+" button above the tree doesn't do anything. How am I to create new branches under the existing ones?

    Okay - think I've figured it out. The "Favourites" can't be populated - only branches below that one.

     

    And the "+" cannot create sub-branches other than in Favourites... (ie. not in "Recently Used->Projects").


  9. Okay - installed in my v11.2 and it installed okay.

     

    But I can't populate the various branches. I have clicked the "Enable Drag'n'Drop" and can start a drag operation from the plug-in's "Recently Used->Projects" but I can't drop it on the "Favourites" branch (get a "forbidden" stop sign).

     

    How am I supposed to populate the branches if not by D'n'D?

     

    Also, the "+" button above the tree doesn't do anything. How am I to create new branches under the existing ones?


  10.  

    image.thumb.png.90b19adcedcf671e1d3c7cb086b11fcb.png

     

    I'd use TJvSplitter from Jedi VCL, set their ResizeStyle = rsUpdate, and then on Splitter2's OnMoved event, I have this:

     

    procedure TForm128.JvSplitter2Moved(Sender: TObject);
    begin
      Panel5.Width:=Panel3.Width
    end;

     

    and on Splitter3's OnMoved:

     

    procedure TForm128.JvSplitter3Moved(Sender: TObject);
    begin
      Panel3.Width:=Panel5.Width
    end;

     

    This way, not only are they updated while dragging, but also follow along each other.


  11. Is it possible to control the location of a Sub-Menu off a TPopupMenu? Ie. A TPopupMenu has an item that is a sub-menu with items. I want to control where this sub-menu pops up (normally, it pops up to the right, but I want it to pop up on the left due to screen design).

     

    Or is it possible to not have the sub-menu being auto-opened with mouse hover over the sub-menu item (ie. you have to click the sub-menu item in order to open the entire sub menu)?

×