Untitled

Java Guest 6 Views Size: 8.73 KB Posted on: Feb 21, 26 @ 9:02 PM
  1.     // IRCop tools
  2.     if (showIrcOpTools) {
  3.         ModalBottomSheet(onDismissRequest = { showIrcOpTools = false }) {
  4.             val scrollState = rememberScrollState()
  5.             Column(
  6.                 Modifier
  7.                     .fillMaxWidth()
  8.                     .fillMaxHeight(0.92f)
  9.                     .padding(16.dp)
  10.                     .navigationBarsPadding()
  11.                     .imePadding()
  12.                     .verticalScroll(scrollState),
  13.                 verticalArrangement = Arrangement.spacedBy(14.dp)
  14.             ) {
  15.                 Row(verticalAlignment = Alignment.CenterVertically,
  16.                     horizontalArrangement = Arrangement.spacedBy(8.dp)) {
  17.                     Icon(Icons.Default.AdminPanelSettings,
  18.                         contentDescription = null,
  19.                         tint = MaterialTheme.colorScheme.primary)
  20.                     Text("IRCop tools", style = MaterialTheme.typography.titleLarge)
  21.                 }
  22.                 Text("$selNetName", style = MaterialTheme.typography.bodySmall,
  23.                     color = MaterialTheme.colorScheme.onSurfaceVariant)
  24.                 HorizontalDivider()
  25.  
  26.                 var opTarget by remember { mutableStateOf("") }
  27.                 var opReason by remember { mutableStateOf("") }
  28.                 var opMask   by remember { mutableStateOf("") }
  29.                 var opServer by remember { mutableStateOf("") }
  30.                 var opMessage by remember { mutableStateOf("") }
  31.  
  32.                 // Target / Reason fields
  33.                 Text("Target", fontWeight = FontWeight.Bold)
  34.                 OutlinedTextField(
  35.                     value = opTarget, onValueChange = { opTarget = it },
  36.                     modifier = Modifier.fillMaxWidth(), singleLine = true,
  37.                     label = { Text("Nick or host mask") }
  38.                 )
  39.                 OutlinedTextField(
  40.                     value = opReason, onValueChange = { opReason = it },
  41.                     modifier = Modifier.fillMaxWidth(), singleLine = true,
  42.                     label = { Text("Reason") }
  43.                 )
  44.  
  45.                 // Kill / K-line / Z-line
  46.                 Text("Punishments", fontWeight = FontWeight.Bold)
  47.                 Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
  48.                     Button(
  49.                         onClick = {
  50.                             val t = opTarget.trim()
  51.                             if (t.isNotBlank()) {
  52.                                 val r = opReason.trim().ifBlank { "No reason" }
  53.                                 onSend("/kill $t $r")
  54.                                 showIrcOpTools = false
  55.                             }
  56.                         },
  57.                         enabled = opTarget.isNotBlank()
  58.                     ) { Text("Kill") }
  59.                     OutlinedButton(
  60.                         onClick = {
  61.                             val t = opTarget.trim()
  62.                             if (t.isNotBlank()) {
  63.                                 val r = opReason.trim().ifBlank { "No reason" }
  64.                                 onSend("/kline $t $r")
  65.                                 showIrcOpTools = false
  66.                             }
  67.                         },
  68.                         enabled = opTarget.isNotBlank()
  69.                     ) { Text("K-line") }
  70.                     OutlinedButton(
  71.                         onClick = {
  72.                             val t = opMask.trim().ifBlank { opTarget.trim() }
  73.                             if (t.isNotBlank()) {
  74.                                 val r = opReason.trim().ifBlank { "No reason" }
  75.                                 onSend("/zline $t $r")
  76.                                 showIrcOpTools = false
  77.                             }
  78.                         },
  79.                         enabled = opTarget.isNotBlank()
  80.                     ) { Text("Z-line") }
  81.                     OutlinedButton(
  82.                         onClick = {
  83.                             val t = opTarget.trim()
  84.                             if (t.isNotBlank()) {
  85.                                 val r = opReason.trim().ifBlank { "No reason" }
  86.                                 onSend("/gline $t $r")
  87.                                 showIrcOpTools = false
  88.                             }
  89.                         },
  90.                         enabled = opTarget.isNotBlank()
  91.                     ) { Text("G-line") }
  92.                 }
  93.                 Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
  94.                     OutlinedButton(
  95.                         onClick = {
  96.                             val t = opTarget.trim()
  97.                             if (t.isNotBlank()) {
  98.                                 val r = opReason.trim().ifBlank { "No reason" }
  99.                                 onSend("/shun $t $r")
  100.                             }
  101.                         },
  102.                         enabled = opTarget.isNotBlank()
  103.                     ) { Text("Shun") }
  104.                     OutlinedButton(
  105.                         onClick = {
  106.                             val t = opTarget.trim()
  107.                             if (t.isNotBlank()) {
  108.                                 val r = opReason.trim().ifBlank { "No reason" }
  109.                                 onSend("/dline $t $r")
  110.                             }
  111.                         },
  112.                         enabled = opTarget.isNotBlank()
  113.                     ) { Text("D-line") }
  114.                 }
  115.  
  116.                 HorizontalDivider()
  117.  
  118.                 // Force join/part
  119.                 Text("Force join / part", fontWeight = FontWeight.Bold)
  120.                 Row(
  121.                     Modifier.fillMaxWidth(),
  122.                     horizontalArrangement = Arrangement.spacedBy(8.dp),
  123.                     verticalAlignment = Alignment.CenterVertically
  124.                 ) {
  125.                     OutlinedTextField(
  126.                         value = opServer, onValueChange = { opServer = it },
  127.                         modifier = Modifier.weight(1f), singleLine = true,
  128.                         label = { Text("Channel") }
  129.                     )
  130.                     Button(
  131.                         onClick = {
  132.                             val t = opTarget.trim(); val ch = opServer.trim()
  133.                             if (t.isNotBlank() && ch.isNotBlank()) onSend("/sajoin $t $ch")
  134.                         },
  135.                         enabled = opTarget.isNotBlank() && opServer.isNotBlank()
  136.                     ) { Text("SAJoin") }
  137.                     OutlinedButton(
  138.                         onClick = {
  139.                             val t = opTarget.trim(); val ch = opServer.trim()
  140.                             if (t.isNotBlank() && ch.isNotBlank()) onSend("/sapart $t $ch")
  141.                         },
  142.                         enabled = opTarget.isNotBlank() && opServer.isNotBlank()
  143.                     ) { Text("SAPart") }
  144.                 }
  145.  
  146.                 HorizontalDivider()
  147.  
  148.                 // Broadcast messages
  149.                 Text("Broadcast", fontWeight = FontWeight.Bold)
  150.                 OutlinedTextField(
  151.                     value = opMessage, onValueChange = { opMessage = it },
  152.                     modifier = Modifier.fillMaxWidth(), singleLine = true,
  153.                     label = { Text("Message") }
  154.                 )
  155.                 Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
  156.                     Button(
  157.                         onClick = { if (opMessage.isNotBlank()) onSend("/wallops ${opMessage.trim()}") },
  158.                         enabled = opMessage.isNotBlank()
  159.                     ) { Text("WALLOPS") }
  160.                     OutlinedButton(
  161.                         onClick = { if (opMessage.isNotBlank()) onSend("/globops ${opMessage.trim()}") },
  162.                         enabled = opMessage.isNotBlank()
  163.                     ) { Text("GLOBOPS") }
  164.                     OutlinedButton(
  165.                         onClick = { if (opMessage.isNotBlank()) onSend("/locops ${opMessage.trim()}") },
  166.                         enabled = opMessage.isNotBlank()
  167.                     ) { Text("LOCOPS") }
  168.                 }
  169.  
  170.                 HorizontalDivider()
  171.  
  172.                 // Server queries
  173.                 Text("Server queries", fontWeight = FontWeight.Bold)
  174.                 Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
  175.                     OutlinedButton(onClick = { onSend("/motd"); showIrcOpTools = false }) { Text("MOTD") }
  176.                     OutlinedButton(onClick = { onSend("/admin"); showIrcOpTools = false }) { Text("ADMIN") }
  177.                     OutlinedButton(onClick = { onSend("/stats u"); showIrcOpTools = false }) { Text("Uptime") }
  178.                     OutlinedButton(onClick = { onSend("/stats l"); showIrcOpTools = false }) { Text("Links") }
  179.                 }
  180.  
  181.                 Spacer(Modifier.height(8.dp))
  182.             }
  183.         }
  184.     }

Raw Paste

Comments 0
Login to post a comment.
  • No comments yet. Be the first.
Login to post a comment. Login or Register
We use cookies. To comply with GDPR in the EU and the UK we have to show you these.

We use cookies and similar technologies to keep this website functional (including spam protection via Google reCAPTCHA or Cloudflare Turnstile), and — with your consent — to measure usage and show ads. See Privacy.