def handle_cast(:activate, state) do :inet.setopts(state.socket, active: :once) {:noreply, state} end defp transfer_control(socket, connection) do case :gen_tcp.controlling_process(socket, connection) do :ok - >
activate(connection) :ok error - >
close(connection) erro r
end end defp activate(connection), do: GenServer.cast(connection, :activate) end
def handle_cast(:activate, state) do :inet.setopts(state.socket, active: :once) {:noreply, state} end defp transfer_control(socket, connection) do case :gen_tcp.controlling_process(socket, connection) do :ok - >
activate(connection) :ok error - >
close(connection) erro r
end end defp activate(connection), do: GenServer.cast(connection, :activate) end
def handle_cast(:activate, state) do :inet.setopts(state.socket, active: :once) {:noreply, state} end defp transfer_control(socket, connection) do case :gen_tcp.controlling_process(socket, connection) do :ok - >
activate(connection) :ok error - >
close(connection) erro r
end end defp activate(connection), do: GenServer.cast(connection, :activate) end
def receive_message(manager \\ __MODULE__, message, from) do GenServer.cast(manager, {:receive_message, message, from}) end def handle_cast({:receive_message, message, from}, state) do if state.mode == :host do for_active_connections(fn {:unde fi ned, pid, :worker, [Connection]} when pid != from - >
def receive_message(manager \\ __MODULE__, message, from) do GenServer.cast(manager, {:receive_message, message, from}) end def handle_cast({:receive_message, message, from}, state) do if state.mode == :host do for_active_connections(fn {:unde fi ned, pid, :worker, [Connection]} when pid != from - >
def receive_message(manager \\ __MODULE__, message, from) do GenServer.cast(manager, {:receive_message, message, from}) end def handle_cast({:receive_message, message, from}, state) do if state.mode == :host do for_active_connections(fn {:unde fi ned, pid, :worker, [Connection]} when pid != from - >
def receive_message(manager \\ __MODULE__, message, from) do GenServer.cast(manager, {:receive_message, message, from}) end def handle_cast({:receive_message, message, from}, state) do if state.mode == :host do for_active_connections(fn {:unde fi ned, pid, :worker, [Connection]} when pid != from - >
def receive_message(manager \\ __MODULE__, message, from) do GenServer.cast(manager, {:receive_message, message, from}) end def handle_cast({:receive_message, message, from}, state) do if state.mode == :host do for_active_connections(fn {:unde fi ned, pid, :worker, [Connection]} when pid != from - >
def send_to_all(manager \\ __MODULE__, message) do GenServer.call(manager, {:send_to_all, message}) end def handle_call({:send_to_all, message}, _from, state) do result = queue_all_sends(message, state) {:reply, result, state} end end
def send_to_all(manager \\ __MODULE__, message) do GenServer.call(manager, {:send_to_all, message}) end def handle_call({:send_to_all, message}, _from, state) do result = queue_all_sends(message, state) {:reply, result, state} end end
def receive_send_error(manager \\ __MODULE__, message_id, error) do GenServer.cast(manager, {:receive_send_error, message_id, error}) end def handle_cast({:receive_send_error, message_id, _error}, state) do state.ui.show_send_failure(message_id) {:noreply, state} end end
def receive_send_error(manager \\ __MODULE__, message_id, error) do GenServer.cast(manager, {:receive_send_error, message_id, error}) end def handle_cast({:receive_send_error, message_id, _error}, state) do state.ui.show_send_failure(message_id) {:noreply, state} end end
Record.extract_all(from_lib: "wx/include/wx.hrl") |> Enum.map(fn {name, fi elds} -> Record.defrecordp(name, fi elds) end) def handle_info( wx( id: _id ,
obj: window ,
userData: _userData ,
event: wxClose(type: :close_window) ) ,
%__MODULE__{window: window} = stat e
) do quit(state) {:noreply, state} end defp quit(state) do ConnectionManager.reset() :wxWindow.destroy(state.window) :wx.destroy() System.stop(0) end end
Record.extract_all(from_lib: "wx/include/wx.hrl") |> Enum.map(fn {name, fi elds} -> Record.defrecordp(name, fi elds) end) def handle_info( wx( id: _id ,
obj: window ,
userData: _userData ,
event: wxClose(type: :close_window) ) ,
%__MODULE__{window: window} = stat e
) do quit(state) {:noreply, state} end defp quit(state) do ConnectionManager.reset() :wxWindow.destroy(state.window) :wx.destroy() System.stop(0) end end
Record.extract_all(from_lib: "wx/include/wx.hrl") |> Enum.map(fn {name, fi elds} -> Record.defrecordp(name, fi elds) end) def handle_info( wx( id: _id ,
obj: window ,
userData: _userData ,
event: wxClose(type: :close_window) ) ,
%__MODULE__{window: window} = stat e
) do quit(state) {:noreply, state} end defp quit(state) do ConnectionManager.reset() :wxWindow.destroy(state.window) :wx.destroy() System.stop(0) end end
Record.extract_all(from_lib: "wx/include/wx.hrl") |> Enum.map(fn {name, fi elds} -> Record.defrecordp(name, fi elds) end) def handle_info( wx( id: _id ,
obj: window ,
userData: _userData ,
event: wxClose(type: :close_window) ) ,
%__MODULE__{window: window} = stat e
) do quit(state) {:noreply, state} end defp quit(state) do ConnectionManager.reset() :wxWindow.destroy(state.window) :wx.destroy() System.stop(0) end end
def show_send_failure(ref) do GenServer.cast(__MODULE__, {:show_send_failure, ref}) end def handle_cast({:show_send_failure, ref}, state) do case Map.pop(state.active_sends, ref) do {{message, _timestamp}, new_active_sends} - >
append_text_with_font( state.chat ,
"The following message was not received by all participants: " < >
def show_send_failure(ref) do GenServer.cast(__MODULE__, {:show_send_failure, ref}) end def handle_cast({:show_send_failure, ref}, state) do case Map.pop(state.active_sends, ref) do {{message, _timestamp}, new_active_sends} - >
append_text_with_font( state.chat ,
"The following message was not received by all participants: " < >
def show_send_failure(ref) do GenServer.cast(__MODULE__, {:show_send_failure, ref}) end def handle_cast({:show_send_failure, ref}, state) do case Map.pop(state.active_sends, ref) do {{message, _timestamp}, new_active_sends} - >
append_text_with_font( state.chat ,
"The following message was not received by all participants: " < >
def show_chat_message(name, content) do GenServer.cast(__MODULE__, {:show_chat_message, name, content}) end def handle_cast({:show_chat_message, name, action}, state) when is_atom(action) do append_text_with_font(state.chat, "#{name} #{action}\n", state.italic) {:noreply, state} end def handle_cast({:show_chat_message, name, content}, state) do append_message(name, content, state) {:noreply, state} end end
def show_chat_message(name, content) do GenServer.cast(__MODULE__, {:show_chat_message, name, content}) end def handle_cast({:show_chat_message, name, action}, state) when is_atom(action) do append_text_with_font(state.chat, "#{name} #{action}\n", state.italic) {:noreply, state} end def handle_cast({:show_chat_message, name, content}, state) do append_message(name, content, state) {:noreply, state} end end
def show_chat_message(name, content) do GenServer.cast(__MODULE__, {:show_chat_message, name, content}) end def handle_cast({:show_chat_message, name, action}, state) when is_atom(action) do append_text_with_font(state.chat, "#{name} #{action}\n", state.italic) {:noreply, state} end def handle_cast({:show_chat_message, name, content}, state) do append_message(name, content, state) {:noreply, state} end end
def show_chat_message(name, content) do GenServer.cast(__MODULE__, {:show_chat_message, name, content}) end def handle_cast({:show_chat_message, name, action}, state) when is_atom(action) do append_text_with_font(state.chat, "#{name} #{action}\n", state.italic) {:noreply, state} end def handle_cast({:show_chat_message, name, content}, state) do append_message(name, content, state) {:noreply, state} end end