[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

problems with message

Posted on 2006-10-20
8
Medium Priority
?
166 Views
Last Modified: 2010-04-05
I been trying to stop accounts from joining any public rooms but I want it so it will check rooms and if the room is 'Support Room' it will allow them to join but any thing else it would reject them anyone got any idears??

dat[0] gets current room name
 (Dm.UserTyp='2')  is account level I wish to stop from accessing rooms


[code]
   if (dat[0]=dat[0]) // Check room names
      and
      (Dm.UserTyp='2') // Check account level
   then
   begin
     Showmessage('Sorry!, Help Accounts are unable to access public areas.');
     Exit;
   end
   else
begin


hope sumone can help thanks
0
Comment
Question by:fiveuk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 1

Expert Comment

by:malsoft
ID: 17774488
From your code stub, it looks like you are testing for equality on the same thing at the start ( dat[0] = dat[0] ), that would always be true ( e.g. "1" = "1" and "aaa" = "aaa" etc). If dat[0] contains the room name, maybe you need the following test:

if (dat[0] = {name of support room} ) and (Dm.UserTyp = '2') then
...
0
 

Author Comment

by:fiveuk
ID: 17774757
ok following code stops me from entering support room

   if (dat[0] = 'English Help') // Check room names
      and
      (Dm.UserTyp='2') // Check account level
   then

but I want to be able to enter that room and thing other then English Help would get the error msg!
0
 
LVL 28

Expert Comment

by:TName
ID: 17774861
I'm not sure I understand you. Do you want anyone with UserTyp 2 to ONLY be able to enter the supportroom?

if (dat[0] <> 'Support Room')  and  (Dm.UserTyp='2')
   then begin
     Showmessage('Sorry!, Help Accounts are unable to access public areas.');
     Exit;
   end
   else begin
     //
   end;
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:fiveuk
ID: 17774901
no I would like it so anyone with UserTyp='2' will not to be able to enter any room other then Support Room
0
 
LVL 28

Expert Comment

by:TName
ID: 17774945
>no I would like it so anyone with UserTyp='2' will not to be able to enter any room other then Support Room
I think that's exactly what I said :)

if (dat[0] <> 'Support Room')   //if room is any other than support room
   and                                     //and at the same time
   (Dm.UserTyp='2')                //user type is 2
   then begin                           //then reject  
     Showmessage('Sorry!, Help Accounts are unable to access public areas.');
     Exit;
   end
   else begin
     //
   end;
0
 
LVL 1

Accepted Solution

by:
malsoft earned 500 total points
ID: 17774956
OK, looks like you may want to reverse the logic for the tests. The limiting factor (UserTyp = '2') should be checked first, not what board you are in:

if (Dm.UserTyp = '2') then  // restricted accounts
begin
  if (dat[0] <> 'English Help') then
  begin
    ShowMessage('Sorry...');
    Exit; // leaves routine
  end;

  // continue with "support" options from here...
end
else begin  // non-restricted accounts
...
end;
0
 

Author Comment

by:fiveuk
ID: 17775041
Ok that worked fine but now the problem is all other accounts can not access rooms lol here full code

[code]

if (com='RJoinRoom')then
begin
  if ChatFormTable.Locate('Name',dat[0],[])=false then
  begin
  if (Dm.UserTyp = '2') then  // restricted accounts
  begin
  if (dat[0] <> 'English Help') then
  begin
    Showmessage('Sorry!, Help Accounts are unable to access public areas.');
    Exit; // leaves routine
  // continue with "support" options from here...
end
else begin  // non-restricted accounts
    if NewRForm<>nil  then NewRForm.Close;
    if EnterForm<>nil then EnterForm.Close;
//    if ListForm<>nil  then ListForm.Close;
    if ChatFormTable.Locate('Name',dat[0],[])=false then
     begin
      Application.CreateForm(TChatForm, CForm0);
      CForm0.Name:='chat'+inttostr(CForm0.handle);
      if ChatFormTable.RecordCount=0 then CForm0.media:=true else CForm0.media:=false;
      ChatFormTable.Append;
      ChatFormTable.FieldByName('Name').AsString:=dat[0];
      ChatFormTable.FieldByName('FormName').AsString:=CForm0.Name;
      ChatFormTable.Post;
      CForm0.RoomName:=dat[0];
      CForm0.GroupName:=dat[2];
      CForm0.Caption:=dat[0];
      MyHand:=False;
      Speak:=false;
//      if pos('SPEEX',uppercase(dat[6]))>0 then dat[6]:=copy(dat[6],pos('SPEEX',uppercase(dat[6]))+5,length(dat[6]));
      CForm0.Codec:=dat[6];
      CForm0.PrepareCodec(dat[6]);
      CForm0.Show;
      if (Dm.UserTyp='2')or(Dm.UserTyp='3')then
        CForm0.ChatPopup.Items[4].Visible:=true
      else
       CForm0.ChatPopup.Items[4].Visible:=false;
      if dat[1]='1' then
       begin
        CForm0.Owner:=true;
        CForm0.ChatPopup.Items[4].Visible:=true;
       end
      else
       CForm0.Owner:=false;
      CForm0.SKForm.Caption:=dat[0];
      s:='šGetChatUsersœ'+dat[0]+'œ';
      Socket.SendText(CodeStr(s));
     end
    else
     begin
      CForm0:=Application.FindComponent(ChatFormTableFormName.AsString) as TChatForm;
      if CForm0<>nil then
       begin
        if CForm0.UserTable.Locate('Name',DM.UserName,[])then
         begin
          CForm0.UserTable.Append;
          CForm0.UserTable.FieldByName('Name').AsString:=DM.UserName;
          CForm0.UserTable.FieldByName('Owner').AsString:=dat[1];
          CForm0.UserTable.Post;
          if dat[1]='1' then
           CForm0.VTSInsert(dat[0],dat[1],dat[3],dat[4],'0','0',dat[7])
          else
           CForm0.VTSAppend(dat[0],dat[1],dat[3],dat[4],'0','0',dat[7]);
         end;
         end;
       end;
     end;
     end;
   end;
end;
0
 

Author Comment

by:fiveuk
ID: 17775245
Ok i fixed it thanks
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question