# Contributing to Network Chat Client

Thank you for your interest in contributing to the Network Chat Client project! This document provides guidelines and information for contributors.

## Project Information

- **Author**: Molla Samser (Founder, RSK World)
- **Designer & Tester**: Rima Khatun
- **Website**: https://rskworld.in
- **Email**: info@rskworld.com, support@rskworld.com
- **Phone**: +91 93305 39277
- **Year**: 2026
- **License**: MIT

## How to Contribute

### Reporting Issues

1. **Bug Reports**
   - Use the issue tracker on GitHub
   - Provide detailed description of the issue
   - Include steps to reproduce
   - Specify your operating system and compiler
   - Add relevant logs or screenshots

2. **Feature Requests**
   - Open an issue with "Feature Request" label
   - Describe the feature and its use case
   - Explain why it would be valuable
   - Consider implementation complexity

3. **Security Issues**
   - For security vulnerabilities, email directly to info@rskworld.com
   - Do not open public issues for security problems
   - Provide detailed description of the vulnerability

### Development Guidelines

#### Code Style

Follow these coding standards:

```cpp
/**
 * @file filename.h
 * @brief Brief description
 * 
 * Network Chat Client - Header File
 * Author: Molla Samser (Founder, RSK World)
 * Designer & Tester: Rima Khatun
 * Website: https://rskworld.in
 * Email: info@rskworld.com, support@rskworld.com
 * Phone: +91 93305 39277
 * Year: 2026
 * License: MIT
 */

#ifndef FILENAME_H
#define FILENAME_H

// Include headers
#include <iostream>
#include <string>

namespace rskworld {
namespace chat {

/**
 * @brief Class description
 */
class ClassName {
private:
    // Private members
    
public:
    /**
     * @brief Constructor description
     */
    ClassName();
    
    /**
     * @brief Method description
     * @param param Parameter description
     * @return Return value description
     */
    ReturnType methodName(ParameterType param);
};

} // namespace chat
} // namespace rskworld

#endif // FILENAME_H
```

#### Naming Conventions

- **Classes**: PascalCase (e.g., `ChatClient`)
- **Functions**: camelCase (e.g., `sendMessage`)
- **Variables**: camelCase (e.g., `clientSocket`)
- **Constants**: UPPER_CASE (e.g., `MAX_BUFFER_SIZE`)
- **Files**: lowercase_with_underscores (e.g., `chat_client.cpp`)

#### Documentation

- Add Doxygen-style comments to all public interfaces
- Include parameter and return value descriptions
- Add usage examples for complex functions
- Update README and documentation for new features

### Development Setup

#### Prerequisites

- **Windows**: Visual Studio 2019+, CMake 3.16+
- **Linux**: GCC 7+, Clang 7+, CMake 3.16+
- **macOS**: Xcode 10+, CMake 3.16+
- **OpenSSL**: For encryption features (optional)

#### Building the Project

```bash
# Clone the repository
git clone https://github.com/rskworld/network-chat-client.git
cd network-chat-client

# Create build directory
mkdir build
cd build

# Configure and build
cmake ..
cmake --build .

# Run tests
ctest
```

#### Running Tests

```bash
# Build with tests
cmake -DBUILD_TESTS=ON ..
cmake --build .

# Run all tests
ctest --verbose

# Run specific test
./tests/test_chat_client
```

### Contribution Workflow

1. **Fork the Repository**
   - Fork the project on GitHub
   - Clone your fork locally

2. **Create a Branch**
   ```bash
   git checkout -b feature/your-feature-name
   ```

3. **Make Changes**
   - Follow coding standards
   - Add tests for new functionality
   - Update documentation

4. **Test Your Changes**
   ```bash
   # Run all tests
   ctest
   
   # Build on multiple platforms if possible
   # Test on Windows, Linux, and macOS
   ```

5. **Commit Changes**
   ```bash
   git add .
   git commit -m "feat: add your feature description"
   ```

6. **Push and Create Pull Request**
   ```bash
   git push origin feature/your-feature-name
   ```
   - Create pull request on GitHub
   - Provide detailed description
   - Link relevant issues

### Commit Message Format

Follow [Conventional Commits](https://www.conventionalcommits.org/) format:

```
type(scope): description

[optional body]

[optional footer]
```

Types:
- `feat`: New feature
- `fix`: Bug fix
- `docs`: Documentation changes
- `style`: Code style changes
- `refactor`: Code refactoring
- `test`: Test additions/changes
- `chore`: Build process or auxiliary tool changes

Examples:
```
feat(client): add file transfer support

Implement file upload and download functionality
with progress tracking and resume capability.

Closes #123
```

```
fix(server): resolve memory leak in client cleanup

Properly clean up client resources when
connection is terminated unexpectedly.
```

### Code Review Process

1. **Self-Review**
   - Test your changes thoroughly
   - Check for coding standard compliance
   - Ensure documentation is updated

2. **Peer Review**
   - Request review from team members
   - Address feedback promptly
   - Be open to suggestions

3. **Maintainer Review**
   - Final review by project maintainers
   - Merge if all checks pass
   - Request changes if needed

### Testing Guidelines

#### Unit Tests

- Write unit tests for all new functions
- Use Google Test framework
- Aim for high code coverage
- Test edge cases and error conditions

```cpp
#include <gtest/gtest.h>
#include "chat_client.h"

class ChatClientTest : public ::testing::Test {
protected:
    void SetUp() override {
        client = std::make_unique<ChatClient>();
    }
    
    std::unique_ptr<ChatClient> client;
};

TEST_F(ChatClientTest, InitializeReturnsTrue) {
    EXPECT_TRUE(client->initialize());
}

TEST_F(ChatClientTest, SendMessageFailsWhenNotConnected) {
    EXPECT_FALSE(client->sendMessage("test"));
}
```

#### Integration Tests

- Test client-server communication
- Verify message encryption/decryption
- Test multi-client scenarios
- Validate error handling

```cpp
TEST(IntegrationTest, ClientServerCommunication) {
    ChatServer server;
    ASSERT_TRUE(server.initialize(54000));
    ASSERT_TRUE(server.start());
    
    ChatClient client;
    ASSERT_TRUE(client.initialize());
    ASSERT_TRUE(client.start("127.0.0.1", 54000));
    
    // Test message sending
    client.sendBroadcast("test message");
    
    // Verify message received
    auto history = client.getMessageHistory();
    ASSERT_FALSE(history.empty());
    
    client.stop();
    server.stop();
}
```

### Feature Development

#### Adding New Features

1. **Design Phase**
   - Create design document
   - Define API interface
   - Consider backward compatibility

2. **Implementation Phase**
   - Follow coding standards
   - Write comprehensive tests
   - Update documentation

3. **Testing Phase**
   - Unit tests
   - Integration tests
   - Performance tests
   - Security tests

4. **Documentation Phase**
   - Update README
   - Add API documentation
   - Create usage examples

#### Security Considerations

- Follow secure coding practices
- Validate all inputs
- Use proper encryption for sensitive data
- Test for common vulnerabilities
- Follow OWASP guidelines

### Performance Guidelines

#### Optimization

- Profile before optimizing
- Focus on bottlenecks
- Consider memory usage
- Test performance impact

#### Benchmarks

- Include performance tests
- Measure memory usage
- Track response times
- Document performance characteristics

### Documentation Standards

#### README Updates

- Update feature list
- Add new configuration options
- Update installation instructions
- Include breaking changes

#### API Documentation

- Document all public APIs
- Include usage examples
- Describe error conditions
- Provide performance notes

#### Code Comments

- Comment complex logic
- Explain design decisions
- Document limitations
- Include TODO items

### Release Process

#### Version Bump

- Update version numbers
- Update CHANGELOG.md
- Tag release in Git
- Create release notes

#### Distribution

- Build release binaries
- Test on all platforms
- Update documentation
- Announce release

### Community Guidelines

#### Code of Conduct

- Be respectful and inclusive
- Welcome newcomers
- Provide constructive feedback
- Focus on what is best for the community

#### Communication

- Use GitHub issues for discussions
- Join our Discord server (if available)
- Follow project announcements
- Participate in community events

### Getting Help

#### Resources

- **Documentation**: Check README and docs/ folder
- **Issues**: Search existing issues before creating new ones
- **Discussions**: Use GitHub Discussions for questions
- **Email**: Contact info@rskworld.com for private questions

#### Support Channels

- **GitHub Issues**: Bug reports and feature requests
- **GitHub Discussions**: General questions and discussions
- **Email**: Private support and security issues
- **Website**: https://rskworld.in for project information

### Recognition

#### Contributors

- All contributors are acknowledged in the README
- Top contributors are featured on the website
- Contributions are tracked in commit history

#### Attribution

- Maintain original copyright notices
- Credit original authors in modifications
- Include license information in all files

---

## Contact Information

**Primary Contact:**
- **Email**: info@rskworld.com, support@rskworld.com
- **Phone**: +91 93305 39277
- **Website**: https://rskworld.in
- **Address**: Nutanhat, Mongolkote, Purba Burdwan, West Bengal, India, 713147

**Project Lead:**
- **Molla Samser** (Founder, RSK World)
- **Rima Khatun** (Designer & Tester)

---

Thank you for contributing to the Network Chat Client project! Your contributions help make this project better for everyone.

© 2026 RSK World. All rights reserved.

*Content used for educational purposes only. View Disclaimer: https://rskworld.in/disclaimer.php*
