Jump to content
Sign in to follow this  
theguy0000

IM client

Recommended Posts

theguy0000

ok, so, ill try to explain this the best i can...

I have a client based off of AutoItSmith's beta server. When the client recieves the message "[ip],CWM_MSG_RECV,[from] [message]" from the server, it should:

1.check wether there is an existing converstation with [from]

2.if yes, update the text box, adding [message]

3.if no, create a new tab where the text box containing the conversation, and a text box to type messages is. in the newly created conversation, put [message] in there.

how would I do this?

(each conversation should be in a new tab in the same gui window)

#include <GuiConstants.au3>
#include <GuiEdit.au3>
#include <Misc.au3>
Global $MainUser
Global $Server = "70.173.62.34"
Global $Port = 44844
TCPStartup()
$MainSocket = TCPConnect($Server, $Port)
If $MainSocket = -1 Then Exit MsgBox(16, "CodeWiz Messenger", "Could Not Connect or Bad Connection. Click OK to exit.")
GUICreate("CodeWiz Messenger", 390, 210)
$Send = GUICtrlCreateEdit("", 10, 10, 175, 150, $WS_VSCROLL)
Local $History = GUICtrlCreateEdit("Server Messages:", 200, 10, 175, 150, BitOR($WS_VSCROLL, $ES_READONLY))
$SButton = GUICtrlCreateButton("Send", 145, 165, 100, 35)
$exit = GUICtrlCreateButton("Disconnect", 270, 165, 150, 35)
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        Exit
    ElseIf $msg = $SButton Or _IsPressed ("0D") = 1 Then
        $Text = GUICtrlRead($Send)
        $TCPSent = TCPSend($MainSocket, $Text)
        GUICtrlSetData($Send, "")
    ElseIf $msg = $exit Then
        If MsgBox ( 36, "Disconnect", "Are you sure you want to quit?") = 6 Then Exit
    EndIf
    $Recv = TCPRecv($MainSocket, 512)
    If $Recv <> "" Then
        GUICtrlSetData($History, GUICtrlRead($History) & @CRLF & $Recv)
        _GUICtrlEditLineScroll ($History, 0, _GUICtrlEditGetLineCount ($History))
    EndIf
WEnd
Func OnAutoItExit()
    TCPSend ($MainSocket, @IPAddress1&",CWM_CLIENT_BYE,"&$MainUser)
    TCPCloseSocket($MainSocket)
    TCPShutdown()
EndFunc;==>OnAutoItExit
Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
themax90

Which version of the server are you using, my Optimized Server, ITS Exp, ITS File-Based 0.5-0.8.1 or Unreleased ITS Internal 0.9?

Share this post


Link to post
Share on other sites
theguy0000

uhh...the one that you can type autoit commands in the client and the server would do them..

edit: http://www.autoitscript.com/forum/index.php?showtopic=19468

but as you can obviously see, i changed it a lot. yours is the base.

edit2: also, in each tab, one for each active conversation, the messenger should know which person to send it to depending on which tab it's in.

edit3: here is the server

server_0.0.1_ALPHA.au3

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
themax90

Then simply arrange it in an array form, create $Tab1 for $ConnectedSocket[1] and So on, and if $msg = $Tab1 TCPSend($ConnectedSocket[1], $Data)

Share this post


Link to post
Share on other sites
theguy0000

ah! thanks!

edit: but i need inactive users to not have tabs...

edit2: nvm. i got it. thanks!.

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×