Solved

problems with message

Posted on 2006-10-20
8
156 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
  • 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
 

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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 125 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now